Getting started with CAN bus

From openinverter.org wiki
Jump to navigation Jump to search

A Controller Area Network (CAN bus) is a robust vehicle bus standard designed to allow microcontrollers and devices to communicate with each other's applications without a host computer. It is a message-based protocol, designed originally for multiplex electrical wiring within automobiles to save on copper, but it can also be used in many other contexts. For each device, the data in a frame is transmitted sequentially but in such a way that if more than one device transmits at the same time, the highest priority device can continue while the others back off. Frames are received by all devices, including by the transmitting device.

for more info and history on can see https://en.wikipedia.org/wiki/CAN_bus


This page will help get you started with CAN bus.

Some people will tell you CAN is hard or complicated. They're wrong. The hardware you need isn't expensive and you don't need to be a programming whiz. Even Damien can do it.

There are a few routes you can take, depending on what you want to do:

I want to receive or send simple CAN bus messages...

If you already know which CAN bus messages you want to send or receive, one of the cheapest ways to do this is with an Arduino Uno and a suitable CAN bus shield.

I want to analyse CAN bus traffic and possibly do some serious hacking...

If you want to analyse CAN bus messages on an existing vehicle, you'll need the help of some software. You can use the free SavvyCAN software together with a suitably configured Arduino Due or Teensy. Alternatively, you can buy a pre-configured Due-based kit from EVTV.


I want to build a CAN bus device...

Once you've got your CAN messages sorted, you can build a dedicated device to send or receive those messages. For example, you could build a custom battery gauge. Or add a touch screen controller. Anything is possible! If you want, you can just use the Arduino hardware described above. Alternatively, something small and reasonably robust like a Teensy 3.x might be a better choice for a permanent solution.

Here's a quick-start guide to getting CAN working on a Teensy 3.6.

Here's a simple CAN bus State of Charge meter using a Teensy 4.0.