Fault-Tolerant Drive-by-Wire

With two CAN links disconnected, our three controllers still agreed on network state. The largest measured timing difference between the front and rear lamps was 15.5 µs over ten rising edges.

Distributed Embedded Systems · CMU 18-449

CAD render of the controller board on the test vehicle chassis.
In this build

My contribution. I worked on PCB power and ground routing, qualified CAN timestamps for clock synchronization, and fixed Raft log catch-up after follower resets. Our CMU 18-449 team integrated the system and ran the bench tests.

Three controllers, two buses

The Raspberry Pi ran the cockpit on SocketCAN. Two STM32s running Zephyr handled steering and the drivetrain. Each controller had a connection to both independent 500 kbit/s CAN buses.

Each node kept a map of which links were up. A shared bus gave two controllers a direct path. During our split test, the front controller sent on CAN A, the Pi forwarded onto CAN B, and the rear controller received there. The Pi also relayed the leader’s clock references.

In simulation, a restored CAN link could be reported as down again because other controllers still had stale information. I changed link reporting so each controller reports only its own connections.

Consensus and clock synchronization

Raft replicated changes to the network map. Two of the three controllers could commit an update, and each node applied committed entries in the same order. I fixed the catch-up path so a follower could recover missing entries after a reset and rejoin with the same map.

The leader sent a time reference every 20 ms. Followers compared their receive timestamps with the leader’s timestamp for the same frame to correct clock offset and drift. I worked on qualifying those timestamps. When the Pi relayed a reference, it accounted for the time the frame spent at the bridge. The front and rear STM32s could then schedule their lamp edges against the same clock.

Raft bench setup with a Raspberry Pi, two STM32 Nucleo boards, and breadboarded CAN wiring.

Four-layer controller PCB

Our four-layer board integrates both STM32 zones, the Raspberry Pi cockpit interfaces, and six CAN interfaces. Separate rails supply logic, the Pi, and the steering servo. I reinforced the power paths and revised the servo current-sense routing and the ground reference under the SPI and ADC signals.

Drive-by-wire controller schematic showing the battery input and the logic, Raspberry Pi, and servo power supplies

Pointer: drag to pan and wheel to zoom. Touch: drag and pinch. Keyboard: Tab to the labeled viewer controls or switch views below.

The board passed the configured layout checks and was checked for fit in CAD. The timing result above came from the lab kit. Physical fit and powered testing of the custom PCB are still pending.

Keep exploring.

Back to the workshop
Trash collection robot chassis with robotic arm and electronics

Trash Collection Robot

Autonomous bottle-collection robot with Raspberry Pi vision, Arduino motor control, UART command protocol, custom power delivery, and arm actuation.

Explore the project