# Adafruit CAN Pal

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/123/290/medium800/robotics___cnc_5708-03.jpg?1691051400)

If you'd like to connect a board with **native CAN Peripheral** support, the **Adafruit CAN Pal Transceiver** will take the 3V logic level signals and convert them to CAN logic levels with the differential signaling required to communicate. **Note that not all chips have a CAN peripheral**! Some that we know do have it are the [ESP32/ESP32-S2/ESP32-S3](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/twai.html) (note that ESP32 calls this interface TWAI not CAN) series of chips, [SAME51](https://www.adafruit.com/product/4759), [STM32F405](https://www.adafruit.com/product/4382), and [Teensy 4](https://www.adafruit.com/product/4323).

![](https://cdn-learn.adafruit.com/assets/assets/000/123/292/medium800/robotics___cnc_5708-02.jpg?1691030564)

Check the product documentation for the board you are wiring this to, making sure that the chip has CAN support and the RX and TX pins are brought out for you to connect the transceiver to! Despite sharing the 'RX' and 'TX' name with UART, they're not at all the same interface.

[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/293/medium800/robotics___cnc_5708-01.jpg?1691030555)

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/295/medium800/robotics___cnc_5708-00.jpg?1691080075)

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

- [**TJA1051/T3**](https://www.nxp.com/products/interfaces/can-transceivers/can-with-flexible-data-rate/high-speed-can-transceiver:TJA1051) can communicate with 3.3V-5V logic for use with modern microcontrollers.
- [**5V charge-pump voltage generator**](https://www.adafruit.com/product/3661), so even though you are running 3.3V power and logic on most modern microcontroller&nbsp;boards, it will generate a nice clean 5V as required by the transceiver. **No separate 5V power required!**
- **[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.
- **2 x 60 ohm termination resistor on board (120 ohm in series)**, you can remove or activate the termination easily by flipping the onboard switch.

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

# Adafruit CAN Pal

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/119/583/medium800/arduino_compatibles_double.png?1679530445)

## Terminal Block Pins

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

- **L** - the CAN low signal for the CAN Bus standard.
- Middle pin (unlabeled) - common ground shared between the two CAN connections
- **H** - the CAN high signal for the CAN Bus standard.

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

## Power Pins

- **Vcc** - this is the power pin. Since the transceiver chip uses 3-5 VDC, to power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V micro like Arduino, use 5V.
- **GND** - common ground for power and logic.

## CAN Logic Pins

- **RX** - CAN receive/input pin for boards with a CAN peripheral.
- **TX** - CAN transmit/output pin for boards with a CAN peripheral.

Check the product documentation for the board you are wiring this to, to make sure that:

1. The chip has CAN support
2. The RX and TX pins are brought out for you to connect the transceiver to

Despite sharing the 'RX' and 'TX' name with UART, they're not at all the same interface.

- **SLNT** - can be pulled high to put the TJA1051/3 transceiver into silent mode. In silent mode, the transmitter is disabled, releasing the bus pins to a recessive state.
- **CANH** - the CAN high signal for the CAN Bus standard.
- **CANL** - the CAN low signal for the CAN Bus standard.

## Termination On/Off Switch

The board has two 60 ohm resistors (120 ohm in series) connected between **CANH** and **CANL**. You can disable the terminator by setting the **Termination** switch **&nbsp;OFF** , if your bus is already terminated. Otherwise, keep the switch set to **ON** to enable the termination resistors.

# Adafruit CAN Pal

## CircuitPython

It's easy to use the **CAN Pal** with CircuitPython and the built-in [canio](https://docs.circuitpython.org/en/latest/shared-bindings/canio/index.html) module. This module allows you to easily write Python code that lets you utilize your board's onboard CAN peripheral with the **CAN Pal** transceiver.

**Note that not all chips have a CAN peripheral**! Some that we know do have it are the [ESP32/ESP32-S2/ESP32-S3](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/twai.html) (note that ESP32 calls this interface TWAI not CAN) series of chips, [SAME51](https://www.adafruit.com/product/4759), [STM32F405](https://www.adafruit.com/product/4382), and [Teensy 4](https://www.adafruit.com/product/4323).

## CircuitPython Microcontroller Wiring

First, wire up a CAN Pal to your board exactly as shown below. You're going to do this _twice_ so you have two CAN pals identically connected to two microcontrollers.

Here's an example of wiring a QT Py ESP32-S2 to the CAN Pal on a breadboard with **0.100" pitch** &nbsp;headers:

- **QT Py 3.3V** to **CAN Pal VCC (red wire)**
- **QT Py GND** to **CAN Pal GND (black wire)**
- **QT Py RX** to **CAN Pal RX (green wire)**
- **QT Py TX** to **CAN Pal TX (blue wire)**

![arduino_compatibles_qtPyCanPal_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/119/774/medium640/arduino_compatibles_qtPyCanPal_bb.jpg?1679947148)

Then, connect the two CAN Pal CAN Bus connections together via the 3.5 mm terminal blocks:

- **CAN Pal 0 L** to **CAN Pal 1 L (yellow wire)**
- **CAN Pal 0**  **GND** to **CAN Pal 1 GND (black wire)**
- **CAN Pal 0 H** to **CAN Pal 1 H (pink wire)**

![arduino_compatibles_two_qtPyCanPal_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/119/775/medium640/arduino_compatibles_two_qtPyCanPal_bb.jpg?1679963005)

## CircuitPython Usage

To use with CircuitPython, you need&nbsp;to update **code.py** with the example script. There are no additional libraries needed since the code is utilizing core modules.

In the examples below, click the **Download Project Bundle** button below to download the the **code.py** file in a zip file. Extract the contents of the zip file, and copy the **code.py** file to your **CIRCUITPY** drive.

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

## CAN Sender Example

On line 22, change the RX and TX pin definitions to `board.RX` and `board.TX`:

```python
can = canio.CAN(rx=board.RX, tx=board.TX, baudrate=250_000, auto_restart=True)
```

Then, upload the code to one of the QT Py ESP32-S2's.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/FeatherCAN_CircuitPython/sender/code.py

## CAN Listener Example

On line 22, change the RX and TX pin definitions to&nbsp;`board.RX`&nbsp;and&nbsp;`board.TX`:

```python
can = canio.CAN(rx=board.RX, tx=board.TX, baudrate=250_000, auto_restart=True)
```

Then, upload the code to the remaining QT Py ESP32-S2.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/FeatherCAN_CircuitPython/listener/code.py

In the REPL, you'll be able to see the message count and timestamp as they are sent and received. For the QT Py ESP32-S2 running the Sender example, the REPL will look like this:

![](https://cdn-learn.adafruit.com/assets/assets/000/119/771/medium800/arduino_compatibles_send.png?1679946698)

For the QT Py ESP32-S2 running the Listener example, the REPL will look like this:

![](https://cdn-learn.adafruit.com/assets/assets/000/119/772/medium800/arduino_compatibles_recieve.png?1679946727)

## Going Further

For more information on using CAN Bus with CircuitPython, check out the&nbsp;[CAN Bus with CircuitPython: Using the canio module Learn Guide](https://learn.adafruit.com/using-canio-circuitpython/overview).

[CAN Bus with CircuitPython: Using the canio module](https://learn.adafruit.com/using-canio-circuitpython/overview)
# Adafruit CAN Pal

## Python Docs

# Adafruit CAN Pal

## Downloads

## Files

- [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-Pal-PCB)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20CAN%20Pal%20Breakout.fzpz)
- [3D models on GitHub](https://github.com/adafruit/Adafruit_CAD_Parts/tree/main/5708%20CAN%20Pal)

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

![](https://cdn-learn.adafruit.com/assets/assets/000/119/569/medium800/arduino_compatibles_fab.png?1679512405)

## 3D Model
![](https://cdn-learn.adafruit.com/assets/assets/000/133/716/medium800/robotics___cnc_5708_CAN_Pal.jpg?1732134654)


## Primary Products

### Adafruit CAN Pal - CAN Bus Transceiver

[Adafruit CAN Pal - CAN Bus Transceiver](https://www.adafruit.com/product/5708)
If you'd like to connect a board with **native CAN Peripheral** support, the&nbsp; **Adafruit CAN Pal Transceiver&nbsp;** will take the 3V logic level signals and convert them to CAN logic levels with the differential signaling required to communicate. **Note that not all chips...**

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

## Related Guides

- [Two Player Game System for PyGamer and RFM69HCW Radio Wing](https://learn.adafruit.com/two-player-game-system-for-pygamer-and-rfm69hcw-radio-wing.md)
- [PyGamer MP3 Player with CircuitPython](https://learn.adafruit.com/pygamer-mp3-player-with-circuitpython.md)
- [Adafruit PyPortal - IoT for CircuitPython](https://learn.adafruit.com/adafruit-pyportal.md)
- [Circuit Playground Express: Piano de Limones](https://learn.adafruit.com/circuit-playground-express-piano-de-limones.md)
- [Adafruit Motor Selection Guide](https://learn.adafruit.com/adafruit-motor-selection-guide.md)
- [Adafruit 555 PWM Output STEMMA](https://learn.adafruit.com/adafruit-555-pwm-output-stemma.md)
- [Adafruit Airlift Bitsy Add-On - ESP32 WiFi Co-Processor](https://learn.adafruit.com/adafruit-airlift-bitsy-add-on-esp32-wifi-co-processor.md)
- [Adafruit 1.69" 280x240 Round Rectangle Color IPS TFT Display](https://learn.adafruit.com/adafruit-1-69-280x240-round-rectangle-color-ips-tft-display.md)
- [Adafruit Bonsai Buckaroo](https://learn.adafruit.com/adafruit-bonsai-buckaroo.md)
- [MatrixPortal CircuitPython Animated Message Board](https://learn.adafruit.com/matrixportal-circuitpython-animated-message-board.md)
- [Pyloton: CircuitPython Cycling Computer](https://learn.adafruit.com/pyloton.md)
- [Adafruit EYESPI Breakout Board](https://learn.adafruit.com/adafruit-eyespi-breakout-board.md)
- [Adafruit I2C Quad Rotary Encoder Breakout](https://learn.adafruit.com/adafruit-i2c-quad-rotary-encoder-breakout.md)
- [Adafruit MEMENTO Camera Board](https://learn.adafruit.com/adafruit-memento-camera-board.md)
- [Remote Control Tree Ornament with Circuit Playground Express](https://learn.adafruit.com/remote-control-tree-ornament-with-circuit-playground-express.md)
