Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

A Controller Area Network, or CAN bus, is a communication system that lets many electronic modules share data over the same two wires. It is widely used in cars, mobile robots, industrial machines, and competition robots because it is reliable, compact, and resistant to electrical noise. Instead of running a separate signal wire for every sensor and actuator, designers connect many nodes to one shared backbone.

This reduces wiring weight and makes large robotic systems easier to build and diagnose.

CAN uses a twisted differential pair called CAN_H and CAN_L, where information is carried by the voltage difference between the two wires rather than by one wire measured alone. Every node can listen to every message, and message identifiers decide both the meaning of the data and which message wins if two nodes transmit at the same time. This priority process is called arbitration, and it allows important messages such as motor safety commands to get through first without destroying lower priority messages.

Termination resistors at the ends of the bus help prevent signal reflections, which is critical for clean communication at high speed.

Understanding Robotics: CAN Bus

A CAN message is sent as a frame. The frame contains an identifier, a small amount of data, error checking information, and an acknowledgement field. The identifier describes what the data means, such as wheel speed, battery current, arm position, or a command to a motor controller.

It does not name one receiving device. Each node is configured to accept the identifiers it needs and ignore the rest.

This publisher style is useful in robots because one sensor reading can be used by several controllers at once. A gyro can publish angular rate while the drive controller, balancing controller, and data logger each use that same message.

Arbitration works at the level of individual bits. When several nodes begin transmitting together, every transmitter watches the bus while it sends. A node that sends a recessive bit but sees a dominant bit knows that a higher priority frame is present.

It immediately stops and waits. The winning frame continues without being corrupted, while the other nodes retry later. This is different from a network where two simultaneous transmissions create a damaged packet that must be discarded.

Priority therefore needs careful planning. Safety-related commands should receive high priority, but giving every message high priority defeats the purpose.

Fast control data needs frequent updates. Temperature or diagnostic data can usually wait longer.

Reliability comes from more than the cable itself. CAN hardware checks each frame using several methods, including a cyclic redundancy check, bit monitoring, format checks, and acknowledgement. A receiver that detects a bad frame sends an error signal.

The frame is then retransmitted automatically. Nodes count their own transmission and reception errors. A node with too many errors can remove itself from normal traffic, a state called bus off.

This prevents one damaged device from continuously blocking communication for the rest of the robot. Good robot software should detect missing messages and bus-off events. It should move motors to a safe state when important feedback stops arriving.

Physical layout causes many real CAN problems. The main cable should form one continuous backbone, with short branches leading to devices. Long branches act like extra transmission lines and can distort fast signals.

Connectors must be secure, twisted pairs should stay together, and the network must share a sensible electrical reference where the hardware requires one. A multimeter check across the disconnected bus can reveal whether the expected total termination resistance is present.

An oscilloscope can show reflections, noise, or rounded edges that a multimeter cannot reveal. Students should learn to separate wiring faults from software faults by checking power, connector pinouts, resistance, message traffic, and error counters in a steady order.

Bus speed sets a tradeoff between distance and timing margin. Faster traffic allows more messages each second, but it makes cable length, branch length, and clock accuracy more critical. Every node must use compatible timing settings or it will interpret bits at the wrong instant.

Standard CAN frames carry limited data, so designers often send compact numbers rather than long text. For example, a controller may send an integer representing a measured speed in thousandths of a unit. The receiving program must know the scale, units, update rate, valid range, and timeout.

Clear message definitions matter as much as correct wiring. A network can electrically work perfectly while the robot behaves incorrectly because two modules disagree about what a number represents.

Key Facts

  • CAN uses two signal wires: CAN_H and CAN_L.
  • Differential voltage is measured as Vdiff = V(CAN_H) - V(CAN_L).
  • A typical high speed CAN bus uses 120 ohm termination at each physical end of the backbone.
  • The equivalent resistance of two 120 ohm terminators in parallel is R = 60 ohm.
  • Message arbitration is based on the identifier, where a lower numeric ID usually has higher priority.
  • Bit time is related to bit rate by Tbit = 1 / bitrate.

Vocabulary

CAN bus
A shared communication network that lets multiple electronic control units exchange short messages over the same two-wire link.
Differential pair
A pair of wires that carries a signal using the voltage difference between them, which helps reject electrical noise.
Node
Any device connected to the CAN bus, such as a motor controller, sensor module, battery controller, or main robot computer.
Arbitration
The process that decides which CAN message continues transmitting when multiple nodes start sending at the same time.
Termination resistor
A resistor placed at each end of the CAN backbone to match the cable impedance and reduce signal reflections.

Common Mistakes to Avoid

  • Putting termination resistors on every node is wrong because only the two physical ends of the backbone should normally be terminated. Extra terminators lower the bus resistance and can weaken the signal.
  • Treating CAN_H and CAN_L as independent data lines is wrong because CAN uses the voltage difference between the pair. Measuring only one wire can give a misleading picture of the actual signal.
  • Making long unterminated stubs to each device is wrong because stubs can create reflections and timing errors. Keep branches short and place nodes close to the main backbone when possible.
  • Assuming messages are addressed to one device like a normal serial link is wrong because CAN messages are broadcast with identifiers. Nodes decide which messages to accept by filtering IDs.

Practice Questions

  1. 1 A CAN bus has two 120 ohm termination resistors, one at each end of the backbone. What equivalent resistance should you measure between CAN_H and CAN_L when the system is powered off?
  2. 2 A robot CAN network runs at 500,000 bits per second. What is the time for one bit in microseconds?
  3. 3 Two motor controllers try to transmit at the same time with message IDs 0x120 and 0x080. Which message wins arbitration, and why is this useful for safety-critical robot communication?