# Adafruit CAN Bus BFF

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/127/545/medium800thumb/adafruit_products_5877-05.jpg?1707322898)

Adafruit QT Py boards are a great way to make very small microcontroller projects that pack a ton of power - and now we have a way for you to turn many QT Py boards into powerful CAN bus devices that are super small!

![](https://cdn-learn.adafruit.com/assets/assets/000/127/250/medium800/adafruit_products_5877-04.jpg?1706298249)

[CAN Bus is a small-scale networking standard](https://en.wikipedia.org/wiki/CAN_bus), originally designed for cars and, yes, buses, but is now used for many robotics or sensor networks that need better range and addressing than I2C, and don't have the pins or computational ability to talk on Ethernet. CAN is 2 wire differential, which means it's good for long distances and noisy environments.

![](https://cdn-learn.adafruit.com/assets/assets/000/127/251/medium800/adafruit_products_5877-02.jpg?1706298280)

Messages are sent at about 1Mbps rate - you set the frequency for the bus and then all 'joiners' must match it, and have an address before the packet so that each node can listen in to messages just for it. New nodes can be attached easily because they just need to connect to the two data lines anywhere in the shared net. Each CAN devices sends messages whenever it wants, and thanks to some clever data encoding, can detect if there's a message collision and retransmit later.

![](https://cdn-learn.adafruit.com/assets/assets/000/127/252/medium800/adafruit_products_5877-03.jpg?1706298311)

If you'd like to connect your QT Py or Xiao to a CAN Bus, the **Adafruit CAN Bus BFF** will work with any and all boards thanks to the simple SPI interface! [The controller used is the MCP25625 - also known as the MCP2515 controller plus MCP2551 transceiver, an extremely popular and well-supported chipset](https://www.microchip.com/en-us/product/MCP2515) that has [drivers in Arduino](https://github.com/adafruit/Adafruit_MCP2515) and [CircuitPython](https://github.com/adafruit/Adafruit_CircuitPython_MCP2515) and only requires an SPI port and 1 pin for chip-select, plus another for optional IRQ. Use it to send and receive messages in either standard or extended format at up to 1 Mbps.

![](https://cdn-learn.adafruit.com/assets/assets/000/127/253/medium800/adafruit_products_5877-01.jpg?1706298378)

We've added a few nice extras to this BFF to make it useful in many common CAN scenarios:

- **JST PH socket** -[Plug in one of our JST PH 3-pn cables](https://www.adafruit.com/product/3893) (not included!) for fast wiring and connection/disconnection. Black wire is ground, Red wire is CAN H, White wire is CAN L.
- **120 ohm termination resistor on board** , you can remove the termination easily by cutting the jumper on the top of the board.
- **Pre-connected CS pin** to A3. There's also jumpers if you want to connect the IRQ, Reset and Silent pins.

We include some header that you can solder to your QT Py. [You can also pick up an ItsyBitsy short female header kit to make it removable but compact](https://www.adafruit.com/product/4174), you'll just need to trim down the headers to 7 pins long. This board works with any QT Py or Xiao-shaped board that has the SPI port and A3 pin available.

**A QT Py and JST PH 3-Pin cable is not included**.

# Adafruit CAN Bus BFF

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/127/256/medium800/adafruit_products_double.jpg?1706299537)

## CAN Bus Controller

The MCP25625 (aka an MCP2515 with built-in transceiver), is an extremely popular and well-supported chipset that has drivers in Arduino and CircuitPython. It only requires a SPI port and one pin for chip-select at a minimum. You can use it to send and receive messages in either standard or extended format at up to 1 Mbps.

The MCP25625 uses the exposed SPI port ( **SCK** , **MOSI** and **MISO** ).

## CAN Bus JST-PH Connector

On the front of the board is the JST-PH connector with the three pins for communicating with the CAN Bus standard. If you use one of our [JST-PH 3-pin cables](https://www.adafruit.com/product/3893), black wire is ground, red wire is CAN H and white wire is CAN L.

- The left input on the JST-PH connector is common ground shared between the two CAN connections.
- **H** - the CAN high signal for the CAN Bus standard. It is connected to the middle pin on the JST-PH connector.
- **L** - the CAN low signal for the CAN Bus standard. It is connected to the right input on the JST-PH connector.

## CAN Bus Jumper Pins

- **INT&nbsp;** - The interrupt pin for the MCP25625. This jumper is open/not connected by default. If you solder the jumper closed, it will connect the interrupt pin to **A0**.
- **STBY&nbsp;** - The standby pin for the MCP25625. This jumper is open/not connected by default. If you solder the jumper closed, it will connect the interrupt pin to **A1**.
- **RST&nbsp;** - The reset pin for the MCP25625. This jumper is open/not connected by default. If you solder the jumper closed, it will connect the reset pin to **A2**.
- **CS** - The chip-select pin for the MCP25625. This jumper is closed by default and connected to pin **A3**. You can cut this jumper to disconnect CS from A3 and solder a wire from the pad closest to the CS label on the board silk to a different pin.
- **Trm&nbsp;** - The terminator jumper for the MCP25625. The BFF has a 120 ohm termination resistor connected between&nbsp; **H** &nbsp;and&nbsp; **L**. You can disable (remove) the resistor by&nbsp; **cutting&nbsp;** the&nbsp; **Trm** &nbsp;jumper, if your bus is already terminated.

# Adafruit CAN Bus BFF

## CircuitPython

It's easy to use the **CAN Bus BFF** with CircuitPython and the [Adafruit\_CircuitPython\_MCP2515](https://github.com/adafruit/Adafruit_CircuitPython_MCP2515) module. This module allows you to easily write Python code that lets you utilize the MCP25625 CAN bus controller. In the example below, you'll connect an RP2040 CAN Bus Feather to a QT Py plugged into a CAN Bus BFF. The Feather will send CAN Bus messages whenever the seesaw rotary encoder is used and the QT Py will receive and display the messages on a STEMMA OLED.

### Monochrome 1.3" 128x64 OLED graphic display - STEMMA QT / Qwiic

[Monochrome 1.3" 128x64 OLED graphic display - STEMMA QT / Qwiic](https://www.adafruit.com/product/938)
These displays are small, only about 1.3" diagonal, but very readable due to the high contrast of an OLED display. This display is made of 128x64 individual white OLED pixels, each one is turned on or off by the controller chip. Because the display makes its own light, no backlight is...

In Stock
[Buy Now](https://www.adafruit.com/product/938)
[Related Guides to the Product](https://learn.adafruit.com/products/938/guides)
![Monochrome 1.3" OLED module with Adafruit logos falling like snow](https://cdn-shop.adafruit.com/product-videos/640x480/938-05.jpg)

### Adafruit I2C Stemma QT Rotary Encoder Breakout with NeoPixel

[Adafruit I2C Stemma QT Rotary Encoder Breakout with NeoPixel](https://www.adafruit.com/product/4991)
Rotary encoders are soooo much fun! Twist em this way, then twist them that way. Unlike potentiometers, they go all the way around and often have little detents for tactile feedback. But, if you've ever tried to add encoders to your project you know that they're a real challenge to...

In Stock
[Buy Now](https://www.adafruit.com/product/4991)
[Related Guides to the Product](https://learn.adafruit.com/products/4991/guides)
![Top view video of a hand turning the rotary encoder knobs on three PCBs. The NeoPixel LEDs on each PCB change color. The OLED display changes its readout data with each twisty-turn.](https://cdn-shop.adafruit.com/product-videos/640x480/4991-08.jpg)

## CircuitPython Microcontroller Wiring

Plug an CAN Bus BFF into your QT Py or Xiao form factor board exactly as shown below. Here's an example of connecting a QT Py RP2040 to the BFF.

Connect the QT Py RP2040 with plug headers into the CAN Bus BFF with socket headers. They should be plugged in with the backs of the boards facing each other.

For more information on soldering socket headers,&nbsp;[check out this Learn Guide](https://learn.adafruit.com/how-to-solder-headers/female-headers).

![adafruit_products_edited_P1440243.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/363/medium640/adafruit_products_edited_P1440243.jpg?1706652846)

[How to Solder Headers Learn Guide](https://learn.adafruit.com/how-to-solder-headers/female-headers)
Then, you'll connect the Feather and BFF CAN Bus connections to each other, followed by the STEMMA peripherals to the corresponding boards.

### QT Py

- **Board STEMMA 3V** to **screen** **VIN (red wire)**  
- **Board STEMMA GND** to **screen** **GND (black wire)**  
- **Board STEMMA SCL** to **screen** **SCL (yellow wire)**  
- **Board STEMMA SDA** to **screen** **SDA (blue wire)**

### CAN Bus

- **Feather H** terminal block to **BFF H** JST-PH **(red wire)**
- **Feather middle** (ground) terminal block to **BFF ground** JST-PH **(black wire)**
- **Feather L** terminal block to **BFF L** JST-PH **(white wire)**

### Feather RP2040 CAN Bus

- **Feather STEMMA 3V** to **rotary encoder** **VIN (red wire)**  
- **Feather STEMMA GND** to **rotary encoder** **GND (black wire)**  
- **Feather STEMMA SCL** to **rotary encoder** **SCL (yellow wire)**  
- **Feather STEMMA SDA** to **rotary encoder** **SDA (blue wire)**

![adafruit_products_feather_BFFexample_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/337/medium640/adafruit_products_feather_BFFexample_bb.jpg?1706557160)

## CircuitPython Usage

To use with CircuitPython, you need to first install the MCP2515 library, and its dependencies, into the **lib** folder onto both of your **CIRCUITPY** drives for this example. Then, load the different example code files onto the corresponding boards; one for the Feather RP2040 CAN Bus and one for the QT Py RP2040 with the CAN Bus BFF.

Thankfully, we can do this in one go. In the example below, click the **Download Project Bundle** button below to download the necessary libraries and Python files in a zip file. Extract the contents of the zip file, and copy the **entire lib folder** and **can\_bus\_bff\_receiver.py** file to your QT Py RP2040 **CIRCUITPY** drive. Rename **can\_bus\_bff\_receiver.py** to **code.py**.

Then, copy the **entire lib folder** and **can\_bus\_feather\_send.py** file to your Feather RP2040 CAN Bus **CIRCUITPY** drive. Rename **can\_bus\_feather\_send.py** to **code.py**.

Your QT Py RP2040 and Feather RP2040 CAN Bus **CIRCUITPY/lib** folders should contain the following folders and files:

- **adafruit\_bitmap\_font/**
- **adafruit\_bus\_device/**
- **adafruit\_display\_text/**
- **adafruit\_mcp2515/**
- **adafruit\_seesaw/**
- **adafruit\_displayio\_ssd1306.mpy**
- **adafruit\_pixelbuf.mpy**

![CIRCUITPY](https://adafruit.github.io/Adafruit_Learning_System_Guides/CAN_Bus_BFF_CircuitPython.png )

## Example Code
![](https://cdn-learn.adafruit.com/assets/assets/000/127/547/medium800thumb/adafruit_products_5877-05.jpg?1707323030)

Once everything is saved to both **CIRCUITPY** drives, [connect to the serial console](https://learn.adafruit.com/welcome-to-circuitpython/kattni-connecting-to-the-serial-console) to see the data printed out! The Feather will be sending CAN messages to the QT Py via the CAN Bus BFF.

### Feather RP2040 CAN Bus Sender
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/CAN_Bus_BFF/CircuitPython/can_bus_feather_send.py

When you open the serial console for the Feather, you'll see confirmations that packets have been sent every time you turn the rotary encoder or press the button. As you turn the rotary encoder, the NeoPixels on the encoder and the Feather will advance thru the color wheel.

![](https://cdn-learn.adafruit.com/assets/assets/000/127/364/medium800/adafruit_products_cpREPLsend.png?1706653692)

### CAN Bus BFF Receiver
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/CAN_Bus_BFF/CircuitPython/can_bus_bff_receiver.py

When you open the serial console for the QT Py RP2040, you'll see the messages coming in via CAN for the status of the encoder position and the push button. You'll also see them on the OLED along with "CAN Receiver" at the top.

![](https://cdn-learn.adafruit.com/assets/assets/000/127/365/medium800/adafruit_products_cpREPL.png?1706653700)

# Adafruit CAN Bus BFF

## Python Docs

# Adafruit CAN Bus BFF

## Arduino

Using the CAN Bus BFF with Arduino involves wiring up the BFF to your Arduino-compatible QT Py or Xiao form factor board, installing the [Adafruit\_MCP2515](https://github.com/adafruit/Adafruit_MCP2515) library, and running the provided example code. In the example below, you'll connect a RP2040 CAN Bus Feather to a QT Py plugged into a CAN Bus BFF. The Feather will send CAN Bus messages whenever the seesaw rotary encoder is used and the QT Py will receive and display the messages on a STEMMA OLED.

### Monochrome 1.3" 128x64 OLED graphic display - STEMMA QT / Qwiic

[Monochrome 1.3" 128x64 OLED graphic display - STEMMA QT / Qwiic](https://www.adafruit.com/product/938)
These displays are small, only about 1.3" diagonal, but very readable due to the high contrast of an OLED display. This display is made of 128x64 individual white OLED pixels, each one is turned on or off by the controller chip. Because the display makes its own light, no backlight is...

In Stock
[Buy Now](https://www.adafruit.com/product/938)
[Related Guides to the Product](https://learn.adafruit.com/products/938/guides)
![Monochrome 1.3" OLED module with Adafruit logos falling like snow](https://cdn-shop.adafruit.com/product-videos/640x480/938-05.jpg)

### Adafruit I2C Stemma QT Rotary Encoder Breakout with NeoPixel

[Adafruit I2C Stemma QT Rotary Encoder Breakout with NeoPixel](https://www.adafruit.com/product/4991)
Rotary encoders are soooo much fun! Twist em this way, then twist them that way. Unlike potentiometers, they go all the way around and often have little detents for tactile feedback. But, if you've ever tried to add encoders to your project you know that they're a real challenge to...

In Stock
[Buy Now](https://www.adafruit.com/product/4991)
[Related Guides to the Product](https://learn.adafruit.com/products/4991/guides)
![Top view video of a hand turning the rotary encoder knobs on three PCBs. The NeoPixel LEDs on each PCB change color. The OLED display changes its readout data with each twisty-turn.](https://cdn-shop.adafruit.com/product-videos/640x480/4991-08.jpg)

## Wiring

Plug a CAN Bus BFF into your QT Py or Xiao form factor board exactly as shown below. Here's an example of connecting a QT Py RP2040 to the BFF.

Connect the QT Py RP2040 with plug headers into the CAN Bus BFF with socket headers. **They should be plugged in with the backs of the boards facing each other.**

For more information on soldering socket headers, [check out this Learn Guide](https://learn.adafruit.com/how-to-solder-headers/female-headers).

![adafruit_products_edited_P1440243.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/362/medium640/adafruit_products_edited_P1440243.jpg?1706652823)

[How to Solder Headers Learn Guide](https://learn.adafruit.com/how-to-solder-headers/female-headers)
Then, you'll connect the Feather and BFF CAN Bus connections to each other, followed by the STEMMA peripherals to the corresponding boards.

### QT Py

- **Board STEMMA 3V** to **screen** **VIN (red wire)**  
- **Board STEMMA GND** to **screen** **GND (black wire)**  
- **Board STEMMA SCL** to **screen** **SCL (yellow wire)**  
- **Board STEMMA SDA** to **screen** **SDA (blue wire)**

### CAN Bus

- **Feather H** terminal block to **BFF H** JST-PH **(red wire)**
- **Feather middle** (ground) terminal block to **BFF ground** JST-PH **(black wire)**
- **Feather L** terminal block to **BFF L** JST-PH **(white wire)**

### Feather RP2040 CAN Bus

- **Feather STEMMA 3V** to **rotary encoder** **VIN (red wire)**  
- **Feather STEMMA GND** to **rotary encoder** **GND (black wire)**  
- **Feather STEMMA SCL** to **rotary encoder** **SCL (yellow wire)**  
- **Feather STEMMA SDA** to **rotary encoder** **SDA (blue wire)**

![adafruit_products_feather_BFFexample_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/336/medium640/adafruit_products_feather_BFFexample_bb.jpg?1706556311)

## Library Installation

You can install the **Adafruit MCP2515** library for Arduino using the Library Manager in the Arduino IDE.

![](https://cdn-learn.adafruit.com/assets/assets/000/127/305/medium800/adafruit_products_Arduino_Open_Library_Manager.png?1706544474)

Click the **Manage Libraries ...** menu item, search for **Adafruit MCP2515** and select the **Adafruit MCP2515** library:

![](https://cdn-learn.adafruit.com/assets/assets/000/127/347/medium800/adafruit_products_arduino_lib.png?1706634884)

If asked about dependencies for any of the libraries, click "Install all".

![](https://cdn-learn.adafruit.com/assets/assets/000/127/348/medium800/adafruit_products_arduino_depends.png?1706634893)

If the "Dependencies" window does not come up, then you already have the dependencies installed.

Warning: 

Follow the same process for the Adafruit seesaw Library...

![](https://cdn-learn.adafruit.com/assets/assets/000/127/349/medium800/adafruit_products_adafruit_seesaw_lib.png?1706635207)

...Adafruit NeoPixel library...

![](https://cdn-learn.adafruit.com/assets/assets/000/127/350/medium800/adafruit_products_neopixel_lib.png?1706635281)

...and the Adafruit SSD1306 library.

![](https://cdn-learn.adafruit.com/assets/assets/000/127/351/medium800/adafruit_products_oled_lib.png?1706635306)

## Example Code

### Feather RP2040 CAN Bus Sender
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/CAN_Bus_BFF/Arduino/MCP2515_CAN_Feather_Send/MCP2515_CAN_Feather_Send.ino

### CAN Bus BFF Receiver
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/CAN_Bus_BFF/Arduino/MCP2515_CAN_BFF_Receive/MCP2515_CAN_BFF_Receive.ino

![](https://cdn-learn.adafruit.com/assets/assets/000/127/546/medium800thumb/adafruit_products_5877-05.jpg?1707322977)

Upload the Example Feather Code to the Feather RP2040 CAN Bus and then upload the Example CAN Bus BFF Code to the QT Py RP2040. When you open the Serial Monitor for the Feather, you'll see confirmations that packets have been sent every time you turn the rotary encoder or press the button. As you turn the rotary encoder, the NeoPixels on the encoder and the Feather will advance thru the color wheel.

![](https://cdn-learn.adafruit.com/assets/assets/000/127/353/medium800/adafruit_products_feather_serial.png?1706635818)

When you open the Serial Monitor for the QT Py RP2040, you'll see the messages coming in via CAN for the status of the encoder position and the push button. You'll also see them on the OLED along with "CAN receiver" at the top.

![](https://cdn-learn.adafruit.com/assets/assets/000/127/346/medium800/adafruit_products_qtPySerial.png?1706634514)

# Adafruit CAN Bus BFF

## Arduino Docs

# Adafruit CAN Bus BFF

## Downloads

## Files

- [MCP25625 Datasheet](https://cdn-learn.adafruit.com/assets/assets/000/120/920/original/MCP25625-CAN-Controller-Data-Sheet-20005282C.pdf)
- [EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-CAN-Bus-BFF-PCB)
- [3D models on GitHub](https://github.com/adafruit/Adafruit_CAD_Parts/tree/main/5877%20CAN%20Bus%20BFF)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20CAN%20Bus%20BFF.fzpz)

## Schematic and Fab Print
![](https://cdn-learn.adafruit.com/assets/assets/000/127/254/medium800/adafruit_products_schem.png?1706298716)

![](https://cdn-learn.adafruit.com/assets/assets/000/127/255/medium800/adafruit_products_fab.png?1706298722 dimensions are in inches)

![](https://cdn-learn.adafruit.com/assets/assets/000/138/245/medium800/adafruit_products_5877_CAN_Bus_BFF.jpg?1752006792 )


## Primary Products

### Adafruit CAN Bus BFF Add-On for QT Py

[Adafruit CAN Bus BFF Add-On for QT Py](https://www.adafruit.com/product/5877)
Our QT Py boards are a great way to make very small microcontroller projects that pack a ton of power - and now we have a way for you to turn many QT Py boards into powerful CAN bus devices&nbsp;that are super small!

[CAN Bus is a...](https://en.wikipedia.org/wiki/CAN_bus)

In Stock
[Buy Now](https://www.adafruit.com/product/5877)
[Related Guides to the Product](https://learn.adafruit.com/products/5877/guides)

## Featured Products

### STEMMA JST PH 2mm 3-Pin to Male Header Cable - 200mm

[STEMMA JST PH 2mm 3-Pin to Male Header Cable - 200mm](https://www.adafruit.com/product/3893)
This cable will let you turn a JST PH 3-pin cable port into 3 individual wires with high-quality 0.1" male header plugs on the end. We're carrying these to match up with our Hallowing, for extending and connecting sensors or LEDs - and the wires are even color coded!

<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/3893)
[Related Guides to the Product](https://learn.adafruit.com/products/3893/guides)
### STEMMA JST PH 2mm 3-Pin to Female Socket Cable - 200mm

[STEMMA JST PH 2mm 3-Pin to Female Socket Cable - 200mm](https://www.adafruit.com/product/3894)
This cable will let you turn a JST PH 3-pin cable port into 3 individual wires with high-quality 0.1" female header sockets on the end. We're carrying these to match up with our Hallowing, for extending and connecting sensors or LEDs - and the wires are even color coded!

<a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/3894)
[Related Guides to the Product](https://learn.adafruit.com/products/3894/guides)

## Related Guides

- [Adafruit ItsyBitsy ESP32](https://learn.adafruit.com/adafruit-itsybitsy-esp32.md)
- [MagTag Covid Tracking Project IoT Display](https://learn.adafruit.com/magtag-covid-tracking-project-iot-display.md)
- [Holiday Card Maker on Fruit Jam](https://learn.adafruit.com/holiday-card-maker-on-fruit-jam.md)
- [Adafruit TCS3430 / TCS34303 Ambient Tri-Stimulus Color Sensor](https://learn.adafruit.com/adafruit-tcs3430-tcs34303-ambient-tri-stimulus-color-sensor.md)
- [FunHouse Mail Slot Detector](https://learn.adafruit.com/funhouse-mail-slot-detector.md)
- [Analog Devices ADT7410 Breakout](https://learn.adafruit.com/adt7410-breakout.md)
- [Adafruit DVI Breakout Board](https://learn.adafruit.com/adafruit-dvi-breakout-board.md)
- [Adafruit HUZZAH32 – ESP32 Breakout Board](https://learn.adafruit.com/huzzah32-esp32-breakout-board.md)
- [Animatronic Hand](https://learn.adafruit.com/animatronic-hands.md)
- [Ninja Timer: Giant 7-Segment Display](https://learn.adafruit.com/ninja-timer-giant-7-segment-display.md)
- [Welcome to the Adafruit CircuitPython community!](https://learn.adafruit.com/welcome-to-the-community.md)
- [Egg Hunt Maze Game on Fruit Jam](https://learn.adafruit.com/egg-hunt-maze-game-on-fruit-jam.md)
- [Adafruit GPIO Expander Bonnet for Raspberry Pi](https://learn.adafruit.com/gpio-expander-bonnet.md)
- [LED Matrix Scoreboard](https://learn.adafruit.com/led-matrix-scoreboard.md)
- [HalloWing Badge Image Viewer](https://learn.adafruit.com/hallowing-badge.md)
