The CAN bus explained: how controllers, BMS systems, and displays communicate with each other
In a modern electric machine, components no longer just exchange power; they exchange information. The controller needs to know the battery status, the display needs the speed and temperature readings, and a second controller needs the setpoint from the first. The most common method for this comes from the automotive industry: the **CAN bus**. This guide explains how it works and how to wire it correctly.
The essentials
- The CAN (Controller Area Network) connects multiple devices using a pair of twisted wires, referred to as CAN high and CAN low.
- You need a 120-ohm resistor at each end of the bus, and only at the ends.
- Each message has an identifier that also serves as a priority: the most important messages are always processed first.
- All devices must use the same communication speed.
A bus, not a connection
A traditional serial connection links two devices. CAN, on the other hand, is a bus: all devices are connected to the same two wires, and each can communicate with all the others. To add a device, you simply connect it to the bus, without having to run a new cable to the controller. This is what made it popular in the automotive industry, where dozens of control units share just a few pairs of wires.
On a lightweight vehicle, you typically find one or more controllers, the battery management system (BMS), a display, a telemetry module, or a charger.
Two wires, one difference
The CAN bus uses a pair of wires, CAN high and CAN low. The information is not transmitted by the voltage of a single wire relative to ground, but by the difference between the two:
- When at rest (in the "recessive" state), both wires have the same voltage, which is approximately half the circuit's power supply voltage
- To transmit a "dominant" bit, the transmitter separates the two wires: the top wire goes high, and the bottom wire goes low.
An electrical disturbance, such as that from a controller delivering hundreds of amps, affects both wires in the same way. However, the difference between them remains unchanged. This is what makes CAN so robust in a noisy electrical environment, provided that the two wires are twisted together.
Termination resistors
A CAN bus must have a 120-ohm resistor between the CAN high and CAN low lines at each of its two physical ends. These resistors prevent signals from reflecting at the end of the cable and bring the bus back to its idle state.
- The bus connection is complete: when measuring between the CAN high and CAN low lines, with the devices turned off, we find approximately 60 ohms (which is twice 120 ohms in parallel).
- Approximately 120 ohms: a termination resistor is missing.
- A value significantly below 60 ohms indicates an excessive number of terminations, often because multiple devices have their terminations enabled.
A missing or incorrect termination is the primary cause of unstable communication.
Identifiers and Priority
Each CAN message carries an identifier, a number that indicates what the message is about (for example, "battery status" or "front motor target"). Devices read all the messages and only retain the ones that are relevant to them.
When two devices start transmitting simultaneously, they compare their identifiers bit by bit, over the same wire. A dominant bit overrides a recessive bit: the device that transmits a recessive bit and reads a dominant bit understands that it has lost and stops transmitting. The smallest identifier always wins, without any data being corrupted. This process is called arbitration: critical messages are assigned the smallest identifiers.
Integrated Reliability
- Each message contains a control code: a corrupted message is detected and retransmitted.
- Each receiver confirms successful reception with an acknowledgment bit.
- A device that accumulates errors will automatically disable itself to prevent it from blocking the entire communication bus.
The bus speed
All devices on a bus must use the same speed. The most common values are 250 and 500 kilobits per second, sometimes 1 megabit. The faster the bus, the shorter its maximum length. However, in a lightweight vehicle, with a maximum length of a few meters, the length is rarely a limiting factor. A more recent version, CAN FD, transmits more data per message at a higher speed.
Example: two controllers connected
On a dual-motor scooter, two controllers connected via CAN behave as a single unit: the controller that receives the throttle signal transmits it to the other, and a single software interface controls both. This is the case with VESC controllers, as explained in our guide "VESC Explained Simply".
Workshop tip
Always twist the CAN high and CAN low wires together, keep them away from the phase wires, and check the 60-ohm resistance with a multimeter before the initial power-up. Five minutes of checking can prevent hours of troubleshooting intermittent communication issues.
Frequently Asked Questions
Does the CAN bus carry current to power devices?
No, the CAN pair only transmits information. The devices have their own power supply, which is sometimes provided by other wires within the same cable.
Why is my CAN communication working intermittently?
The most common causes include a missing or incorrect termination, untwisted wires running close to power cables, a worn-out connector, or two devices with mismatched bus speeds.
Can any CAN-enabled device be connected to each other?
Electrically, yes, if they share the same communication bus speed. However, for them to communicate, they must use the same "language": the same identifiers and the same message content. Two different brands will not understand each other without adaptation.