Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use CANhat: Examples, Pinouts, and Specs

Image of CANhat
Cirkit Designer LogoDesign with CANhat in Cirkit Designer

Introduction

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.

Explore Projects Built with CANhat

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Raspberry Pi 4B-Based Multi-Sensor Interface Hub with GPS and GSM
Image of Rocket: A project utilizing CANhat in a practical application
This circuit features a Raspberry Pi 4B interfaced with an IMX296 color global shutter camera, a Neo 6M GPS module, an Adafruit BMP388 barometric pressure sensor, an MPU-6050 accelerometer/gyroscope, and a Sim800l GSM module for cellular connectivity. Power management is handled by an MT3608 boost converter, which steps up the voltage from a Lipo battery, with a resettable fuse PTC and a 1N4007 diode for protection. The Adafruit Perma-Proto HAT is used for organizing connections and interfacing the sensors and modules with the Raspberry Pi via I2C and GPIO pins.
Cirkit Designer LogoOpen Project in Cirkit Designer
Wemos D1 Mini Based Soil Moisture and Temperature Monitoring System
Image of pfe2: A project utilizing CANhat in a practical application
This circuit features a Wemos D1 Mini microcontroller connected to an AHT10 temperature and humidity sensor and a capacitive soil moisture sensor. The AHT10 communicates with the Wemos D1 Mini via I2C (with SDA connected to D2 and SCL to D1), while the soil moisture sensor's analog output is connected to the A0 pin of the Wemos D1 Mini. Both sensors and the microcontroller share a common power supply, with the 3V3 pin of the Wemos D1 Mini providing power to the sensors.
Cirkit Designer LogoOpen Project in Cirkit Designer
Raspberry Pi Pico-Based Navigation Assistant with Bluetooth and GPS
Image of sat_dish: compass example: A project utilizing CANhat in a practical application
This circuit features a Raspberry Pi Pico microcontroller interfaced with an HC-05 Bluetooth module for wireless communication, an HMC5883L compass module for magnetic field measurement, and a GPS NEO 6M module for location tracking. The Pico is configured to communicate with the HC-05 via serial connection (TX/RX), with the compass module via I2C (SCL/SDA), and with the GPS module via serial (TX/RX). Common power (VCC) and ground (GND) lines are shared among all modules, indicating a unified power system.
Cirkit Designer LogoOpen Project in Cirkit Designer
NodeMCU ESP8266 Smart Door Security System with Color Sensor and Relay Control
Image of NodeMCU 8266 V3 rgb color sensor buzzer: A project utilizing CANhat in a practical application
This circuit is a smart canister monitoring system that uses a TCS3472 color sensor to detect the color of the canister contents. The NodeMCU ESP8266 microcontroller processes the sensor data and controls a relay and buzzer to provide alerts based on the detected color, indicating whether the canister is empty or not.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with CANhat

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Rocket: A project utilizing CANhat in a practical application
Raspberry Pi 4B-Based Multi-Sensor Interface Hub with GPS and GSM
This circuit features a Raspberry Pi 4B interfaced with an IMX296 color global shutter camera, a Neo 6M GPS module, an Adafruit BMP388 barometric pressure sensor, an MPU-6050 accelerometer/gyroscope, and a Sim800l GSM module for cellular connectivity. Power management is handled by an MT3608 boost converter, which steps up the voltage from a Lipo battery, with a resettable fuse PTC and a 1N4007 diode for protection. The Adafruit Perma-Proto HAT is used for organizing connections and interfacing the sensors and modules with the Raspberry Pi via I2C and GPIO pins.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of pfe2: A project utilizing CANhat in a practical application
Wemos D1 Mini Based Soil Moisture and Temperature Monitoring System
This circuit features a Wemos D1 Mini microcontroller connected to an AHT10 temperature and humidity sensor and a capacitive soil moisture sensor. The AHT10 communicates with the Wemos D1 Mini via I2C (with SDA connected to D2 and SCL to D1), while the soil moisture sensor's analog output is connected to the A0 pin of the Wemos D1 Mini. Both sensors and the microcontroller share a common power supply, with the 3V3 pin of the Wemos D1 Mini providing power to the sensors.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of sat_dish: compass example: A project utilizing CANhat in a practical application
Raspberry Pi Pico-Based Navigation Assistant with Bluetooth and GPS
This circuit features a Raspberry Pi Pico microcontroller interfaced with an HC-05 Bluetooth module for wireless communication, an HMC5883L compass module for magnetic field measurement, and a GPS NEO 6M module for location tracking. The Pico is configured to communicate with the HC-05 via serial connection (TX/RX), with the compass module via I2C (SCL/SDA), and with the GPS module via serial (TX/RX). Common power (VCC) and ground (GND) lines are shared among all modules, indicating a unified power system.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of NodeMCU 8266 V3 rgb color sensor buzzer: A project utilizing CANhat in a practical application
NodeMCU ESP8266 Smart Door Security System with Color Sensor and Relay Control
This circuit is a smart canister monitoring system that uses a TCS3472 color sensor to detect the color of the canister contents. The NodeMCU ESP8266 microcontroller processes the sensor data and controls a relay and buzzer to provide alerts based on the detected color, indicating whether the canister is empty or not.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Automotive diagnostics and communication
  • Industrial automation and control systems
  • Robotics and embedded systems
  • IoT devices requiring CAN bus communication
  • Data logging and monitoring in CAN networks

Technical Specifications

The CANhat is designed to provide robust and reliable communication with CAN bus systems. Below are its key technical details:

General Specifications

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

Pin Configuration and Descriptions

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

Usage Instructions

The CANhat is designed to be plug-and-play with Raspberry Pi. Follow the steps below to use the CANhat in your project:

Step 1: Hardware Setup

  1. Attach the CANhat: Align the CANhat with the Raspberry Pi GPIO header and press it firmly into place.
  2. Connect to the CAN bus: Use the onboard screw terminals to connect the CAN_H (high) and CAN_L (low) lines to your CAN bus network.
  3. Power the Raspberry Pi: The CANhat will draw power directly from the Raspberry Pi's 5V GPIO pin.

Step 2: Software Setup

  1. 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
    
  2. Enable SPI on Raspberry Pi: Use raspi-config to enable SPI:

    sudo raspi-config
    

    Navigate to Interfacing Options > SPI and enable it.

  3. 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
    
  4. Reboot the Raspberry Pi:

    sudo reboot
    
  5. Bring up the CAN Interface:

    sudo ip link set can0 up type can bitrate 500000
    

Step 3: Sending and Receiving CAN Messages

  • 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.

Important Considerations and Best Practices

  • Ensure the CAN bus is properly terminated with 120-ohm resistors at both ends.
  • Use a stable power supply for the Raspberry Pi to avoid communication issues.
  • Match the CAN bus bitrate with the devices on the network to ensure compatibility.
  • Avoid long, unshielded wires to minimize noise and signal degradation.

Troubleshooting and FAQs

Common Issues and Solutions

  1. Issue: CANhat is not detected by the Raspberry Pi.

    • Solution: Ensure SPI is enabled in raspi-config. Check the GPIO connections and ensure the CANhat is seated properly.
  2. Issue: Unable to send or receive CAN messages.

    • Solution: Verify the CAN bus wiring and ensure proper termination with 120-ohm resistors. Check that the bitrate matches the other devices on the network.
  3. Issue: candump shows no messages.

    • Solution: Ensure the CAN bus is active and other devices are transmitting messages. Double-check the CAN_H and CAN_L connections.
  4. Issue: Raspberry Pi fails to boot after modifying /boot/config.txt.

    • Solution: Remove the CANhat and edit /boot/config.txt to correct any errors. Ensure the overlay parameters are entered correctly.

FAQs

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.