# Adafruit CAN Bus FeatherWing

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/123/286/medium800/adafruit_products_5709-03.jpg?1691030227)

[CAN Bus is a small-scale networking standard](https://en.wikipedia.org/wiki/CAN_bus), originally designed for cars and, yes, busses, 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/123/287/medium800/adafruit_products_5709-02.jpg?1691030489)

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/123/288/medium800/adafruit_products_5709-01.jpg?1691030194)

If you'd like to connect your Feather to a CAN Bus, the **Adafruit CAN Bus FeatherWing** with MCP2515 controller and TJA1051/3 transceiver will work with any and all Feathers! [The controller used is the MCP2515, an extremely popular and well-supported chipset](https://www.microchip.com/en-us/product/MCP2515) that has drivers in Arduino and [CircuitPython](https://github.com/adafruit/Adafruit_CircuitPython_MCP2515) and only requires an SPI port and two pins for chip-select and 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/123/289/medium800/adafruit_products_5709-00.jpg?1691030458)

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

- [**5V charge-pump voltage generator**](https://www.adafruit.com/product/3661), so even though you are running 3.3V on a Feather board, it will generate a nice clean 5V as required by the transceiver.
- **[3.5mm terminal block](https://www.adafruit.com/product/725)** that can be soldered in to get quick access to the High and Low data lines as well as a ground pin.
- **120 ohm termination resistor on board** , you can remove the termination easily by cutting the jumper marked TERM on the top of the board.
- A spot that one can solder an **optional (not included!) [edge-launch DE-9 connector](https://www.digikey.com/short/3ph0d377)** that is commonly used for connecting to CAN devices. L is connected to pin 2 and H is connected to pin 7. [You could then plug this into an ODB-II cable to connect to a car's CAN network](https://www.adafruit.com/product/4841) - you'll still need software to decode the messages though!
- **Pre-connected CS and INT pins** on the two pins to the left of the I2C Feather port - usually these are pins #5 and #6 but some feathers may have different numbering! You can cut the bottom solder jumpers and use the breakout pads to connect to any two IO pins you like.

Each order comes with an assembled 'Wing, terminal block and header. You will need to solder in the header yourself but it's a quick task.

# Adafruit CAN Bus FeatherWing

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/119/534/medium800/adafruit_products_double.jpg?1679499051)

## Terminal Block Pins

On the front left of the board, are the three pins for the included terminal block. It is outlined in white on the silk.

- **CANL** - the CAN low signal for the CAN Bus standard.
- **-** - common ground shared between the two CAN connections
- **CANH** - the CAN high signal for the CAN Bus standard.

Both **CANL** and **CANH** are connected to a [**5V charge-pump voltage generator**](https://www.adafruit.com/product/3661). Even if you are using 3.3V logic on a Feather board, it will generate a nice clean 5V as required by the CAN Bus transceiver.

## Edge Launch DE-9 Connector Solder Pads

On the front-right end of the board are the solder pads for attaching an optional [edge launch DE-9 connector](https://www.digikey.com/short/3ph0d377). This is commonly used for connecting to CAN devices. **CANL** is connected to **DE-9 pin 2** and **CANH** is connected to **DE-9 pin 7**.&nbsp;[You could then plug this into an ODB-II cable to connect to a car's CAN network](https://www.adafruit.com/product/4841). Then, you can decode messages with software.

## Terminator Jumper

The terminator jumper is located on the front of the board, to the left of the solder pads for the edge launch DE-9 connector. It is labeled **TERM** and is outlined in white on the board silk.

- **TERM** - The board has a 120 ohm terminator connected between **CANH** and **CANL**. You can disable (remove) the terminator by&nbsp; **cutting&nbsp;** the&nbsp; **TERM** &nbsp;jumper, if your bus is already terminated.

## Reset Pin and Jumper

- **Reset Jumper** - located on the back of the board, to the right of the board name description, is the reset jumper. It is labeled **RST** and is outlined in white on the board silk. You can cut this jumper to disconnect the **MCP2515 reset pin** from the **Feather reset pin**.
- **Reset Pin** - located on the front of the board in the center. It is labeled **RST** on the silk. If you cut the **reset jumper** , you can use this pin to connect the **MCP2515 reset pin** to a different IO pin.

## Chip Select Pin and Jumper

- **CS Jumper** - located on the back of the board, below Feather pin 5, is the chip select jumper. It is labeled **CS** and is outlined in white on the board silk. By default, the **MCP2515 chip select pin** is connected to **pin 5** on the Feather. You can cut this jumper to disconnect the **MCP2515 CS pin** from **Feather pin 5**.
- **CS pin** - located on the front of the board in the center. It is labeled **CS** on the silk. If you cut the **CS jumper** , you can use this pin to connect the **MCP2515 CS pin** to a different IO pin.

## Interrupt Pin and Jumper

- **INT Jumper** - located on the back of the board, below Feather pin 6, is the interrupt jumper. It is labeled **INT** and is outlined in white on the board silk. By default, the **MCP2515 interrupt pin** is connected to **pin 6** on the Feather. You can cut this jumper to disconnect the **MCP2515 INT pin** from **Feather pin 6**.
- **INT pin** - located on the front of the board in the center. It is labeled **INT** on the silk. If you cut the **INT jumper** , you can use this pin to connect the **MCP2515 INT pin** to a different IO pin.

## Silent Mode Pin

- **SLNT pin** - located on the front of the board in the center. It is labeled **SLNT** on the silk. This pin can be pulled high to put the TJA1051/3 transceiver into silent mode. From the datasheet:

> In Silent mode, the transmitter is disabled, releasing the bus pins to recessive state. All other IC functions, including the receiver, continue to operate as in Normal mode. Silent mode can be used to prevent a faulty CAN controller from disrupting all network communications.

# Adafruit CAN Bus FeatherWing

## CircuitPython

It's easy to use the **CAN Bus FeatherWing** 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 MCP2515 CAN bus controller.

## CircuitPython Microcontroller Wiring

A Feather RP2040 can connect to the CAN Bus FeatherWings by plugging them both into a [FeatherWing Doubler](https://www.adafruit.com/product/2890):

Plug the Feather RP2040 into one slot on the doubler and then plug the CAN Bus FeatherWing into the remaining slot. This will connect all of the FeatherWing pins to the Feather RP2040.

![adafruit_products_doublerFritz_bb.png](https://cdn-learn.adafruit.com/assets/assets/000/119/677/medium640/adafruit_products_doublerFritz_bb.png?1679683019)

### FeatherWing Doubler - Prototyping Add-on For All Feather Boards

[FeatherWing Doubler - Prototyping Add-on For All Feather Boards](https://www.adafruit.com/product/2890)
This is the **FeatherWing Doubler** - a prototyping add-on and more for all Feather boards. This is similar to our [FeatherWing Proto](https://www.adafruit.com/products/2884) except there are two! The magic of the Doubler comes when stacking a Feather and another...

In Stock
[Buy Now](https://www.adafruit.com/product/2890)
[Related Guides to the Product](https://learn.adafruit.com/products/2890/guides)
![Double prototyping feather wing PCB with socket headers installed](https://cdn-shop.adafruit.com/640x480/2890-01.jpg)

## CircuitPython Usage

To use with CircuitPython, you need to first install the MCP2515 library, and its dependencies, into the **lib** folder onto your **CIRCUITPY** drive. Then you need to update **code.py** with the example script.

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 the **code.py** file in a zip file. Extract the contents of the zip file, and copy the **entire lib folder** and the **code.py** file to your **CIRCUITPY** drive.

Your **CIRCUITPY/lib** folder should contain the following folders:

- **adafruit\_bus\_device/**
- **adafruit\_mcp2515/**

![CIRCUITPY](https://adafruit.github.io/Adafruit_CircuitPython_Bundle/mcp2515_mcp2515_simpletest.py.png )

## Simple Test Example

Once everything is saved to the **CIRCUITPY** drive, [connect to the serial console](https://learn.adafruit.com/welcome-to-circuitpython/kattni-connecting-to-the-serial-console) to see the data printed out!

https://github.com/adafruit/Adafruit_CircuitPython_MCP2515/blob/main/examples/mcp2515_simpletest.py

In the code, the instantiation of `can_bus` sets `loopback` and `silent` to `True`. This allows you to test the CAN Bus messaging without another CAN device.

```python
can_bus = CAN(
    spi, cs, loopback=True, silent=True
)  # use loopback to test without another device
```

In the REPL, you'll see the byte array message be sent successfully every second.

![](https://cdn-learn.adafruit.com/assets/assets/000/119/678/medium800/adafruit_products_cpExample.png?1679683155)

## Testing with Two CAN Bus FeatherWings

You can test with two CAN Bus FeatherWings by preparing two FeatherWing Doublers with Feather RP2040s and CAN Bus FeatherWings.

Once you have two Feather RP2040's connected to CAN Bus FeatherWings, you can connect the CAN signals:

- **FeatherWing A CANH** terminal block to **FeatherWing B CANH** terminal block **(blue wire)**
- **FeatherWing A -** (ground) terminal block to **FeatherWing B -** (ground) terminal block **(black wire)**
- **FeatherWing A CANL** terminal block to **FeatherWing B CANL** terminal block **(yellow wire)**

![adafruit_products_twoWings_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/119/679/medium640/adafruit_products_twoWings_bb.jpg?1679683580)

Upload the Project Bundle to both **CIRCUITPY** drives. In the code, change the `can_bus` instantiation on both Feather RP2040's to have `loopback` and `silent` be `False`.

```auto
can_bus = CAN(
    spi, cs, loopback=False, silent=False
)  # use loopback to test without another device
```

When you run the code on both Feather boards, you can check each REPL window and see messages being exchanged between the two boards.

# Adafruit CAN Bus FeatherWing

## Python Docs

# Adafruit CAN Bus FeatherWing

## Arduino

Using the CAN Bus FeatherWing&nbsp;with Arduino involves wiring up the FeatherWing to your Arduino-compatible microcontroller, installing the [Adafruit\_MCP2515](https://github.com/adafruit/Adafruit_MCP2515) library and running the provided example code.

## Wiring

Since CAN bus is a two-way communication protocol, you'll need two devices talking to each other over CAN. First, prep two Feather RP2040's and two CAN Bus FeatherWings by connecting them with [FeatherWing Doublers](https://www.adafruit.com/product/2890):

Plug the Feather RP2040 into one slot on the doubler and then plug the CAN Bus FeatherWing into the remaining slot. This will connect all of the FeatherWing pins to the Feather RP2040.

![adafruit_products_doublerFritz_bb.png](https://cdn-learn.adafruit.com/assets/assets/000/119/689/medium640/adafruit_products_doublerFritz_bb.png?1679689760)

Once you have two Feather RP2040's connected to CAN Bus FeatherWings, you can connect the CAN signals:

- **FeatherWing A CANH** terminal block to **FeatherWing B CANH** terminal block **(blue wire)**
- **FeatherWing A -** (ground) terminal block to **FeatherWing B -** (ground) terminal block **(black wire)**
- **FeatherWing A CANL** terminal block to **FeatherWing B CANL** terminal block **(yellow wire)**

![adafruit_products_twoWings_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/119/688/medium640/adafruit_products_twoWings_bb.jpg?1679689738)

### FeatherWing Doubler - Prototyping Add-on For All Feather Boards

[FeatherWing Doubler - Prototyping Add-on For All Feather Boards](https://www.adafruit.com/product/2890)
This is the **FeatherWing Doubler** - a prototyping add-on and more for all Feather boards. This is similar to our [FeatherWing Proto](https://www.adafruit.com/products/2884) except there are two! The magic of the Doubler comes when stacking a Feather and another...

In Stock
[Buy Now](https://www.adafruit.com/product/2890)
[Related Guides to the Product](https://learn.adafruit.com/products/2890/guides)
![Double prototyping feather wing PCB with socket headers installed](https://cdn-shop.adafruit.com/640x480/2890-01.jpg)

## 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/120/890/medium800/adafruit_products_Arduino_Open_Library_Manager.png?1683594335)

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

![](https://cdn-learn.adafruit.com/assets/assets/000/120/892/medium800/adafruit_products_libInstall.png?1683636895)

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

![](https://cdn-learn.adafruit.com/assets/assets/000/120/893/medium800/adafruit_products_libDepends.png?1683636904)

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

Warning: 

## Example Send Code
https://github.com/adafruit/Adafruit_MCP2515/blob/main/examples/MCP2515_CAN_Sender/MCP2515_CAN_Sender.ino

## Example Receive Code
https://github.com/adafruit/Adafruit_MCP2515/blob/main/examples/MCP2515_CAN_Receiver/MCP2515_CAN_Receiver.ino

Upload the Example Send Code to one of the Feathers and then upload the Example Receive Code to the other Feather. When you open the Serial Monitor for the Feather running the Send code, you'll see confirmations that packets have been sent.

![](https://cdn-learn.adafruit.com/assets/assets/000/119/686/medium800/adafruit_products_sendArduino.png?1679689677)

When you open the Serial Monitor for the Feather running the Receive code, you'll see the messages coming in via CAN.

![](https://cdn-learn.adafruit.com/assets/assets/000/119/687/medium800/adafruit_products_recieveArduino.png?1679689714)

# Adafruit CAN Bus FeatherWing

## Arduino Docs

# Adafruit CAN Bus FeatherWing

## Downloads

## Files

- [MCP2515 Datasheet](https://cdn-learn.adafruit.com/assets/assets/000/119/530/original/MCP2515-Family-Data-Sheet-DS20001801K.pdf?1679491405)
- [TJA1051/3 Datasheet](https://cdn-learn.adafruit.com/assets/assets/000/119/531/original/TJA1051.pdf?1679491410)
- [EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-CAN-Bus-FeatherWing-PCB)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20CAN%20Bus%20FeatherWing.fzpz)

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

![](https://cdn-learn.adafruit.com/assets/assets/000/119/864/medium800/adafruit_products_fab.png?1680035969)

Dimensions are in inches.


## Primary Products

### Adafruit CAN Bus FeatherWing - MCP2515

[Adafruit CAN Bus FeatherWing - MCP2515](https://www.adafruit.com/product/5709)
[CAN Bus is a small-scale networking standard](https://en.wikipedia.org/wiki/CAN_bus), originally designed for cars and, yes, busses, but is now used for many robotics or sensor networks that need better range and addressing than I2C, and&nbsp;don't have the pins or...

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

## Featured Products

### FeatherWing Doubler - Prototyping Add-on For All Feather Boards

[FeatherWing Doubler - Prototyping Add-on For All Feather Boards](https://www.adafruit.com/product/2890)
This is the **FeatherWing Doubler** - a prototyping add-on and more for all Feather boards. This is similar to our [FeatherWing Proto](https://www.adafruit.com/products/2884) except there are two! The magic of the Doubler comes when stacking a Feather and another...

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

## Related Guides

- [Quickstart - Raspberry Pi RP2040 with BLE and CircuitPython](https://learn.adafruit.com/quickstart-raspberry-pi-rp2040-with-ble-and-circuitpython.md)
- [CircuitPython displayio Setup for TFT FeatherWings](https://learn.adafruit.com/using-circuitpython-displayio-with-a-tft-featherwing.md)
- [MIDI Laser Harp with Time of Flight Distance Sensors](https://learn.adafruit.com/midi-laser-harp-time-of-flight-sensors.md)
- [HID Reporter](https://learn.adafruit.com/hid-reporter.md)
- [USB Host to BLE Keyboard Adapter](https://learn.adafruit.com/esp32-s3-usb-to-ble-keyboard-adapter.md)
- [Walkmp3rson: Personal MP3 'Tape' Player](https://learn.adafruit.com/walkmp3rson-personal-mp3-tape-player.md)
- [Discord and Slack Connected Smart Plant with Adafruit IO Actions](https://learn.adafruit.com/discord-and-slack-connected-smart-plant-with-adafruit-io-triggers.md)
- [Bluefruit LE Feather Robot Rover](https://learn.adafruit.com/bluefruit-feather-robot.md)
- [Talking Musical NeoPixel Clock with Infrared, BLE and Touch Controls](https://learn.adafruit.com/talking-musical-neo-pixel-clock-with-infrared-ble-and-touch-controls.md)
- [4x4 Rotary Encoder MIDI Messenger](https://learn.adafruit.com/4x4-rotary-encoder-midi-messenger.md)
- [MAC Address Finder](https://learn.adafruit.com/mac-address-finder.md)
- [Daily Cheer Automaton](https://learn.adafruit.com/daily-cheer-automaton.md)
- [Computer Space Mini Arcade](https://learn.adafruit.com/computer-space-mini-arcade.md)
- [IoT Air Quality Sensor with Adafruit IO](https://learn.adafruit.com/diy-air-quality-monitor.md)
- [Disconnected CO2 Data Logger](https://learn.adafruit.com/disconnected-co2-data-logger.md)
