The CANhat by Fusion Tech (Part ID: Dual CAN-Bus adapter for Teensy 4.0) is a versatile CAN (Controller Area Network) interface board designed for use with Raspberry Pi. It enables seamless communication with CAN bus systems, which are widely used in automotive, industrial, and embedded applications. The CANhat simplifies the process of integrating Raspberry Pi into CAN-based networks, making it an ideal choice for prototyping, diagnostics, and real-world deployments.
The CANhat is designed to provide robust and reliable communication with CAN bus systems. Below are its key technical details:
Parameter | Value |
---|---|
Manufacturer | Fusion Tech |
Part ID | Dual CAN-Bus adapter for Teensy 4.0 |
Communication Protocol | CAN (Controller Area Network) |
Operating Voltage | 3.3V / 5V (via Raspberry Pi GPIO) |
CAN Transceivers | Dual MCP2551 transceivers |
Supported CAN Speeds | Up to 1 Mbps |
Dimensions | 65mm x 56mm x 15mm |
Operating Temperature | -40°C to 85°C |
The CANhat connects to the Raspberry Pi via the GPIO header. Below is the pinout for the CANhat:
Pin Number | Pin Name | Description |
---|---|---|
2 | 5V | Power supply for the CANhat |
6 | GND | Ground connection |
8 | TXD | UART transmit pin for CAN communication |
10 | RXD | UART receive pin for CAN communication |
12 | INT | Interrupt pin for CAN controller |
16 | CS | Chip Select for SPI communication |
19 | MOSI | SPI Master Out Slave In |
21 | MISO | SPI Master In Slave Out |
23 | SCK | SPI Clock |
The CANhat is designed to be plug-and-play with Raspberry Pi. Follow the steps below to use the CANhat in your project:
Install Required Libraries: The CANhat uses the MCP2515 CAN controller. Install the necessary libraries and drivers:
sudo apt-get update
sudo apt-get install can-utils
Enable SPI on Raspberry Pi: Use raspi-config
to enable SPI:
sudo raspi-config
Navigate to Interfacing Options > SPI
and enable it.
Configure CAN Interface: Add the following lines to /boot/config.txt
to configure the CANhat:
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
dtoverlay=spi-bcm2835
Reboot the Raspberry Pi:
sudo reboot
Bring up the CAN Interface:
sudo ip link set can0 up type can bitrate 500000
Send a CAN Message:
cansend can0 123#DEADBEEF
This sends a CAN message with ID 123
and data DEADBEEF
.
Receive CAN Messages:
candump can0
This listens for incoming CAN messages on the can0
interface.
Issue: CANhat is not detected by the Raspberry Pi.
raspi-config
. Check the GPIO connections and ensure the CANhat is seated properly.Issue: Unable to send or receive CAN messages.
Issue: candump
shows no messages.
Issue: Raspberry Pi fails to boot after modifying /boot/config.txt
.
/boot/config.txt
to correct any errors. Ensure the overlay parameters are entered correctly.Q: Can I use the CANhat with other single-board computers?
A: The CANhat is designed for Raspberry Pi but can be adapted for other SBCs with SPI and GPIO support.
Q: What is the maximum supported CAN speed?
A: The CANhat supports speeds up to 1 Mbps.
Q: Does the CANhat support dual CAN channels?
A: No, this version of the CANhat supports a single CAN channel.
Q: Can I use the CANhat for automotive applications?
A: Yes, the CANhat is suitable for automotive diagnostics and communication, provided it is used within its operating specifications.
By following this documentation, you can effectively integrate the CANhat into your Raspberry Pi projects and leverage its capabilities for CAN bus communication.