Implemented a real-time CAN Bus communication system using two Arduino nodes with MCP2515 CAN controllers and TJA1050 transceivers β transmitting live temperature, humidity, and potentiometer data over the CAN Bus with full performance metrics analysis.
CAN (Controller Area Network) Bus is a robust, differential two-wire communication protocol originally designed by Robert Bosch for automotive applications. This project demonstrates a working hardware implementation of CAN Bus between two Arduino nodes, with one acting as transmitter (reading sensors) and the other as receiver (displaying data on LCD).
Performance metrics including Throughput, Goodput, Latency, and Bus Utilization were measured in real-time on the receiver node.
| Component | Role |
|---|---|
| Arduino Uno (Γ2) | Main microcontroller for each node |
| MCP2515 | External SPI-based CAN controller |
| TJA1050 | CAN Bus transceiver (drives CAN_H / CAN_L) |
| DHT22 Sensor | Temperature & Humidity measurement |
| Potentiometer | Analog value simulation |
| 16Γ2 LCD | Data display on receiver side |
| 120Ξ© Resistors (Γ2) | Bus termination resistors |
| Connecting Wires | CAN Bus line + SPI connections |
βββββββββββββββββββββββββββββββββββ CAN_H ββββββββββββββββββββ
β TRANSMITTER NODE β β
β ββββββββββββ ββββββββββββ β ββββββββββββββββββββββββββββ
β β Arduino ββββΆβ MCP2515 ββββΆβββββββ TJA1050 ββ
β β βSPIβ CAN Ctrl β β β CAN Transceiver ββ
β ββββββββββββ ββββββββββββ β ββββββββββββββββββββββββββββ
β β² β β
β [DHT22] [Potentiometer] β CAN_L ββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββ
β RECEIVER NODE β
β ββββββββββββ ββββββββββββ β
β β Arduino βββββ MCP2515 βββββββ CAN Bus
β β βSPIβ CAN Ctrl β β
β ββββββββββββ ββββββββββββ β
β β β
β [LCD Display] β
βββββββββββββββββββββββββββββββββββ
Bus Termination: 120Ξ© resistors at both ends of CAN_H line.
βββββββ¬βββββββββββββββ¬ββββββββββββββββ¬βββββββββββββ¬ββββββββββββ¬βββββββββββ¬ββββββ
β SOF β Identifier β Control Field β Data Field β CRC Field β ACK Fieldβ EOF β
β 1b β 11 bits β DLC (4 bits) β 0β8 bytes β 15 bits β 2 bits β 7b β
βββββββ΄βββββββββββββββ΄ββββββββββββββββ΄βββββββββββββ΄ββββββββββββ΄βββββββββββ΄ββββββ
CAN IDs used in this project:
0xAAβ Potentiometer value (1 byte)0xBBβ Temperature + Humidity + Timestamp (6 bytes)
| MCP2515 Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| SCK | Pin 13 (SCK) |
| MOSI | Pin 11 (MOSI) |
| MISO | Pin 12 (MISO) |
| CS | Pin 10 |
| INT | Pin 2 |
| DHT22 Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| DATA | Pin A1 |
MCP2515 (TX) CAN_H ββββββββββββββββ MCP2515 (RX) CAN_H
CAN_L ββββββββββββββββ CAN_L
#include <SPI.h>
#include <mcp2515.h> // Seeed-Studio/CAN_BUS_Shield or autowp/mcp2515
#include <DHT.h> // adafruit/DHT-sensor-libraryCAN Bus Config:
#define CAN_SPEED CAN_500KBPS
#define MCP_CRYSTAL MCP_8MHZcan-bus-arduino-mcp2515/
β
βββ README.md
βββ transmitter/
β βββ transmitter.ino β Sender: reads DHT22 + Pot β sends CAN frames
βββ receiver/
β βββ receiver.ino β Receiver: reads CAN frames β LCD + Serial metrics
βββ docs/
β βββ circuit_diagram.png β Full wiring diagram
β βββ serial_output.png β Serial monitor showing live metrics
β βββ lcd_output.jpg β LCD displaying received sensor data
βββ presentation/
βββ CAN_Bus_Slides.pdf β Project presentation
From live hardware testing at 500 kbps:
| Metric | Value |
|---|---|
| Frames/sec | 23 |
| Throughput | 2.10 kbps |
| Goodput | 0.66 kbps |
| Bus Utilization | 0.42% |
| TX Time (avg) | 182.17 Β΅s |
| TX Time (min/max) | 130 / 230 Β΅s |
| Latency (avg) | 308,628 ms* |
| Power | 0.0512 W |
*High latency value is due to cumulative delay measurement from program start, not per-frame latency. Per-frame TX time is ~182 Β΅s.
-
Install libraries via Arduino IDE β Library Manager:
mcp2515by autowpDHT sensor libraryby Adafruit
-
Upload
transmitter/transmitter.inoto Arduino 1 (sender) -
Upload
receiver/receiver.inoto Arduino 2 (receiver) -
Wire both MCP2515 modules together:
- Connect CAN_H to CAN_H
- Connect CAN_L to CAN_L
- Add 120Ξ© termination resistors at both ends
-
Open Serial Monitor at
115200 baudon receiver to see live metrics -
LCD will show:
Pot=XX | T=XXC | H=XX%
- SPI communication between Arduino and MCP2515
- CAN frame construction (ID, DLC, data bytes, CRC)
- Differential signaling for noise immunity
- Multi-node bus architecture with collision-free arbitration
- Real-time performance metric calculation (throughput, goodput, bus utilization)
- Efficiency vs Payload Size analysis (1β8 bytes)
- Bitrate scaling study: 500 kbps β 1 Mbps
- Add error handling for CRC failures and ACK retries
- Extend to 3+ node network
Divyanshu Kumar
B.Tech ECE, University of Delhi (2023β2027)
LinkedIn | GitHub
MIT License β feel free to use for educational purposes.