Understanding the CAN Bus: A Beginner’s Tutorial

The Controller Area Network (CAN) bus is a robust communication protocol designed for vehicles and industrial applications. Developed in the 1980s by Bosch, it facilitates real-time data exchange between different microcontrollers without requiring a host computer. This tutorial introduces the basics of the CAN bus, its functionality, and how to work with it.

What is the CAN Bus?

The CAN bus is a multi-master, message-oriented protocol. It is widely used in automotive and industrial environments because of its reliability, flexibility, and efficient data transfer capabilities. It enables devices like electronic control units (ECUs) in cars to communicate without needing a central computer.

 

Key Features:

  • Error detection: Built-in error checking ensures data integrity.
  • Multi-master capability: Any device on the network can send messages.
  • Priority-based arbitration: Messages with higher priority get access to the bus first.
  • Two-wire differential signaling: Provides robustness against electrical noise.

How Does the CAN Bus Work?

  1. Message-Oriented Communication:
    • Devices (nodes) on the CAN bus send and receive messages, not addressed to specific recipients but broadcast to all.
    • Each message contains an identifier that indicates its priority and type.
  2. Two-Wire System:
    • The bus consists of two lines: CAN_H (high) and CAN_L (low).
    • The voltage difference between these lines carries the data, ensuring reliable communication even in noisy environments.
  3. Arbitration:
    • If two nodes attempt to transmit simultaneously, the message with the higher priority identifier continues while others back off.

Structure of a CAN Frame

A CAN frame is a unit of data transmitted on the CAN bus. The standard CAN frame contains the following fields:

  1. Start of Frame (SOF): Indicates the beginning of a frame.
  2. Identifier: Determines the priority of the message.
  3. Control Field: Specifies the type and length of the data.
  4. Data Field: Contains up to 8 bytes of data.
  5. Cyclic Redundancy Check (CRC): Ensures data integrity.
  6. ACK Field: Indicates successful reception of the frame.
  7. End of Frame (EOF): Marks the end of the frame.

Setting Up a CAN Bus System

To start working with a CAN bus system, you’ll need the following:

Hardware:

  • CAN Transceiver: Converts digital signals from a microcontroller to CAN-compatible signals.
  • Microcontroller with CAN Controller: Interfaces with the CAN transceiver.
  • CAN Bus Cables: Twisted-pair cables for CAN_H and CAN_L.
  • 120-Ohm Termination Resistors: Placed at both ends of the bus to prevent signal reflections.

Software:

  • CAN device decode information.
  • Tools for debugging and monitoring (e.g., PCAN, CANalyzer).

Steps to Implement:

  1. Connect Nodes: Wire the devices to the CAN bus using twisted-pair cables.
  2. Setup Transceivers: Attach CAN transceivers to the microcontrollers.
  3. Configure Software:
    • Set the baud rate (e.g., 1 Mbps, 500 kbps).
    • Define message IDs and data payloads.
  4. Add Termination Resistors: Connect 120-ohm resistors at both ends of the bus.
  5. Test Communication: Use debugging tools to monitor and verify message exchanges.

 

What it’s good for:
-Short messages for sensor values or actuator commands
-Noisy environments (cars, trucks, factories, etc)
-Wire reduction (many messages on 2 wires)

 

What it’s not good for:
-Pictures, Videos, large files and datasets

 

Most common CAN Bus mistakes:
-Modules not set to the same bus speed  (ex 1Mbit/s)
-Termination resistors incorrect (NEED (2) and ONLY (2) 120ohm)
-Termination resistors not at ends of longest wire run (trunk)
-Drop wires longer than permitted

 

Hookup:
-Power
-Ground
-CAN High
-CAN Low

 

Speed vs Allowable Length:
High-speed (1 Mbits/s) data transmission over short distances of 40m
Low-speed (5 kbits/s) transmissions at lengths of up to 10,000 m

 

Checking Line Resistance (Between CAN High and CAN Low) should read 60 ohms.

 

 

Products:

Check out the many Techmor products with CAN Bus capabilities, including LINC connectivity to Smartphones and Tablets.

 

AC-1-x Analog to CAN Modules

SG-1-C Strain Gage Amplifier to CAN

LINC Smartphone and Tablet Bridge

 

Sources:

Techmor Inc.

11148 Treynorth Drive

Suite A

Cornelius, NC 28031

info@techmor.com

(704) 769-0001

Maximize Your Metrics with Techmor's Measurement Toolsre

Contact Us

Copyright 2026  Techmor Inc.