Skip to main content
emobility.academy
Student hacksModerateLow risk 1 weekendFor students

Learn CAN Bus Hands-On with Two Low-Cost Boards

Set up two low-cost microcontroller boards with CAN transceivers on a bench, send messages between them and decode them with simple software. You learn CAN frames, IDs, bit rates and termination hands-on, without touching a vehicle.

Go to the steps
Learn CAN Bus Hands-On with Two Low-Cost Boards: Students working in the DIYguru computer lab
Representative photo from DIYguru's EV lab.

Why this happens

CAN is the network most EV controllers, BMS units and dashboards use to share data. Reading about frames and arbitration only goes so far; building a two-node bus shows why termination, bit timing and message IDs matter, and a bench setup lets you make mistakes safely.

What you need

Tools

  • Two microcontroller development boards with a CAN controller (or with an external CAN controller module)
  • Two CAN transceiver modules
  • USB cables and a laptop
  • Digital multimeter
  • Optional: USB-to-CAN adapter or logic analyser

Materials

  • Twisted-pair hookup wire
  • Two 120 ohm resistors (if the modules lack termination)
  • Breadboard or screw terminals
  • Jumper wires

Before you start

  • Keep this a bench network powered from USB; do not connect your boards to a vehicle's CAN or OBD port to send messages, as injected frames can disturb braking, throttle or battery control.
  • If you later read data from a vehicle, use only read-only standard OBD-II tools on a parked vehicle, and never on the high-voltage system of an electric car.
  • Disconnect USB before rewiring the bus.

Step by step

  1. 1

    Plan the bench bus

    Draw the setup first: board A, transceiver A, a short twisted pair for CAN-H and CAN-L, transceiver B, board B, and a common ground. Power both boards from the laptop's USB ports only. This is a stand-alone bench network; it will never be connected to a vehicle, so you can experiment freely without risk to brakes, throttle or battery systems.

  2. 2

    Wire the transceivers

    Connect each board's CAN transmit and receive pins to its transceiver, and power the transceiver at the voltage its datasheet specifies. Join CAN-H to CAN-H and CAN-L to CAN-L with twisted wire, and connect the grounds. Check every connection against your drawing before plugging in USB.

  3. 3

    Check termination with a multimeter

    A CAN bus needs a 120 ohm resistor at each end. With everything unpowered, measure resistance between CAN-H and CAN-L: about 60 ohms means both terminators are present; about 120 ohms means only one; very high resistance means none. Add or enable resistors on the modules until you read roughly 60 ohms.

    Tip: Many transceiver modules have a jumper for the onboard 120 ohm resistor.

  4. 4

    Load a sender and a receiver program

    Using a CAN library for your boards, set both to the same bit rate, such as 500 kbit/s. Program board A to send a frame every second with a chosen ID and a few data bytes, such as a counter and a fake temperature value. Program board B to receive every frame and print the ID and data to the serial monitor.

  5. 5

    Watch frames and change things

    Open board B's serial monitor and confirm frames arrive. Change the counter, the ID and the data length and watch the output. Then change only one board's bit rate and see communication fail; set it back and see it recover. This shows why every node on a bus must agree on timing.

  6. 6

    Explore IDs, priority and filters

    Make board A send two messages with different IDs at a fast rate. Note that lower IDs win arbitration and have higher priority. Configure acceptance filters on board B so it ignores one ID, and confirm only the other appears. Real EV networks use filters so each controller handles only the messages it needs.

  7. 7

    Decode signals like a real database

    Write a small table describing your messages: ID, byte positions, scaling and units, for example 'bytes 0 to 1 = temperature, 0.1 degree per bit'. Decode the received bytes on board B or in a laptop script using this table. This mirrors how CAN database files describe real vehicle signals.

  8. 8

    Add a USB-to-CAN adapter or logic analyser

    If you have one, connect a USB-to-CAN adapter or logic analyser to the bench bus and capture traffic on the laptop. Look at frame timing, error frames when you unplug a node and bus load as you increase message rates. Save captures and notes for your portfolio.

How to tell it worked

Board B prints every frame board A sends with the correct ID and decoded values, the bus reads about 60 ohms between CAN-H and CAN-L when unpowered, and you can explain why mismatched bit rates and missing termination break communication.

Stop and call a technician if

  • A guide or forum suggests transmitting frames on a scooter or car network to change its behaviour; do not do it.
  • A board or transceiver gets hot or smells while powered; unplug USB and recheck the wiring and supply voltage.

Questions

Can I use these boards later to read my scooter's data?

Most scooters do not expose CAN for owners, and connecting to their wiring may void the warranty. Use the manufacturer's app or a parked car's standard OBD-II port in read-only mode instead.

Why do I need two boards instead of one?

A CAN node needs another node to acknowledge its frames. With only one node on the bus, frames are not acknowledged and the controller reports errors.

Related EV hacks

All 100 EV hacks