Getting started with CAN bus

From 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:

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.

Another, and more recent solution is with an ESP32-S3 Dev Module and the common tranceiver.

Following the link https://op, you can connect to SavvyCan.

Attention: 1: When unzipping Wifican, change the "wifican-main" file to "wifican", save this. Replace the original "wifi_credentials_template.h" file with "wifi_credentials.h" as described.

2: When selecting your wifi network, select the 2.4GHZ network along with your wifi network password !

3. Upload the Sketch, Connect the jumper between PIN35 and PIN47. Select baud rate of 115200 in Arduino IDE Serial Monitor, press RST on ESP32 board and confirm wifi connection

Now you can connect the new device to SavvyCan as descrbed in the github description.

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.

Local Interconnect Network

LIN (Local Interconnect Network) is a serial network protocol used for communication between components in vehicles. It is a single wire, serial network protocol that supports communications up to 19.2 Kbit/s at a bus length of 40 meters. The need for a cheap serial network arose as the technologies and the facilities implemented in the car grew, while the CAN bus was too expensive to implement for every component in the car. European car manufacturers started using different serial communication technologies, which led to compatibility problems.

For more info and history on can see: