

The Arduino CAN-Bus Shield (Manufacturer Part ID: DEV-10039) by SparkFun Electronics is a versatile shield designed to enable Arduino boards to communicate using the Controller Area Network (CAN) protocol. CAN is a robust communication standard widely used in automotive, industrial, and embedded systems for reliable data exchange between microcontrollers and devices.
This shield is ideal for applications such as:
The shield is built around the MCP2515 CAN controller and MCP2551 CAN transceiver, providing a complete solution for CAN communication.








| Parameter | Specification |
|---|---|
| CAN Controller | MCP2515 (SPI interface) |
| CAN Transceiver | MCP2551 |
| Operating Voltage | 5V (powered by the Arduino board) |
| Communication Protocol | CAN 2.0B (supports standard and extended data frames) |
| Baud Rate | Configurable up to 1 Mbps |
| SPI Interface | Uses Arduino pins D10 (CS), D11 (MOSI), D12 (MISO), and D13 (SCK) |
| Additional Features | MicroSD card slot, serial LCD connector, and reset button |
| Dimensions | Compatible with standard Arduino form factor |
| Pin | Function |
|---|---|
| D10 (CS) | Chip Select for SPI communication with the MCP2515 CAN controller |
| D11 (MOSI) | Master Out Slave In - SPI data line for sending data to the MCP2515 |
| D12 (MISO) | Master In Slave Out - SPI data line for receiving data from the MCP2515 |
| D13 (SCK) | Serial Clock for SPI communication |
| CANH | High line of the CAN bus for differential signaling |
| CANL | Low line of the CAN bus for differential signaling |
| GND | Ground connection |
| VCC | 5V power supply (provided by the Arduino board) |
#include <mcp_can.h>
#include <SPI.h>
// Define the SPI Chip Select pin for the CAN controller
#define CAN_CS 10
// Create an instance of the MCP_CAN class
MCP_CAN CAN(CAN_CS);
void setup() {
Serial.begin(115200); // Initialize serial communication for debugging
while (!Serial);
// Initialize the CAN controller at 500 kbps
if (CAN.begin(MCP_ANY, 500000, MCP_8MHZ) == CAN_OK) {
Serial.println("CAN-Bus Shield initialized successfully!");
} else {
Serial.println("Error initializing CAN-Bus Shield. Check connections.");
while (1);
}
// Set the CAN controller to normal mode
CAN.setMode(MCP_NORMAL);
Serial.println("CAN-Bus Shield is now in normal mode.");
}
void loop() {
// Example: Send a CAN message with ID 0x100 and 8 bytes of data
byte data[8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
if (CAN.sendMsgBuf(0x100, 0, 8, data) == CAN_OK) {
Serial.println("Message sent successfully!");
} else {
Serial.println("Error sending message.");
}
delay(1000); // Wait 1 second before sending the next message
}
CAN-Bus Shield Not Initializing:
No Communication on the CAN Bus:
Error Sending or Receiving Messages:
Q: Can I use this shield with Arduino boards other than the UNO?
A: Yes, the shield is compatible with most Arduino boards that use the standard form factor, such as the Arduino Mega and Leonardo. However, ensure the SPI pins are correctly mapped.
Q: What is the maximum cable length for the CAN bus?
A: The maximum length depends on the baud rate. For example, at 500 kbps, the maximum recommended length is approximately 100 meters.
Q: Can I use this shield for OBD-II diagnostics?
A: Yes, the shield can be used for OBD-II applications, but you may need additional software or libraries to interpret OBD-II data.
This documentation provides a comprehensive guide to using the SparkFun Arduino CAN-Bus Shield (DEV-10039). By following the instructions and best practices outlined above, you can successfully integrate CAN communication into your projects.