CAN Bus Bridge
CAN bus is a standardized electrical bus for vehicles (cars and trucks). All CAN nodes (devices) are connected to each other through a physically conventional two wire bus. The wires are a twisted pair with a 120 Ω (nominal) characteristic impedance. CAN messages are sent and received by CAN nodes over the CAN bus. The CAN bus is a broadcast domain, in which all connections to the bus can reach each other by broadcast.
This example replaces the electrical CAN bus with a bridge Thing connected to CAN nodes (devices) over Wifi. The bridge provides a broadcast domain for the CAN messages, just like the original electrical bus.
Beside being a simple example of a Merle bridge, the example has some practical advantages over the traditional electrical CAN bus:
The bridge electrically isolates nodes. Sometimes this is desirable if the nodes are on different ground domains or are otherwise electrically noisy.
The bridge sees all messages and can provide a tap to a network sniffer such as Wireshark to view/capture message traces during run-time, which is useful for debugging CAN messages.
Nodes can be added and removed readily without having to physically wire each to the electrical bus. CAN specification limits the wire from a node to the bus to no more than 0.5m in length. With this example, the wire length is effectively the range of the Wifi.
The bridge can bridge nodes running at different CAN bus speeds.
The traffic between a node and the bridge is encrypted inside an SSH tunnel. If a node doesn't have the SSH key, it's not going to be able to connect to the bridge.
CAN Bridge Parts List
A laptop or other system on the local Wifi network or on the Internet
The CAN node is wired to its CAN bus using the CAN hat and Wifi is connected.
Two binaries are built: CAN node (~go/bin/can_node) and CAN bridge (~go/bin/can_bridge)