

The CAN Bus Shield Agrovant, manufactured by SEEED, is a robust communication interface designed to enable microcontrollers to connect to a Controller Area Network (CAN) bus. This shield facilitates reliable and efficient data exchange, making it ideal for agricultural applications such as precision farming, machinery monitoring, and sensor data collection. Its compatibility with Arduino boards and ease of integration make it a popular choice for developers and engineers working on CAN-based systems.








The CAN Bus Shield Agrovant is built on the MCP2515 CAN controller and the MCP2551 CAN transceiver, ensuring reliable communication over the CAN bus. Below are the key technical details:
The CAN Bus Shield Agrovant connects to an Arduino board via its headers. Below is the pin configuration:
| Pin | Function | Description |
|---|---|---|
| D10 | SPI Chip Select (CS) | Selects the MCP2515 CAN controller for SPI communication. |
| D11 | SPI MOSI | Master Out Slave In - Data sent from Arduino to the MCP2515. |
| D12 | SPI MISO | Master In Slave Out - Data received from the MCP2515 to Arduino. |
| D13 | SPI Clock (SCK) | Clock signal for SPI communication. |
| INT | Interrupt | Indicates when the MCP2515 has data to be processed. |
| GND | Ground | Common ground connection. |
| 5V | Power Supply | Supplies 5V power to the shield. |
Hardware Setup:
Software Setup:
Basic Circuit Example:
Below is an example code snippet to send and receive CAN messages using the CAN Bus Shield Agrovant:
#include <SPI.h>
#include "mcp_can.h"
// Define the SPI Chip Select pin for the MCP2515
#define CAN_CS_PIN 10
// Initialize the CAN object
MCP_CAN CAN(CAN_CS_PIN);
void setup() {
Serial.begin(115200); // Initialize serial communication for debugging
while (!Serial);
// Initialize the CAN bus at 500 kbps
if (CAN.begin(MCP_ANY, CAN_500KBPS, MCP_8MHZ) == CAN_OK) {
Serial.println("CAN Bus initialized successfully!");
} else {
Serial.println("Error initializing CAN Bus.");
while (1);
}
// Set the CAN bus to normal mode
CAN.setMode(MCP_NORMAL);
Serial.println("CAN Bus set to normal mode.");
}
void loop() {
// Example: Send a CAN message
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.");
}
// Example: Receive a CAN message
if (CAN.checkReceive() == CAN_MSGAVAIL) {
long unsigned int rxId;
unsigned char len;
unsigned char rxBuf[8];
CAN.readMsgBuf(&rxId, &len, rxBuf);
Serial.print("Received message with ID: 0x");
Serial.println(rxId, HEX);
Serial.print("Data: ");
for (int i = 0; i < len; i++) {
Serial.print(rxBuf[i], HEX);
Serial.print(" ");
}
Serial.println();
}
delay(1000); // Wait 1 second before sending the next message
}
CAN Bus Initialization Fails:
No Data Received:
Intermittent Communication:
Error Sending Messages:
Q: Can I use this shield with boards other than Arduino Uno?
Q: What is the maximum cable length for the CAN bus?
Q: How do I connect multiple devices to the CAN bus?
This documentation provides a comprehensive guide to using the CAN Bus Shield Agrovant effectively in your projects. For further assistance, refer to the SEEED official documentation or community forums.