Introduction to CAN-BUS and How to use it with Arduino

Ever heard of CAN-BUS but don’t exactly know what it does? Fret not! We will be discussing everything about CAN-BUS today. I hope that you’ll get a better understanding of it through this blog:

  • Introduction to CAN-BUS
  • Why use the CAN protocol
  • CAN-BUS vs OBD2
  • Seeed’s CAN-BUS products (Updated)
  • CAN-BUS Projects (Updated)
  • Getting started with CAN-BUS with Arduino

Introduction to CAN-BUS

What is CAN-BUS?

CAN stands for Controller Area Network, it is used to allow microcontrollers and devices to communicate with each other within a vehicle without a host computer which allows for control and data acquisition. These devices are also called Electronic Control Units (ECU) and they enable communication between all parts of a vehicle.

Today, you can find up to 70 ECUs in a modern car. CAN is a serial communication bus designed for industrial and automotive applications. For example, they are found in vehicles, farming equipment, industrial environments, etc.

How does CAN-BUS work?

The fuel level, door sensors, odometer, and many more parts of a car have to communicate with each other somehow, and CAN BUS is what they used to do. These CAN-compatible components, which are called “nodes” are connected with a 3-string copper wire, with no central router to govern the flow of data. Every node can hear the messages of every other node.

Every node has an ID, where the ones with the higher priority ID can have the priority to “talk” first while the others “listen”. This is to ensure that there are never two nodes talking at the same time. The biggest benefit of CAN-BUS is to be able to just connect components without having to worry about signal routing.

Why use the CAN protocol rather than UART, SPI, and I2C?

Compared to other communication protocols like UART, SPI, and I2C, using the CAN protocol is much more reliable as they are standard automotive communication protocols that are used to transmit vital data like a throttle position in a vehicle. If miscommunication or loss of data occurs, it could lead to critical failures.

In a vehicle, safety and reliability are the two most valued features. CAN-BUS is therefore the ideal protocol for vehicular usage.

CAN protocol is widely used thanks to the following advantages:

Low Cost

  • With its multiplex wiring that combines analog and digital signals and their transmission over a shared medium, it reduces the amount of wiring needed.
  • When adding or reducing some equipment, it can be easily operated, and there is no need to carry out a large-scale transformation of the system, which saves a lot of manpower.


  • As CAN-BUS supports centralized control over electronic devices that are connected to the network, it allows for central error diagnosis and configuration across all ECUs
  • Error handling is also built into the CAN protocol where nodes can check for errors in transmission while maintaining their own error counter. For example, the protocol supports different error detection capabilities such as bit error, ack error, form error, CRC error, etc.


  • As each CAN-connected ECU can receive all transmitted messages, it can also decide whether it is relevant and act accordingly.
  • The CAN protocol is also a message-based communication protocol where nodes on the bus have no identifying information.
  • With the above features, nodes can easily be added or removed and modified.
  • For beginners, it will be easy to integrate new electronic devices into the CAN-BUS network without any significant programming overhead.


  • When choosing a communication protocol, durability and reliability are very important. You would want your communication protocol to be self-sustaining and durable for a long period of time without maintenance.
  • With the CAN BUS, the system is robust towards electric disturbances and electromagnetic interference which makes it ideal for vehicles.


  • CAN messages frames are prioritized by ID where the top priority will get bus access and yet frames would not be interrupted.
  • Flash programming, also saves time together with less and simple wiring.

The role of CAN

What will happen if there is no CAN in the car?

Ref: Volkspage

Without the CAN protocol, electronic modules in vehicles will have to communicate with each other using direct, point-to-point analog signal lines. With each module requiring a direct line connected for communication, not only is it time-consuming, it will be messy with all the excessive amount of wiring as seen in the picture above. And there may be unreliable communication between devices. Excessive wires may require additional equipment, which also creates cost issues.

What will happen if there is a CAN in the car?

Ref: Volkspage

With CAN protocol, it eliminates the need for all these wirings by enabling electronic devices to communicate with each other with a single multiplex wire that connects each node in the network to the main dashboard as seen in the picture above.

The multiplex wire and architecture enable signals to be combined and transmitted over the entire network with just a single wire while ensuring each electronic module in vehicles receives data from sensors and actuators. This allows the user to be able to connect any number of ECUs in your vehicle through the two-wire bus.

It also allows for several features to be added via just software. Furthermore, an ECU is able to use data from another ECU which eliminates the need to install the same sensors in multiple devices.

CAN-BUS Wiring Sequence

  • The CAN protocol consists of two wires for bi-directional data transmission as shown above which are
    • CAN_H (CAN High)
    • CAN_L (CAN Low)
  • The wires act as a differential line which means the CAN signal either 0 or 1, can be represented by the potential difference between the two wires
    • For example, if the difference is positive and large then a certain minimum voltage = 1. If the difference is negative = 0
  • For CAN termination, as you can see from the picture above, a single 120 Ohm is generally used at the 2 ends of the CAN network.

CAN Protocol Speed and Range

  • Communication speeds of the CAN protocol range from 10kpbs to 1Mbps.
    • The speed also depends on the length of wire used. The shorter it is, the faster the communication speed, and the longer it is, the slower the communication speed.
    • For example, at 40 meters, the speed will be at 1Mbps. At 1000 meters, the speed can be at 50kpbs.
  • The node distance is generally advised to be no more than 0.3 meters / 1 foot.

CAN Message

  • To fully understand how the CAN protocol works, let us look at the frames sent over the network.
  • The CAN message contains many segments. The 2 main segments, identifier, and data will be the ones transmitting the data.
  • The identifier is used to identify CAN devices in a CAN network while data will be the sensor or control data that have to be sent from one device to another.
  • The identifier or CAN ID is either 11 or 29 bits in length depending on the type of CAN protocol used.
    • Standard CAN = 11 bit
    • Extended CAN = 29 CAN
  • While the data can be anywhere from 0 to 8 bytes.


I am pretty sure you will come across other “higher-layer protocols” that are related to CAN-BUS like OBD2 BUT they are not the same!

  • The CAN standard does not specify how to handle messages larger than 8 bytes or how to decode the raw data. Therefore, a set of standardized protocols are developed to further specify how data is communicated between ECUs of a given network and OBD2 is one of them.
  • OBD which stands for on-board diagnostics is your vehicle’s built-in self-diagnostic system. OBD2 can use one of (many) different bus systems to transfer diagnostic data from and to your car.
  • One simple analogy I would use to differentiate between the two of them will be OBD2 is like a language that we speak where we use CAN as a communication device like a phone to talk to someone which in this case a vehicle and its state of health.
  • To read more about OBD2, you can check out the Wiki Page on OBD.

Explore Seeed’s CAN-BUS products!

Here at Seeed, we offer a variety of CAN-BUS products for your project needs! As shown below:

Updated on 2nd Jun 2022

New Release! LoRa-E5 CAN Development Kit($39.90)

LoRa-E5 CAN Development Kit is based on the LoRa-E5 STM32WLE5JC Module and supports CAN FD, CAN2.0, and RS485 communication. It provides a user-friendly waterproof case and solar charging interface for better outdoor deployment. 

Features of the LoRa-E5 CAN Development kit include:

  • Ultra-low power consumption and high-performance
  • Easy testing and rapid prototyping
  • Global LoRaWAN® and LoRa frequency plan supported
  • Long-distance transmission range to 10km (ideal value in open area)
  • Grove compatible interface for additional functions such as GPS, environmental detection, etc 

LoRa-E5 CAN Development Kit is available to pre-order on 2nd June 2022 with estimated shipping in early July!

If you missed out on the previous updates, please read the full story on how we listen to the community voices and take action on modifying the devices.

CAN-BUS Shield V2 ($24.50)

This CAN-BUS Shield adopts an MCP2515 CAN-BUS controller with SPI interface and MCP2551 CAN transceiver to give your Arduino/Seeeduino CAN-BUS capability. With an OBD-II converter cable added on and the OBD-II library imported, you are ready to build an onboard diagnostic device or data logger.

Features of this CAN-BUS shield include:

  • Implements CAN V2.0B at up to 1 Mb/s  
  • OBD-II and CAN standard pinout selectable.
  • Screw terminal that easily to connect CAN_H and CAN_L
  • SPI Interface up to 10 MHz    

CANBed – Arduino CAN-BUS Development Kit (Atmega32U4 with MCP2515 and MCP2551) ($14.90)

CANBed – Arduino CAN-BUS Development Kit carries an Atmega32U4 chip and MCP2515, MCP2551 CAN-BUS controller, and transceiver to realize the CAN protocol on a single board without other MCU to control, it is a CAN-BUS Development Board itself!

Features of the CANBED include:

  • Atmega32U4 with Arduino Leonardo bootloader on the board
  • MCP2515 CAN Bus controller and MCP2551 CAN Bus transceiver
  • BD-II and CAN standard pinout selectable at the sub-D connector

CANBed FD – Arduino CAN-FD Development Kit ($17.90)

The newest addition to the CAN family, this CAN Bed-FD carries an MCP2517FD CAN-BUS controller with SPI interface and MCP2542FD CAN transceiver to achieve the CAN-BUS capability. There is also an ATmega32U4 with Arduino Leonardo bootloader on the board, which allows for easy programming using Arduino IDE.

Features of the CANBed-FD include:

  • Wide power input range from 7-28V
  • 2 x 4-Pin Grove connectors compatible with the Grove ecosystem
  • OBD-II and CAN standard pinout selectable at the sub-D connector
  • Industrial standard 9 pin sub-D connector or 4-pin terminal
  • Work at CAN-FD and CAN 2.0

Serial CAN-BUS Module based on MCP2551 and MCP2515 ($14.90)

If your project is space limited, here is a Serial CAN-BUS module that has the full features of CAN Bus. The Serial CAN-BUS provides your Arduino or other MCU with the capability of communication to CAN Bus, such as hacking your vehicle. This Grove CAN-BUS module is controlled by UART, which means if your MCU has a UART interface, this serial CAN-BUS is available. 

Features of this Serial CAN-BUS module include:

  • UART to CAN-BUS communication
  • Up to 115200 UART baud rate (default 9600)
  • Up to 1Mb/s CAN-BUS baud rate
  • Easy-to-use Arduino library

OBD-II CAN Bus GPS Development Kit ($29.90)

If you want to record the GPS log at the same time, this OBD-II CAN Bus GPS Development Kit is highly recommended! The board can be plugged directly into the car via the ODB-II interface and supports Arduino programming. The baseboard of the development kit is integrated with an Atmega32U4 microprocessor. The CAN-Bus library is available to write sketches using Arduino IDE to send and receive messages from the CAN bus network and also allows you to fetch user data from the messages.

CAN-BUS Projects

Volkswagen CAN-BUS Gaming

Inspired by Silas Parker

Ever wanted to play a car/truck simulator with a real dashboard on your PC? With the CAN-BUS shield, you can! In this project, I’m trying to control a VW Polo 6R dashboard via CAN Bus with an Arduino Uno and a Seeed CAN Bus Shield.

What you’ll need:

Interested? You can check out the full tutorial at SeeedStudio Community!

Hacking your Vehicle

Modern Vehicles all come equipped with a CAN-BUS Controller Area Network, Instead of having a million wires running back and forth from various devices in your car to the battery, it’s making use of a more clever system. From each node (IE Switch pod that controls your windows or electric door locks) it broadcasts a message across the CAN. When the TIPM detects a valid message it will react accordingly like, locking the doors, switching on lights, and so on. With the CAN-BUS shield, you can now hack your vehicle!

What do you need?

Interested? You can find the full tutorial by mvilijoen2 on Instructables!

Seeed Studio CAN-BUS V2.0 Hacking – Getting Started

This instructable is meant for beginners who already know their way around Arduino. In this instructable, you will learn how to return some CAN-BUS data from your vehicle.

What you’ll need:

Interested? You can find the full tutorial by mvilijoen2 on Instructables!

CAN Bus Sniffing – Hacking With Arduino!

This video is going to connect to the Renault Megane 3 vehicle with the Arduino Uno + SeeedStudio CAN Bus Shield V2 and analyze the data/messages passing through the vehicle’s CAN bus (sniffing). If you use CAN Bus Protocol in your vehicles, you can listen to your vehicle with the same actions.

What you’ll need:

Interested? You can find the full tutorial by Bugra on Youtube!

Vehicle GUI Can Bus Display

This project utilizes Can Bus to read sensor values and communicate over serial to the display featuring customizable GUI.

What you’ll need:

Interested? You can find the full tutorial by Kenliao on Hackster!

Getting started with CAN-BUS with Arduino

Getting Started with CAN-BUS can be very fulfilling. It can be daunting as well, but this guide will provide you with a step-by-step guide to getting started!

What do you need?


Step 1: Hardware Connection

  • Firstly, connect each CAN-BUS shield to Seeeduino V4.2 and connect the 2 CAN-BUS shields together via 2 jumper wires as shown below. (CAN_H to CAN_H and CAN_L to CAN_L)

Step 2: Setting up Software

  • Download the library for CAN-BUS here and install the library to Arduino IDE after the download has been completed.
  • If you do not know how to install an Arduino library, you can follow the instructions here.
  • One of the nodes (a node means Seeeduino + CAN_BUS Shield) acts as a master and the other acts as a slaver. The master will send data to the slaver constantly.
  • Open the sent example (File > Examples > CAN_BUS_Shield-master >send) and upload it to the master as shown below:
  • After that, Open the receive_check example (File > Examples > CAN_BUS_Shield-master > receive_check) and upload it to the slaver as shown below

Step 3: View Results

  • Open the Serial Monitor of Arduino IDE (slaver), you will get the data sent from the master. Below is a photo of what it will look like:

Step 4: APIs (Application Program Interface)

For the APIs of this software, you can:

Set the Baud Rate
  • This function is used to initialize the baud rate of the CAN Bus system. The available baud rates are listed as follows:
#define CAN_5KBPS    1
#define CAN_10KBPS   2
#define CAN_20KBPS   3
#define CAN_25KBPS   4
#define CAN_31K25BPS 5
#define CAN_33KBPS   6
#define CAN_40KBPS   7
#define CAN_50KBPS   8
#define CAN_80KBPS   9
#define CAN_83K3BPS  10
#define CAN_95KBPS   11
#define CAN_100KBPS  12
#define CAN_125KBPS  13
#define CAN_200KBPS  14
#define CAN_250KBPS  15
#define CAN_500KBPS  16
#define CAN_666kbps  17
#define CAN_1000KBPS 18
Set Receive Mask and Filter
  • There are 2 receive mask registers and 5 filter registers on the controller chip that guarantees you get data from the target device. They are useful especially in a large network consisting of numerous nodes.
  • We provide two functions for you to utilize these mask and filter registers. They are:


init_Mask(unsigned char num, unsigned char ext, unsigned char ulData);


init_Filt(unsigned char num, unsigned char ext, unsigned char ulData);
  • num represents which register to use. You can fill 0 or 1 for the mask and 0 to 5 for the filter.
  • ext represents the status of the frame. 0 means it’s a mask or filter for a standard frame. 1 means it’s for an extended frame.
  • ulData represents the content of the mask of the filter.
Check Receive
  • The MCP2515 can operate in either a polled mode, where the software checks for a received frame, or uses additional pins to signal that a frame has been received or transmit completed.
  • Use the following function to poll for received frames:
INT8U MCP_CAN::checkReceive(void);

The function will return 1 if a frame arrives, and 0 if nothing arrives.

  • When some data arrive, you can use the following function to get the CAN ID of the “send” node.
INT32U MCP_CAN::getCanId(void)
Send Data
CAN.sendMsgBuf(INT8U id, INT8U ext, INT8U len, data_buf);

It is a function to send data onto the bus. In which:

  • id represents where the data comes from.
  • ext represents the status of the frame. ‘0’ means standard frame. ‘1’ means an extended frame.
  • len represents the length of this frame.
  • data_buf is the content of this message.

For example, In the ‘send’ example, we have:

unsigned char stmp[8] = {0, 1, 2, 3, 4, 5, 6, 7};
CAN.sendMsgBuf(0x00, 0, 8, stmp); //send out the message 'stmp' to the bus and tell other devices this is a standard frame from 0x00.
Receive Data
  • The following function is used to receive data on the ‘receive’ node:
CAN.readMsgBuf(unsigned char len, unsigned char buf);

In conditions where masks and filters have been set. This function can only get frames that meet the requirements of masks and filters.

  • len represents the data length.
  • buf is where you store the data.
Generate a New BaudRate

We had provided many frequently-used baud rates, as shown below:

#define CAN_5KBPS    1
#define CAN_10KBPS   2
#define CAN_20KBPS   3
#define CAN_25KBPS   4
#define CAN_31KBPS   5
#define CAN_33KBPS   6
#define CAN_40KBPS   7
#define CAN_50KBPS   8
#define CAN_80KBPS   9
#define CAN_83KBPS   10
#define CAN_95KBPS   11
#define CAN_100KBPS  12
#define CAN_125KBPS  13
#define CAN_200KBPS  14
#define CAN_250KBPS  15
#define CAN_500KBPS  16
#define CAN_666KBPS  17
#define CAN_1000KBPS 18

Yet you may still find the rate you want. Here we provide software to help you to calculate the baud rate you need.

Click here to download the software, it’s in Chinese, but it’s easy to use. Here is the interface translated for easier usage:

  • Open the software, what you need to do is to set the baud rate you want, then do some simple settings, then click calculate.
  • Then you will get some data, cfg1, cfg2, and cfg3.
  • You need to add some code to the library.
  • Open mcp_can_dfs.h, you need to add the below code at about line 272
#define MCP_16MHz_xxxkBPS_CFG1 (cfg1)    // xxx is the baud rate you need
#define MCP_16MHz_xxxkBPS_CFG2 (cfg2)
#define MCP_16MHz_xxxkBPS_CFG3 (cfg2)
  • Then let’s go to about line 390, add the below code:
#define CAN_xxxKBPS NUM       // xxx is the baudrate you need, and NUM is a number, you need to get a different from the other rates.
  • Open mcp_can.cpp, goto the function mcp2515_configRate(at about line 190), then add below code:
case (CAN_xxxKBPS):
    cfg1 = MCP_16MHz_xxxkBPS_CFG1;
    cfg2 = MCP_16MHz_xxxkBPS_CFG2;
    cfg3 = MCP_16MHz_xxxkBPS_CFG3;

That’s all! Now, you can use the baud rate you need!

Now that you’ve learned how to interface CAN-BUS with the Arduino using the CAN-BUS shield, here are some CAN-BUS projects to get you started!


With the basic knowledge of CAN protocol in your hands, one way that you can use it is to analyze the data/messages passing through your vehicle and also hack your vehicle!

I hope you learn more about the CAN protocol in this guide! If you have any questions regarding CAN BUS, feel free to drop a comment in the comment section down below.

Interested in more CAN-BUS products? You can check out all of our CAN-BUS products here!


November 2019