KSF AI Autopilot Suite - multi-Teensy sailboat autopilot with NMEA2000, private CAN, and iPad UI

fremme

Member
Hello all,
My name is Knut. I have been developing a custom sailboat autopilot system based mainly on Teensy 4.x, and I thought it was time to introduce the project here.
The project is called the KSF AI Autopilot suite:
https://sailingksf.com/?page=autopilot

This is not a general marine display or chartplotter project.
The goal is a dedicated autopilot platform for short-handed and offshore sailing, with strong emphasis on deterministic control, graceful degradation, and practical fault handling.

So far, the project has grown to more than 250,000 lines of code across the Teensy modules, plus about 27,000 lines for the native iPad app. At this point it is a fairly substantial embedded system, so I have had to be quite strict about module boundaries, message contracts, and failure handling.

Current architecture
The core autopilot box uses three Teensy 4.1 boards:
- Main CPU: NMEA 2000 handling, filtering, source arbitration, configuration, logging, and overall system orchestration
- AI CPU: steering logic, hazard handling, confidence/trust logic, and rudder output
- UI CPU: 800x600 display rendering, touch handling, menus, and operator interaction

These three nodes communicate over a private internal CAN bus.
Around that core I also use other Teensy-based nodes, mainly Teensy 4.0, for things such as:
- IMU/attitude modules
- blackbox logging
- alarm/voice functions
- timer and support modules
- weather-assisted advisory

The boat-facing network is NMEA 2000, while the internal control-plane traffic stays on the private CAN bus.
Design philosophy
A few architectural points that have been important to me:
1. One authoritative source of truth. The Main CPU owns the authoritative navigation/wind/system state. The UI does not independently recompute critical values. That keeps the operator display aligned with what the control logic is actually using.
2. Fail-operational behavior. If the system loses some inputs or one subsystem becomes degraded, the objective is to keep steering in the safest possible way instead of just dropping out immediately.
3. Deterministic embedded behavior, I try to avoid dynamic allocation in hot paths, avoid blocking in control-sensitive code, and keep bus/message ownership explicit.
4. Clear separation between vessel bus and internal bus. NMEA 2000 is used for integration with the boat, while the private CAN bus is used for internal binary messaging between Main, AI, and UI.

Current functions
At the moment the suite includes work on:
- heading mode
- wind-based steering
- track / route support
- waypoint workflows
- hazard and alarm handling
- onboard display UI
- native iPad UI
- logging and diagnostics
- weather-assisted advisory functions

The iPad side is a native SwiftUI app connected through an ESP32 gateway. It mirrors the main system pages and allows live monitoring and control without putting more load or complexity into the embedded display node.

Why Teensy
Teensy 4.x has been a very good fit for this project:
- enough CPU headroom for control, filtering, and UI split across nodes
- flexible I/O
- practical CAN support
- easy iteration cycle
- a toolchain that still feels lightweight enough for embedded development
For a project like this, that balance has been very useful.


To be honest, this project has been a great experience so far. I have learned a lot about Teensy, CAN, and embedded system design, and I have loved working on it every step of the way.

I would be very interested in feedback from other Teensy users, especially on reliability, CAN/NMEA 2000 integration, multi-processor architecture, and general robustness for marine use.

Best regards,
Knut
 
Bench Prototype And Integration
Before final enclosure work, several modules were developed as separate table-top units so I could validate LCD workflows, data flow and cross-module behavior in parallel. That made it easier to test real operator screens, timing and integration issues early, before the hardware packaging was finalized.

background-bench-prototype-1246x768.jpg
 
Hello there,

Yes, the challenge now is to stop adding more functionality, since it has already grown far beyond what we first discussed.
But it’s exciting now that all the modules are communicating nicely with each other, and things are really starting to feel like a proper suite.

Yes, we’ve also been a bit concerned about how to find room for everything, but we will.
 
WOW ! That's a great deal of impressive work.

Just curious. Any plans to spray a coating of something to help prevent moisture from penetrating the circuitry? I see a few pcb's occupying plastic housings. Maybe with a well sealed lid (gaskets) this will be sufficient?
 
Conformal coating you mean? For a marine environment I'd recommend conformal coating _and_ hermetically sealed enclosures and connectors, salt water and salty air really destroys electronics and rapidly.
 
Conformal coating is essential, and we are currently using standard NMEA connectors with sealed enclosures.
Although this is not a perfect solution, these are still prototypes.

One remaining concern is the LCD display, as it is not easy to make it fully watertight in a plastic enclosure.
We are currently using resistive touch, but we will likely need to switch to capacitive touch and add a thin glass panel or similar
protective layer on top to achieve a watertight solution.

If they prove reliable in testing, we will move to a more refined, production-ready design.
 
Wow, awesome project. One question, what can bus transceiver you using. Have a project I want to use can bus and whatever transceiver you are using seems to be working well. Thanks.
 
Im now using this one : 1051 TJA1051 TJA1042 High speed low power consumption and CAN transceiver module TJA1051T.
I have tested 3-4 different ones , and found this to be the one working best for me .
NB - just remember the module has and 120 Ohm terminator mounted

Screenshot 2026-03-31 at 07.50.36.png
 
So do you feed the Vcc pin with 3.3V or 5V. I see some versions have a Vio pin, which sets the CAN level to whatever the microcontroller can handle.
 
Oh I see, on the back silkscreen it has the Vio pin, which is the NC pin on the topside. I assume you feed 3.3 volts into the NC/Vio, and 5v into the VCC.
 
No, this module has no voltage regulator and no level shifters, so it must be powered with 3.3V only. Do not use 5V.

Personally, I am not very fond of mixed-voltage modules. Sooner or later a level shifter fails, 5V gets into the 3.3V electronics, and then all kinds of things can happen, including damage that is difficult to predict.
 
Back
Top