# CircuitPython Libraries on Linux and the NVIDIA Jetson Nano

## Overview

Info: This guide describes using CircuitPython **libraries** on small Linux computers, running under regular Python. It is not about running the CircuitPython firmware itself on those boards.

![](https://cdn-learn.adafruit.com/assets/assets/000/056/765/medium800/sensors_blinkatux.gif?1530378720)

Here at Adafruit we're always looking for ways to make _making easier_ - whether that's making breakout boards for hard-to-solder sensors or writing libraries to simplify motor control. Our new favorite way to program is **CircuitPython**.

## Why CircuitPython?

CircuitPython is a variant of MicroPython, a very small version of Python that can fit on a microcontroller. Python is the fastest-growing programming language. It's taught in schools, used in coding bootcamps, popular with scientists and of course programmers at companies use it a lot!

CircuitPython adds the Circuit part to the Python part. It lets you program in Python and talk to Circuitry like sensors, motors, and LEDs!

## CircuitPython on Microcontrollers

CircuitPython runs on microcontroller boards, such as our Feather, Metro, QT Py, and ItsyBitsy boards, using a variety of chips, such as the MicroChip SAMD21 SAMD51, the Raspberry Pi RP2040, the Nordic nRF52840, and the Espressif ESP32-S2 and ESP32-S3.

All of these chips have something in common - they are _microcontrollers_ with hardware peripherals like SPI, I2C, ADCs etc. We squeeze Python into 'em and can then make the project portable.

But...sometimes you want to do more than a microcontroller can do. Like HDMI video output, or camera capture, or serving up a website, or just something that takes more memory and computing than a microcontroller board can do...

## CircuitPython Libraries on Desktop Linux

By adding a software layer, you can use CircuitPython hardware control capabilities&nbsp;with "regular Python", as found on your desktop or single-board Linux computer/ There are tons of projects, libraries and example code for CircuitPython on microcontrollers, and thanks to the flexibility and power of Python its' pretty easy to get that code working on micro-computers like the Raspberry Pi or other single-board Linux computers with GPIO pins available.

You'll use a special library called&nbsp;[**adafruit\_blinka**](https://pypi.org/project/Adafruit-Blinka/)&nbsp;([named after Blinka, the CircuitPython mascot](https://www.adafruit.com/?q=blinka)) that provides a layer that translates the CircuitPython hardware API to whatever library the Linux board provides. For example, on Raspberry Pi we use the python&nbsp;[RPi.GPIO](https://pypi.org/project/RPi.GPIO/)&nbsp;library. For any I2C interfacing we'll use ioctl messages to the&nbsp;`/dev/i2c`&nbsp;device. For SPI we'll use the&nbsp;`spidev`&nbsp;python library, etc. These details don't matter so much because they all happen underneath the&nbsp; **adafruit\_blinka** &nbsp;layer.

The upshot is that most code we write for CircuitPython will be instantly and easily runnable on Linux computers like Raspberry Pi.

_In particular_, you'll be able to use all of our device drivers - the sensors, led controllers, motor drivers, HATs, bonnets, etc. And nearly all of these use I2C or SPI!

The rest of this guide describes how to install and set up Blinka, and then how to use it to run CircuitPython code to control hardware.

# CircuitPython Libraries on Linux and the NVIDIA Jetson Nano

## Running CircuitPython Code without CircuitPython

There are two parts to the CircuitPython ecosystem:

- **CircuitPython firmware** , written in C and built to run on various microcontroller boards (not PCs). The firmware includes the CircuitPython interpreter, which reads and executes CircuitPython programs, and chip-specific code that controls the hardware peripherals on the microcontroller, including things like USB, I2C, SPI, GPIO pins, and all the rest of the hardware features the chip provides.
- **CircuitPython libraries,** written in Python to use the native (built into the firmware) modules provided by CircuitPython to control the microcontroller peripherals and interact with various breakout boards.

But suppose you'd like to use CircuitPython **libraries** on a board or computer that does not have a native CircuitPython **firmware** build. For example, on a PC running Windows or macOS. Can that be done? The answer is yes, via a separate piece of software called **Blinka**. Details about Blinka follow, however it is important to realize that the **CircuitPython firmware is never used**.

Info: 

# Adafruit Blinka: a CircuitPython Compatibility Library

Enter **Adafruit**  **Blinka**. Blinka is a software library that emulates the parts of CircuitPython that control hardware. Blinka provides non-CircuitPython implementations for `board`, `busio`, `digitalio`, and other native CircuitPython modules. You can then write Python code that looks like CircuitPython and uses CircuitPython libraries, without having CircuitPython underneath.

There are multiple ways to use Blinka:&nbsp;

- Linux based Single Board Computers, for example a Raspberry Pi
- Desktop Computers + specialized USB adapters
- Boards running MicroPython

More details on these options follow.

## Raspberry Pi and Other Single-Board Linux Computers

On a Raspberry Pi or other single-board Linux computer, you can use Blinka with the regular version of Python supplied with the Linux distribution. Blinka can control the hardware pins these boards provide.

## Desktop Computers&nbsp;

On Windows, macOS, or Linux desktop or laptop ("host") computers, you can use special USB adapter boards that that provide hardware pins you can control. These boards include [MCP221A](https://learn.adafruit.com/circuitpython-libraries-on-any-computer-with-mcp2221)&nbsp;and [FT232H](https://learn.adafruit.com/adafruit-ft232h-breakout) breakout boards, and [Raspberry Pi Pico boards running the **u2if** software](https://learn.adafruit.com/circuitpython-libraries-on-any-computer-with-raspberry-pi-pico). These boards connect via regular USB to your host computer, and let you do GPIO, I2C, SPI, and other hardware operations.

## MicroPython

You can also use Blinka with MicroPython, on [MicroPython-supported boards](https://learn.adafruit.com/circuitpython-libraries-on-micropython-using-the-raspberry-pi-pico). Blinka will allow you to import and use CircuitPython libraries in your MicroPython program, so you don't have to rewrite libraries into native MicroPython code. Fun fact - this is actually the original use case for Blinka.

# Installing Blinka

Installing Blinka on your particular platform is covered elsewhere in this guide. The process is different for each platform. Follow the guide section specific to your platform and make sure Blinka is properly installed before attempting to install any libraries.

Info: 

# Installing CircuitPython Libraries

Once Blinka is installed the next step is to install the CircuitPython libraries of interest. How this is down is different for each platform. Here are the details.

## Linux Single-Board Computers

On Linux single-board computers, such as Raspberry Pi, you'll use the Python `pip3`&nbsp;program (sometimes named just `pip`) to install a library. The library will be downloaded from [pypi.org](https://pypi.org) automatically by `pip3`.

How to install a particular library using `pip3` is covered in the guide page for that library. For example, [here is the `pip3` installation information](https://learn.adafruit.com/adafruit-lis3dh-triple-axis-accelerometer-breakout/python-circuitpython#python-installation-of-lis3dh-library-2997958) for the library for the LIS3DH accelerometer.

The library name you give to `pip3` is usually of the form `adafruit-circuitpython-libraryname`. This is not the name you use with `import`. For example, the LIS3DH sensor library is known by several names:

- The GitHub library repository is [Adafruit\_CircuitPython\_LIS3DH](https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH).
- When you import the library, you write `import adafruit_lis3dh`.
- The name you use with `pip3` is `adafruit-circuitpython-lis3dh`. This the name used on [pypi.org](https://pypi.org).

Libraries often depend on other libraries. When you install a library with `pip3`, it will automatically install other needed libraries.

## Desktop Computers using a USB Adapter

When you use a desktop computer with a USB adapter, like the MCP2221A, FT232H, or u2if firmware on an RP2040, you will also use pip3. However, **do _not_ install the library with `sudo pip3`** , as mentioned in some guides. Instead, just install with `pip3`.&nbsp;

## MicroPython

For MicroPython, you will not use `pip3`. Instead you can get the library from the CircuitPython bundles. See [this guide page](https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries) for more information about the bundles, and also see the [Libraries page on circuitPython.org](https://circuitpython.org/libraries).

# CircuitPython Libraries on Linux and the NVIDIA Jetson Nano

## CircuitPython & Jetson Nano

![](https://cdn-learn.adafruit.com/assets/assets/000/080/712/medium800/sensors_blinkapi.png?1568074009)

## CircuitPython Libraries on Linux & NVIDIA Jetson Nano

The next obvious step is to bring CircuitPython ease of use **back** to 'desktop Python'. We've got tons of projects, libraries and example code for CircuitPython on microcontrollers, and thanks to the flexibility and power of Python its pretty easy to get it working with microcomputers like the Jetson Nano or other 'Linux with GPIO pins available' single board computers.

We'll use a special library called [**adafruit\_blinka**](https://pypi.org/project/Adafruit-Blinka/) ([named after Blinka, the CircuitPython mascot](https://www.adafruit.com/?q=blinka)) to provide the layer that translates the CircuitPython hardware API to whatever library the Linux board provides. For example, on the Jetson Nano we use the python **libgpiod** bindings. For any I2C interfacing we'll use ioctl messages to the `/dev/i2c` device. These details don't matter so much because they all happen underneath the **adafruit\_blinka** layer.

The upshot is that any code we have for CircuitPython will be instantly and easily runnable on Linux computers like the Jetson Nano.

_In particular_, we'll be able to use all of our device drivers - the sensors, led controllers, motor drivers, HATs, bonnets, etc. And nearly all of these use I2C or SPI!

## Wait, isn't there already something that does this - Jetson.GPIO?

[Jetson.GPIO is a pure python hardware interface class](https://github.com/NVIDIA/jetson-gpio) for the Jetson Nano. It works just fine for I2C, SPI and GPIO but doesn't work with our drivers as it's a different API

By letting you use CircuitPython libraries on the Jetson Nano via **adafruit\_blinka** , you can unlock all of the drivers and example code we wrote! _And_ you can keep using&nbsp; **Jetson.GPIO** if you like. We save time and effort so we can focus on getting code that works in one place, and you get to reuse all the code we've written already.

## What about other Linux SBCs?

Yep! Blinka can easily be updated to add other boards. We've started with the ones we've got, so we could test them thoroughly. If you have other SBC board you'd like to adapt [check out the adafruit\_blinka code on github](https://github.com/adafruit/Adafruit_Blinka), pull requests are welcome as there's a _ton_ of different Linux boards out there!

# CircuitPython Libraries on Linux and the NVIDIA Jetson Nano

## Initial Setup

Primary: 

## Install Jetson Nano Developer Kit on your Jetson Nano

We decided to try getting Blinka running in the Jetson Nano Developer Kit because that's the recommended installation available for the Jetson Nano. Other distros could be made to work but you'd probably need to figure out how to detect the platform.&nbsp;Using other operating systems and CircuitPython is your call, we cannot provide support for that.

Due to the size of the Dev Kit Image, you will need at least a minimum of a 16GB SD card.

Download and install the latest Jetson Nano Developer Kit, for example we're using&nbsp;[https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit#write](https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit#write)

There's some documentation to get started at&nbsp;[https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit](https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit)

Info: 

## Preparing the Board
Danger: 

### Wireless Keyboard and Mouse Combo - One USB Port!

[Wireless Keyboard and Mouse Combo - One USB Port!](https://www.adafruit.com/product/1738)
Add a good quality, slim chiclet keyboard as well as an optical mouse to your Raspberry Pi, Beagle Bone Black or other mini-computer with this wireless combo set. **Best of all, it only uses a single USB port!** This combo comes with a sleek black chiclet keyboard and mouse both...

In Stock
[Buy Now](https://www.adafruit.com/product/1738)
[Related Guides to the Product](https://learn.adafruit.com/products/1738/guides)
![Angled Shot of the Black Wireless Keyboard and Mouse Combo with One USB Port!](https://cdn-shop.adafruit.com/640x480/1738-12.jpg)

After you burn the image to the SD card, you'll need to install it into the Nano. The card slot is located on the underside of the large heatsink.

![sensors_sd_card.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/080/723/medium640/sensors_sd_card.jpeg?1568078408)

Connect a monitor (HDMI or DisplayPort), USB mouse, and keyboard to continue. An End User License Agreement will need to be accepted before you can continue.

![sensors_eula.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/080/736/medium640/sensors_eula.jpeg?1568132061)

As you go through the configuration wizard, take note of the fields **your name** and&nbsp; **your computer's name**. These will be your **username** and **hostname** for connecting by SSH.

![sensors_hostname.jpg](https://cdn-learn.adafruit.com/assets/assets/000/080/740/medium640/sensors_hostname.jpg?1568132933)

## Logging in
Once you have completed the wizard, you can either continue using that, connect a serial console cable, or log in through SSH. We've found the easiest way to connect is through a console cable, wired to the J44 connector and then on your computer, use a serial monitor at 115200 baud.

You can also connect via **SSH** using either the command prompt on a Mac or Linux computer or using a terminal program such as **PuTTY** on Windows. In either case, you will need your **username** and **hostname** from earlier in the setup wizard.

You may need to **reboot** the Jetson Nano after completing the wizard before the device will show up on your network.

### USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi

[USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi](https://www.adafruit.com/product/954)
The cable is easiest way ever to connect to your microcontroller/Raspberry Pi/WiFi router serial console port. Inside the big USB plug is a USB\<-\>Serial conversion chip and at the end of the 36" cable are four wire - red power, black ground, white RX into USB port, and green TX out...

In Stock
[Buy Now](https://www.adafruit.com/product/954)
[Related Guides to the Product](https://learn.adafruit.com/products/954/guides)
![USB to TTL Serial Cable With Type A plug and 4 wire sockets](https://cdn-shop.adafruit.com/640x480/954-02.jpg)

Connect the RX, TX and ground wires of the console cable like so:

![](https://cdn-learn.adafruit.com/assets/assets/000/080/741/medium800/sensors_serial_cable.jpeg?1568134927)

Once powered correctly and with the right SD card you should get a command prompt as the username you selected in the configuration wizard. You may need to press enter if it appears to stop.

![sensors_login_screen.png](https://cdn-learn.adafruit.com/assets/assets/000/080/743/medium640/sensors_login_screen.png?1568135085)

Log in to get to a shell. In this guide, we will be using the user `pi` just to keep things consistent with other guides. Change the commands to use whatever username you ended up using.

![](https://cdn-learn.adafruit.com/assets/assets/000/080/744/medium800/sensors_command_prompt.png?1568135686)

## Set your Python install to Python 3 Default

There's a few ways to do this, we recommend something like this:

```terminal
sudo apt install -y python3 git python3-pip
sudo update-alternatives --install /usr/bin/python python $(which python2) 1
sudo update-alternatives --install /usr/bin/python python $(which python3) 2
sudo update-alternatives --config python
```

## Install Python 3.8 and Make Default

You can install Python 3.8, but it won't be the default Python. However, you can do something like above:

```terminal
sudo apt install -y python3.8
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
sudo update-alternatives --config python3
```

Now run `python --version` and it should show some version of Python 3.8:

![](https://cdn-learn.adafruit.com/assets/assets/000/128/828/medium800/python3.8-default.png?1711064735)

## Update Your Board and Python

Run the standard updates:

`sudo apt update`

`sudo apt upgrade`

and

`sudo pip3 install --upgrade setuptools`

Update all your Python 3 packages with

`pip3 freeze - local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U`

and

`sudo bash`

` pip3 freeze - local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U`

**Nano** (no relationship to the board), which is very handy for quickly editing python scripts, isn't installed by default. So let's add that:

`sudo apt install nano`

## Enable UART, I2C and SPI

A vast number of our CircuitPython drivers use UART, I2C and SPI for interfacing, so you'll want to get those enabled.

I2C and UART are enabled by default, so you don't need to take any additional steps.

To enable SPI, you will need to run the Jetson-IO utility. Be sure your terminal window is expanded first, or it may not display the full utility:

`sudo /opt/nvidia/jetson-io/jetson-io.py`

Select **Configure 40-pin expansion header** at the bottom. Then select **Configure header pins manually**.

![python_jetson-io.png](https://cdn-learn.adafruit.com/assets/assets/000/095/202/medium640/python_jetson-io.png?1601395938)

Select **spi1 (19, 21, 23, 24, 26)** and then select **Back**

![python_jetson-io-spi1.png](https://cdn-learn.adafruit.com/assets/assets/000/095/200/medium640/python_jetson-io-spi1.png?1601395957)

Finally select **Save pin changes** &nbsp;and then **Save and reboot to reconfigure pins**. This will create a config file and reboot the Jetson Nano.

![python_jetson-io-save-and-reboot.png](https://cdn-learn.adafruit.com/assets/assets/000/095/203/medium640/python_jetson-io-save-and-reboot.png?1601396036)

![python_jetson-io-create-file.png](https://cdn-learn.adafruit.com/assets/assets/000/095/205/medium640/python_jetson-io-create-file.png?1601396292)

After the Nano boots up again, verify you have the I2C devices with the command `ls /dev/i2c* /dev/spi*`

You should see at least one I2C device and one SPI device

![](https://cdn-learn.adafruit.com/assets/assets/000/095/207/medium800/python_i2c_ports.png?1601396512)

![](https://cdn-learn.adafruit.com/assets/assets/000/080/762/medium800/sensors_i2c_devices.png?1568144461)

You can test to see what I2C addresses are connected by running&nbsp;`sudo i2cdetect -r -y 0`(on **pins 27/28** ) or&nbsp;`sudo i2cdetect -r -y 1`&nbsp;(on&nbsp; **pins 3/5** )

In this case I do have a sensor on the 'standard' i2c port i2c-1 under address 0x77

![sensors_i2c_addresses.png](https://cdn-learn.adafruit.com/assets/assets/000/080/763/medium640/sensors_i2c_addresses.png?1568144525)

The UART Serial Console on the Jetson Nano is connected to **/dev/ttyS0**. The UART GPIO Serial Port is connected to **/dev/ttyTHS1**.

## Set User Permissions
Warning: 

In order to use the Jetson GPIO Library, the correct user permissions/groups must be set first. Start by creating a new **gpio** user group.

`sudo groupadd -f -r gpio`  
`sudo usermod -a -G gpio pi`

Clone the Repo and copy the rules

`cd ~`  
`git clone https://github.com/NVIDIA/jetson-gpio.git`  
`sudo cp ~/jetson-gpio/lib/python/Jetson/GPIO/99-gpio.rules /etc/udev/rules.d`

Now **reboot** so that the new rules take place.

## Install Python Libraries

Now you're ready to install all the Python support.

Next, run the following command to install **adafruit\_blinka** :

`pip3 install adafruit-blinka```

![](https://cdn-learn.adafruit.com/assets/assets/000/080/760/medium800/sensors_blinka_install.png?1568143622)

The computer will install a few different libraries such as `Adafruit-PureIO` (our ioctl-only i2c library),&nbsp; `Jetson.GPIO` (for handling GPIO), `Adafruit-PlatformDetect` (for detecting your board)&nbsp;and of course `adafruit-blinka`.

That's pretty much it! You're now ready to test.

Create a new file called **blinkatest.py** with **nano** or your favorite text editor and put the following in:

```
import board
import digitalio
import busio

print("Hello blinka!")

# Try to great a Digital input
pin = digitalio.DigitalInOut(board.D4)
print("Digital IO ok!")

# Try to create an I2C device
i2c = busio.I2C(board.SCL, board.SDA)
print("I2C 1 ok!")
i2c = busio.I2C(board.SCL_1, board.SDA_1)
print("I2C 2 ok!")

print("done!")
```

Save it and run at the command line with

`python3 blinkatest.py`

You should see the following, indicating digital i/o, I2C and SPI all worked

![](https://cdn-learn.adafruit.com/assets/assets/000/080/803/medium800/sensors_blinkatest.png?1568162425)

# CircuitPython Libraries on Linux and the NVIDIA Jetson Nano

## Digital I/O

The first step with any new hardware is the 'hello world' of electronics - blinking an LED. This is very easy with CircuitPython and Jetson Nano. We'll extend the example to also show how to wire up a button/switch.

Warning: 

![](https://cdn-learn.adafruit.com/assets/assets/000/080/774/medium800/sensors_JetsonNano-expansion-pinout.png?1568149711)

Info: 

## Parts Used

Any old LED will work just fine as long as it's not an IR LED (you can't see those) and a 220 to 2.2K resistor

### Diffused Blue 10mm LED (25 pack)

[Diffused Blue 10mm LED (25 pack)](https://www.adafruit.com/product/847)
Need some big indicators? We are big fans of these huge diffused blue LEDs. They are really bright so they can be seen in daytime, and from any angle. They go easily into a breadboard and will add that extra zing to your project.

- Pack of 25 diffused blue LEDs
- 10mm...

In Stock
[Buy Now](https://www.adafruit.com/product/847)
[Related Guides to the Product](https://learn.adafruit.com/products/847/guides)
![Single large LED lit up blue](https://cdn-shop.adafruit.com/640x480/847-00.jpg)

### Through-Hole Resistors - 220 ohm 5% 1/4W - Pack of 25

[Through-Hole Resistors - 220 ohm 5% 1/4W - Pack of 25](https://www.adafruit.com/product/2780)
ΩMG! You're not going to be able to resist these handy resistor packs!&nbsp;Well, axially, they&nbsp;do all of the resisting for you!

This is a **25 Pack of 220Ω Resistors.** More specifically, they are **carbon film** , through-hole...

In Stock
[Buy Now](https://www.adafruit.com/product/2780)
[Related Guides to the Product](https://learn.adafruit.com/products/2780/guides)
![Angled shot of 25 Through-Hole Resistors - 220 ohm 5% 1/4W.](https://cdn-shop.adafruit.com/640x480/2780-00.jpg)

Some tactile buttons or switches along with some pull-up resistors:

### Tactile Switch Buttons (12mm square, 6mm tall) x 10 pack

[Tactile Switch Buttons (12mm square, 6mm tall) x 10 pack](https://www.adafruit.com/product/1119)
Medium-sized clicky momentary switches are standard input "buttons" on electronic projects. These work best in a PCB but [can be used on a solderless breadboard as shown in this tutorial](https://learn.adafruit.com/adafruit-arduino-lesson-6-digital-inputs?view=all). The...

In Stock
[Buy Now](https://www.adafruit.com/product/1119)
[Related Guides to the Product](https://learn.adafruit.com/products/1119/guides)
![Angled shot of 10 12mm square tactile switch buttons.](https://cdn-shop.adafruit.com/640x480/1119-03.jpg)

### Through-Hole Resistors - 1.0K ohm 5% 1/4W - Pack of 25

[Through-Hole Resistors - 1.0K ohm 5% 1/4W - Pack of 25](https://www.adafruit.com/product/4294)
ΩMG! You're not going to be able to resist these handy resistor packs!&nbsp;Well, axially, they&nbsp;do all of the resisting for you!

This is a **25 Pack of 1.0KΩ Resistors.** More specifically, they are **carbon film** , through-hole...

In Stock
[Buy Now](https://www.adafruit.com/product/4294)
[Related Guides to the Product](https://learn.adafruit.com/products/4294/guides)
![Angled shot of 25 Through-Hole Resistors - 1.0K ohm 5% 1/4W.](https://cdn-shop.adafruit.com/640x480/4294-00.jpg)

We recommend using a breadboard and some male-male wires.

### Premium Male/Male Jumper Wires - 40 x 6" (150mm)

[Premium Male/Male Jumper Wires - 40 x 6" (150mm)](https://www.adafruit.com/product/758)
Handy for making wire harnesses or jumpering between headers on PCB's. These premium jumper wires are 6" (150mm) long and come in a 'strip' of 40 (4 pieces of each of ten rainbow colors). They have 0.1" male header contacts on either end and fit cleanly next to each other...

In Stock
[Buy Now](https://www.adafruit.com/product/758)
[Related Guides to the Product](https://learn.adafruit.com/products/758/guides)
![Angled shot of Premium Male/Male Jumper Wires - 40 x 6 (150mm)](https://cdn-shop.adafruit.com/640x480/758-04.jpg)

### Half Sized Premium Breadboard - 400 Tie Points

[Half Sized Premium Breadboard - 400 Tie Points](https://www.adafruit.com/product/64)
This is a cute, half-size breadboard with&nbsp;400 tie points, good for small projects. It's 3.25" x 2.2" / 8.3cm&nbsp;x 5.5cm&nbsp;with a standard double-strip in the middle and two power rails on both sides.&nbsp;You can pull the power rails off easily to make the breadboard as...

Out of Stock
[Buy Now](https://www.adafruit.com/product/64)
[Related Guides to the Product](https://learn.adafruit.com/products/64/guides)
![Angled shot of half-size solderless breadboard with red and black power lines.](https://cdn-shop.adafruit.com/640x480/64-06.jpg)

## Wiring

- Connect the Jetson Nano Ground&nbsp;pin to the&nbsp;blue ground rail&nbsp;on the breadboard.
- Connect one side of the tactile switch to Jetson Nano **D4** (#7)
- Connect a ~1K-10K pull up resistor from&nbsp; **D4** &nbsp;to&nbsp; **3.3V**
- Connect the other side of the tactile switch to the&nbsp; **ground** &nbsp;rail
- Connect the longer/positive pin of the LED to&nbsp;Jetson Nano **D18** (#12)
- Connect the shorter/negative pin of the LED to a 220 ohm-2.2K resistor, the other side of the resistor goes to&nbsp; **ground** &nbsp;rail

There's no Jetson Nano Fritzing object, so we sub'd a Raspberry Pi in

![](https://cdn-learn.adafruit.com/assets/assets/000/080/805/medium800/sensors_digital_connections.jpeg?1568163876)

Double-check you have the right wires connected to the right location, it can be tough to keep track of GPIO pins as there are forty of them!

No additional libraries are needed so we can go straight on to the example code

However, we recommend running a pip3 update!

`sudo pip3 install --upgrade adafruit_blinka`

## Blinky Time!

The finish line is right up ahead, let's start with an example that blinks the LED on and off once a second (half a second on, half a second off):

```
    import time
import board
import digitalio

print("hello blinky!")

led = digitalio.DigitalInOut(board.D18)
led.direction = digitalio.Direction.OUTPUT

while True:
    led.value = True
    time.sleep(0.5)
    led.value = False
    time.sleep(0.5)
  
```

Verify the LED is blinking. If not, check that the resistor is installed correctly, and you have Ground and +3.3v wires to the Jetson Nano. Also, check that the wires are going to the correct GPIO pins. If you are powering the board with an AC adapter, try powering it through the USB port.

Type Control-C to quit

## Button It Up

Now that you have the LED working, let's add code so the LED turns on whenever the button is pressed:

```
import time
import board
import digitalio

print("press the button!")

led = digitalio.DigitalInOut(board.D18)
led.direction = digitalio.Direction.OUTPUT

button = digitalio.DigitalInOut(board.D4)
button.direction = digitalio.Direction.INPUT
# use an external pullup since we don't have internal PU's
#button.pull = digitalio.Pull.UP

while True:
    led.value = not button.value # light when button is pressed!
```

Press the button - see that the LED lights up!

Type **Control-C** to quit

# CircuitPython Libraries on Linux and the NVIDIA Jetson Nano

## I2C Sensors & Devices

The most popular electronic sensors use _I2C_ to communicate. This is a 'shared bus' 2 wire protocol, you can have multiple sensors connected to the two SDA and SCL pins as long as they have unique addresses ([check this guide for a list of many popular devices and their addresses](https://learn.adafruit.com/i2c-addresses))

Lets show how to wire up a popular BME280. This sensor provides temperature, barometric pressure and humidity data over I2C

We're going to do this in a lot more depth than our guide pages for each sensor, but the overall technique is basically identical for any and all I2C sensors.

Honestly, the hardest part of using I2C devices is [figuring out the I2C address](https://learn.adafruit.com/i2c-addresses) and which pin is SDA and which pin is SCL!

## Parts Used
### Adafruit BME280 I2C or SPI Temperature Humidity Pressure Sensor

[Adafruit BME280 I2C or SPI Temperature Humidity Pressure Sensor](https://www.adafruit.com/product/2652)
Bosch has stepped up their game with their new BME280 sensor, an environmental sensor with temperature, barometric pressure&nbsp;and&nbsp;humidity! This sensor is great for all sorts of indoor environmental sensing and can even be used in both I2C and SPI!

This precision sensor from...

In Stock
[Buy Now](https://www.adafruit.com/product/2652)
[Related Guides to the Product](https://learn.adafruit.com/products/2652/guides)
![small, rectangle-shaped, BME280 temperature humidity pressure sensor breakout board.](https://cdn-shop.adafruit.com/640x480/2652-04.jpg)

We recommend using a breadboard and some male-male wires.

### Premium Male/Male Jumper Wires - 40 x 6" (150mm)

[Premium Male/Male Jumper Wires - 40 x 6" (150mm)](https://www.adafruit.com/product/758)
Handy for making wire harnesses or jumpering between headers on PCB's. These premium jumper wires are 6" (150mm) long and come in a 'strip' of 40 (4 pieces of each of ten rainbow colors). They have 0.1" male header contacts on either end and fit cleanly next to each other...

In Stock
[Buy Now](https://www.adafruit.com/product/758)
[Related Guides to the Product](https://learn.adafruit.com/products/758/guides)
![Angled shot of Premium Male/Male Jumper Wires - 40 x 6 (150mm)](https://cdn-shop.adafruit.com/640x480/758-04.jpg)

### Half Sized Premium Breadboard - 400 Tie Points

[Half Sized Premium Breadboard - 400 Tie Points](https://www.adafruit.com/product/64)
This is a cute, half-size breadboard with&nbsp;400 tie points, good for small projects. It's 3.25" x 2.2" / 8.3cm&nbsp;x 5.5cm&nbsp;with a standard double-strip in the middle and two power rails on both sides.&nbsp;You can pull the power rails off easily to make the breadboard as...

Out of Stock
[Buy Now](https://www.adafruit.com/product/64)
[Related Guides to the Product](https://learn.adafruit.com/products/64/guides)
![Angled shot of half-size solderless breadboard with red and black power lines.](https://cdn-shop.adafruit.com/640x480/64-06.jpg)

## Wiring

- Connect the Jetson Nano&nbsp; **3.3V** power pin to **Vin**
- Connect the&nbsp;Jetson Nano **GND** pin to **GND**
- Connect the Jetson Nano&nbsp; **SDA** (#3) pin to the BME280 **SDI**
- Connect the Jetson Nano&nbsp; **SCL** (#5) pin to to the BME280 **SCK**

![](https://cdn-learn.adafruit.com/assets/assets/000/080/806/medium800/sensors_i2c_connections.jpeg?1568163920)

Double-check you have the right wires connected to the right location, it can be tough to keep track of header pins as there are forty of them!

After wiring, we recommend running I2C detection with `i2cdetect -r -y 1`&nbsp;to verify that you see the device, in this case its address&nbsp; **77**

![](https://cdn-learn.adafruit.com/assets/assets/000/095/237/medium800/python_i2c_detect.png?1601413283)

## Install the CircuitPython BME280 Library

OK onto the good stuff, you can now install the Adafruit BME280 CircuitPython library.

As of this writing, not&nbsp;_all_&nbsp;libraries are up on PyPI so you may want to search before trying to install. Look for&nbsp; **circuitpython** &nbsp;and then the driver you want.

![](https://cdn-learn.adafruit.com/assets/assets/000/076/929/medium800/linux_sensors_search.png?1560290687)

(If you don't see it&nbsp;[you can open up a github issue on circuitpython to remind us](https://github.com/adafruit/circuitpython)!)

Once you know the name, install it with

`pip3 install adafruit-circuitpython-bme280`

![](https://cdn-learn.adafruit.com/assets/assets/000/095/238/medium800/python_bme280-install.png?1601413300)

You'll notice we also installed a few other _dependancies_ called **spidev** , **adafruit-pureio** , **adafruit-circuitpython-busdevice** and more. This is a great thing about pip, if you have other required libraries they'll get installed too!

We also recommend an adafruit-blinka update in case we've fixed bugs:

`pip3 install --upgrade adafruit_blinka`

## Run that code!

The finish line is right up ahead. You can now run one of the (many in some cases) example scripts we've written for you.

Check out the examples for your library by visiting the repository for the library and looking in the example folder. In this case, it would be [https://github.com/adafruit/Adafruit\_CircuitPython\_BME280/tree/master/examples](https://github.com/adafruit/Adafruit_CircuitPython_BME280/tree/master/examples)

As of this writing there's only two examples. Here's the first one:

https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/main/examples/bme280_simpletest.py

Save this code to your Jetson Nano by copying and pasting it into a text file, downloading it directly from the Jetson Nano, etc.

Then in your command line run

`python3 bme280_simpletest.py`

![](https://cdn-learn.adafruit.com/assets/assets/000/095/239/medium800/python_bme280_simpletest.png?1601413396)

The code will loop with the sensor data until you quit with a Control-C

Here's the second example:

https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/main/examples/bme280_normal_mode.py

Save this code to your Jetson Nano by copying and pasting it into a text file, downloading it directly from the Jetson Nano, etc.

Then in your command line run

`python3 bme280_normal_mode.py`

![](https://cdn-learn.adafruit.com/assets/assets/000/095/240/medium800/python_bme280_normalmode.png?1601413531)

The code will loop with the sensor data until you quit with a Control-C

That's it! Now if you want to read the documentation on the library, what each function does in depth, visit our readthedocs documentation at

[https://circuitpython.readthedocs.io/projects/bme280/en/latest/](https://circuitpython.readthedocs.io/projects/bme280/en/latest/)

# CircuitPython Libraries on Linux and the NVIDIA Jetson Nano

## SPI Sensors & Devices

SPI is less popular than I2C, but still you'll see lots of sensors and chips use it. Unlike I2C, you don't have everything share two wires. Instead, there's three shared wires ( **clock** , **data in** , **data out** ) and then a unique **chip select** &nbsp;line for each chip.

The nice thing about SPI is you can have as many chips as you like, even the same kind, all share the three SPI wires, as long as each one has a unique chip select pin.

The formal/technical names for the 4 pins used are:

- SPI clock - called **SCLK** , **SCK** or **CLK**
- SPI data out - called **MOSI** for **M** icrocomputer&nbsp; **O** ut **S** erial&nbsp; **I** n. This is the wire that takes data _from_ the Linux computer _to_ the sensor/chip. Sometimes marked **SDI** or **DI** on chips
- SPI data in - called **MISO** for **M** icrocomputer **I** n **S** erial&nbsp; **O** ut. This is the wire that takes data _to_ the Linux computer _from_ the sensor/chip. Sometimes marked **SDO** or **DO** on chips
- SPI chip select - called **CS** or **CE**

Remember, connect all SCK, MOSI and MISO pins together (unless there's some specific reason/instruction not to) and a unique CS pin for each device.

Warning: 

SPI on microcontrollers is fairly simple, you have an SPI peripheral and you can transfer data on it with some low level command. Its 'your job' as a programmer to control the CS lines with a GPIO. That's how CircuitPython is structured as well. `busio` does just the SPI transmit/receive part and `busdevice` handles the chip select pin as well.

Linux, on the other hand, doesn't let you send data to SPI without a CS line, and the CS lines are fixed in hardware as well. For example, on the Jetson Nano there are only two CS pins available for use as hardware SPI pins - **CE0** and **CE1** - and you _have_ to use them. (In theory there's an ioctl option called `no_cs` but this does not actually work)

The upshot here is to let you use more than 2 peripherals on SPI, we decided to **let you use any CS pins** you like, CircuitPython will toggle it the way you expect. But when we transfer SPI data, we always tell the kernel to use **CE0**. CE0 will toggle like a CS pin, but if we leave it disconnected, it's no big deal

**The downside here is basically never connect anything to CE0** (or **CE1** for that matter). Use whatever chip select pin you define in CircuitPython and just leave the **CE** pins alone, it will toggle as if it is the chip select line, completely on its own, so you shouldn't try to use it as a digital input/output/whatever.

Warning: 

## Using the Second SPI Port

The Jetson Nano has a 'main' SPI port, but not a lot of people know there's a second one too! This is handy if you are using the main SPI port for a PiTFT or other kernel-driven device. You can enable the second SPI port by using the Jetson-IO utility and also selecting spi2. See the **Initial Setup Page** for more details.

Here's the wiring for SPI #2:

- **SCK\_1** on GPIO #27 (Pin 13)
- **MOSI\_1** on GPIO #26 (Pin 37)
- **MISO\_1** on GPIO #25 (Pin 22)
- SPI #2 **CS0** on GPIO #24 (Pin 18)
- SPI #2 **CS1** on GPIO #23 (Pin 16)

Like the main SPI, we'll use CE0 as our default but don't connect to it! Use any other pin and leave that one unused. Then update your scripts to use

`spi = busio.SPI(board.SCK_1, MOSI=board.MOSI_1, MISO=board.MISO_1)`

## Testing SPI with FRAM

OK now that we've gone thru the warning, let's wire up an SPI FRAM Memory breakout. This will allow us to test both reading&nbsp; and writing.

### Parts Used
### Adafruit SPI Non-Volatile FRAM Breakout - 64Kbit / 8KByte

[Adafruit SPI Non-Volatile FRAM Breakout - 64Kbit / 8KByte](https://www.adafruit.com/product/1897)
FRAM, or [Ferroelectric Ram,](http://en.wikipedia.org/wiki/Ferroelectric_RAM) is the coolest new data storage method that all the fashion magazines are talking about. Oh wait, no that's quilted handbags. But FRAM is pretty damn cool too! It's similar to <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/1897)
[Related Guides to the Product](https://learn.adafruit.com/products/1897/guides)
![Angled shot of blue, rectangular FRAM breakout board.](https://cdn-shop.adafruit.com/640x480/1897-03.jpg)

We recommend using a breadboard and some female-male wires.

### Premium Female/Male 'Extension' Jumper Wires - 40 x 6" (150mm)

[Premium Female/Male 'Extension' Jumper Wires - 40 x 6" (150mm)](https://www.adafruit.com/product/826)
Handy for making wire harnesses or jumpering between headers on PCB's. These premium jumper wires are 6" (150mm) long and come in a 'strip' of 40 (4 pieces of each of ten rainbow colors). They have 0.1" male header contacts on one end and 0.1" female header contacts...

In Stock
[Buy Now](https://www.adafruit.com/product/826)
[Related Guides to the Product](https://learn.adafruit.com/products/826/guides)
![Angled shot of Premium Female/Male 'Extension' Jumper Wires - 40 x 6 (150mm)](https://cdn-shop.adafruit.com/640x480/826-04.jpg)

You can use a Cobbler to make this a little easier, the pins are then labeled!

### Assembled Pi T-Cobbler Plus - GPIO Breakout

[Assembled Pi T-Cobbler Plus - GPIO Breakout](https://www.adafruit.com/product/2028)
 **This is the assembled version of the Pi T-Cobbler Plus. &nbsp;It only works with the Raspberry Pi Model Zero, A+, B+, Pi 2, Pi 3, Pi 4, and Pi 5!** (Any Pi with 2x20 connector)  
  
The Raspberry Pi has landed on the Maker World like a 40-GPIO pinned, quad-USB ported,...

In Stock
[Buy Now](https://www.adafruit.com/product/2028)
[Related Guides to the Product](https://learn.adafruit.com/products/2028/guides)
![Angled shot of Assembled Pi T-Cobbler Plus next to GPIO ribbon cable](https://cdn-shop.adafruit.com/640x480/2028-07.jpg)

### Wiring
Warning: 

- Connect the Raspberry Pi&nbsp; **3.3V** &nbsp;power pin to&nbsp; **Vin**
- Connect the Raspberry Pi&nbsp; **GND** &nbsp;pin to&nbsp; **GND**
- Connect the Pi&nbsp; **SCLK** &nbsp;pin to the FRAM&nbsp; **SCK**
- Connect the Pi&nbsp; **MISO** &nbsp;pin to to the FRAM **&nbsp;MISO**
- Connect the Pi&nbsp; **MOSI** &nbsp;pin to to the FRAM **&nbsp;MOSI**
- Connect the Pi&nbsp; **GPIO 5** &nbsp;pin to to the FRAM&nbsp; **CS**

![python_jetson-nano-fram-spi_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/095/220/medium640/python_jetson-nano-fram-spi_bb.jpg?1601407548)

[Fritzing Diagram](https://cdn-learn.adafruit.com/assets/assets/000/095/223/original/jetson-nano-fram-spi.fzz?1601408140)
Double-check you have the right wires connected to the right location. It can be tough to keep track of GPIO pins as there are forty of them!

### Install the CircuitPython FRAM Library

OK, onto the good stuff. You can now install the Adafruit FRAM CircuitPython library.

As of this writing, not&nbsp;_all_&nbsp;libraries are up on PyPI so you may want to search before trying to install. Look for&nbsp; **circuitpython** &nbsp;and then the driver you want.

![](https://cdn-learn.adafruit.com/assets/assets/000/095/221/medium800/python_pypi-fram.png?1601407916)

Once you know the name, install it with

`pip3 install adafruit-circuitpython-fram`

![](https://cdn-learn.adafruit.com/assets/assets/000/095/222/medium800/python_pip3-install-fram.png?1601408035)

You'll notice we also installed a few other _dependencies_&nbsp;called **spidev** , **adafruit-pureio** , **adafruit-circuitpython-busdevice** and more. This is a great thing about pip, if you have other required libraries they'll get installed too!

We also recommend an adafruit\_blinka update, in case we've fixed bugs:

`pip3 install --upgrade adafruit_blinka`

### Run that code!

The finish line is right up ahead. You can now run one of the (many in some cases) example scripts we've written for you.

Check out the examples for your library by visiting the repository for the library and looking in the example folder. In this case, it would be [https://github.com/adafruit/Adafruit\_CircuitPython\_FRAM/tree/master/examples](https://github.com/adafruit/Adafruit_CircuitPython_FRAM/tree/master/examples)

As of this writing there's only one example that runs on SPI:

https://github.com/adafruit/Adafruit_CircuitPython_FRAM/blob/main/examples/fram_spi_simpletest.py

Save this code to your Jetson Nano by copying and pasting it into a text file, downloading it directly from the Jetson Nano, etc.

Then in your command line run:

`python3 fram_spi_simpletest.py`

The code will write a **value of 1** to the first address of the FRAM memory and then read it back:

![](https://cdn-learn.adafruit.com/assets/assets/000/095/224/medium800/python_fram-simpletest.png?1601408389)

Feel free to edit the test script and change the value if you want to test it more thoroughly.

Now if you want to read the documentation on the library, what each function does in depth, visit our readthedocs documentation at:

[https://circuitpython.readthedocs.io/projects/fram/en/latest/](https://circuitpython.readthedocs.io/projects/fram/en/latest/)

## Using a TFT

Now that we've done a simple test for reading and writing just a little data, let's test out a TFT which uses much more data, but only uses it one direction. In this example, we're going to use a PiTFT.

### Parts
### Adafruit PiTFT 2.2" HAT Mini Kit - 320x240 2.2" TFT - No Touch

[Adafruit PiTFT 2.2" HAT Mini Kit - 320x240 2.2" TFT - No Touch](https://www.adafruit.com/product/2315)
The cute PiTFT got even more adorable with this little primary display for Raspberry Pi in HAT form! It features a 2.2" display with 320x240 16-bit color pixels. The HAT uses the high-speed SPI interface on the Pi and can use the mini display as a console, X window port, displaying images...

In Stock
[Buy Now](https://www.adafruit.com/product/2315)
[Related Guides to the Product](https://learn.adafruit.com/products/2315/guides)
![Top down view of a Adafruit PiTFT 2.2" HAT Mini Kit with desktop image on the display. ](https://cdn-shop.adafruit.com/640x480/2315-04.jpg)

### Wiring

One of the reasons we wanted to use the PiTFT for this section is because it's so easy since you just press it onto the Jetson Nano's GPIO pins. The 40-pin GPIO header is backwards from a Pi, so the PiTFT just sits off to the side.

![](https://cdn-learn.adafruit.com/assets/assets/000/095/232/medium800/python_PiTFT.jpeg?1601411298)

### Install the CircuitPython RGB Display Library

Just like with the previous example, you'll want to install the RGB Display library. The command to install it is:

`pip3 install adafruit-circuitpython-display`

![](https://cdn-learn.adafruit.com/assets/assets/000/095/233/medium800/python_rgb-display-install.png?1601411437)

If you haven't already updated adafruit\_blinka be sure to do that now:

`pip3 install --upgrade adafruit_blinka`

### Install Pillow

We're going to show you an example that uses Pillow, a popular fork of the Python Imaging Library. First we need to install it:

`sudo apt install python3-pil`

### Run that Code!

You can now run one of the many example scripts for displays that we've written for you.

Check out the examples for your library by visiting the repository for the library and looking in the example folder. In this case, it would be [https://github.com/adafruit/Adafruit\_CircuitPython\_RGB\_Display/tree/master/examples](https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display/tree/master/examples)

We'll just go over one example here as other scripts are covered in other guides. Here's the stats example:

https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display/blob/main/examples/rgb_display_pillow_stats.py

Save this code to your Jetson Nano by copying and pasting it into a text file, downloading it directly from the Jetson Nano, etc.

Then in your command line run:

`python3 rgb_display_pillow_stats.py`

You should see some stats showing up:

![](https://cdn-learn.adafruit.com/assets/assets/000/095/236/medium800/python_PiTFT_stats_example.jpeg?1601412730)

That's it! Now if you want to read the documentation on the library, what each function does in depth, visit our readthedocs documentation at:

[https://circuitpython.readthedocs.io/projects/rgb\_display/en/latest/](https://circuitpython.readthedocs.io/projects/rgb_display/en/latest/)

# CircuitPython Libraries on Linux and the NVIDIA Jetson Nano

## UART / Serial

After I2C and SPI, the third most popular "bus" protocol used is serial (also sometimes referred to as 'UART'). This is a non-shared two-wire protocol with an RX line, a TX line and a fixed baudrate. The most common devices that use UART are GPS units, MIDI interfaces, fingerprint sensors, thermal printers, and a scattering of sensors.

One thing you'll notice fast is that most Linux computers have minimal UARTs, often only 1 hardware port. And that hardware port may be shared with a console.

There are two ways to connect UART / Serial devices to your Jetson Nano. The easy way, and the hard way.

We'll demonstrate wiring up & using an Ultimate GPS with both methods.

### Adafruit Ultimate GPS Breakout - 66 channel w/10 Hz updates

[Adafruit Ultimate GPS Breakout - 66 channel w/10 Hz updates](https://www.adafruit.com/product/746)
We carry a few different GPS modules here in the Adafruit shop, but none that satisfied our every desire - that's why we designed this little GPS breakout board. We believe this is the **Ultimate** GPS module, so we named it that. It's got everything you want and...

In Stock
[Buy Now](https://www.adafruit.com/product/746)
[Related Guides to the Product](https://learn.adafruit.com/products/746/guides)
![Angled shot of GPS module breakout.](https://cdn-shop.adafruit.com/640x480/746-11.jpg)

## The Easy Way - An External USB-Serial Converter

By far the easiest way to add a serial port is to use a USB to serial converter cable or breakout. They're not expensive, and you simply plug it into the USB port. On the other end are wires or pins that provide power, ground, RX, TX and maybe some other control pads or extras.

Here are some options, they have varying chipsets and physical designs but all will do the job. We'll list them in order of recommendation.

The first cable is easy to use and even has little plugs that you can arrange however you like, it contains a CP2102

### USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi

[USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi](https://www.adafruit.com/product/954)
The cable is easiest way ever to connect to your microcontroller/Raspberry Pi/WiFi router serial console port. Inside the big USB plug is a USB\<-\>Serial conversion chip and at the end of the 36" cable are four wire - red power, black ground, white RX into USB port, and green TX out...

In Stock
[Buy Now](https://www.adafruit.com/product/954)
[Related Guides to the Product](https://learn.adafruit.com/products/954/guides)
![USB to TTL Serial Cable With Type A plug and 4 wire sockets](https://cdn-shop.adafruit.com/640x480/954-02.jpg)

The CP2104 Friend is low cost, easy to use, but requires a little soldering, it has an '6-pin FTDI compatible' connector on the end, but all pins are broken out the sides.

Both the FTDI friend and cable use classic FTDI chips, these are more expensive than the CP2104 or PL2303 but sometimes people like them!

### FTDI Friend with Micro USB Port + extras

[FTDI Friend with Micro USB Port + extras](https://www.adafruit.com/product/284)
Long gone are the days of parallel ports and serial ports. Now the USB port reigns supreme! But USB is hard, and you just want to transfer your every-day serial data from a microcontroller to computer. What now? Enter the FTDI Friend!

The FTDI Friend is a tweaked out FTDI FT232RL chip...

In Stock
[Buy Now](https://www.adafruit.com/product/284)
[Related Guides to the Product](https://learn.adafruit.com/products/284/guides)
![Angled shot of blue rectangular FTDI breakout board.](https://cdn-shop.adafruit.com/640x480/284-03.jpg)

### FTDI Serial TTL-232 USB Cable

[FTDI Serial TTL-232 USB Cable](https://www.adafruit.com/product/70)
Just about all electronics use TTL serial for debugging, bootloading, programming, serial output, etc. But it's rare for a computer to have a serial port anymore. This is a USB to TTL serial cable, with a FTDI FT232RL usb/serial chip embedded in the head. It has a 6-pin socket at the end...

Out of Stock
[Buy Now](https://www.adafruit.com/product/70)
[Related Guides to the Product](https://learn.adafruit.com/products/70/guides)
![Coiled FTDI Serial TTL-232 USB Cable. ](https://cdn-shop.adafruit.com/640x480/70-03.jpg)

There is also a GPS module with integrated serial available which works like the GPS breakout connected to the USB to TTL Serial cable.

### Adafruit Ultimate GPS GNSS with USB - 99 channel w/10 Hz updates

[Adafruit Ultimate GPS GNSS with USB - 99 channel w/10 Hz updates](https://www.adafruit.com/product/4279)
The Ultimate GPS module you know and love has a _glow-up_ to let it be easily used with any computer, not just microcontrollers! With the built-in USB-to-Serial converter, you can now plug-n-play the Ultimate GPS into your computer, laptop, embedded Linux computer, and more. Power and...

In Stock
[Buy Now](https://www.adafruit.com/product/4279)
[Related Guides to the Product](https://learn.adafruit.com/products/4279/guides)
![Angled shot of GPS breakout board.](https://cdn-shop.adafruit.com/640x480/4279-05.jpg)

You can wire up the GPS by connecting the following

- **GPS Vin** &nbsp; to **USB**  **5V** or **3V** (red wire on USB console cable)
- **GPS Ground** to **USB Ground** (black wire)
- **GPS RX** to **USB TX** (green wire)
- **GPS TX** to **USB RX** (white wire)

![](https://cdn-learn.adafruit.com/assets/assets/000/076/962/medium800/linux_sensors_usbgps_bb.png?1560366327)

Once the USB adapter is plugged in, you'll need to figure out what the serial port name is. You can figure it out by unplugging-replugging in the USB and then typing `dmesg | tail -10` (or just `dmesg`) and looking for text like this:

![](https://cdn-learn.adafruit.com/assets/assets/000/080/794/medium800/sensors_dmesg.png?1568156376)

At the bottom, you'll see the 'name' of the attached device, in this case its `ttyUSB0`, that means our serial port device is available at `/dev/ttyUSB0`

## The Hard Way - Using Built-in UART
If you don't want to plug in external hardware to the Jetson Nano you&nbsp;_can_&nbsp;use the built in UART on the RX/TX pins. Unlike the Raspberry Pi, the Jetson Nano isn't using the RX/TX pins for a console, those are on a different UART peripheral, so you should be good to go!

You can use the built in UART via&nbsp;`/dev/ttyTHS1`

Wire the GPS as follows:

- Connect the&nbsp;Jetson Nano **+3.3V** pin to the **Vin pin** &nbsp;on the GPS
- Connect the Jetson Nano&nbsp; **Ground** pin to the GPS **Ground pin**
- Connect the&nbsp;Jetson Nano **UART TX** (#8) to the GPS&nbsp; **RX pin**
- Connect the&nbsp;Jetson Nano **UART RX** (#10) to the GPS&nbsp; **TX pin**

![](https://cdn-learn.adafruit.com/assets/assets/000/080/807/medium800/sensors_uart_connections.jpeg?1568163958)

## Install the CircuitPython GPS Library

OK onto the good stuff, you can now install the Adafruit GPS CircuitPython library.

As of this writing, not _all_ libraries are up on PyPI so you may want to search before trying to install. Look for **circuitpython** and then the driver you want.

![](https://cdn-learn.adafruit.com/assets/assets/000/076/965/medium800/linux_sensors_image.png?1560366837)

(If you don't see it [you can open up a github issue on circuitpython to remind us](https://github.com/adafruit/circuitpython)!)

Once you know the name, install it with

`pip3 install pyserial adafruit-circuitpython-gps`

You'll notice we also installed a _dependancy_ called **pyserial**. This is a great thing about pip, if you have other required libraries they'll get installed too!

We also recommend an adafruit-blinka update in case we've fixed bugs:

`pip3 install --upgrade adafruit_blinka`

## Run that code!

The finish line is right up ahead. You can now run one of the (many in some cases) example scripts we've written for you.

Check out the examples for your library by visiting the repository for the library and looking in the example folder. In this case, it would be [https://github.com/adafruit/Adafruit\_CircuitPython\_GPS/tree/master/examples](https://github.com/adafruit/Adafruit_CircuitPython_GPS/tree/master/examples)

Lets start with the simplest, the echo example:

https://github.com/adafruit/Adafruit_CircuitPython_GPS/blob/main/examples/gps_echotest.py

 **We'll need to configure this code to work with our UART port name.**

- If you're using a USB-to-serial converter, the device name is _probably_ `/dev/ttyUSB0` - but check `dmesg` to make sure.
- If you're using the built-in UART on the DragonBoard, the device name is `/dev/ttyTHS1`.

Comment out the lines that reference `board.TX`, `board.RX` and `busio.uart` and uncomment the lines that `import serial` and define the `serial` device, like so:

```
# Define RX and TX pins for the board's serial port connected to the GPS.
# These are the defaults you should use for the GPS FeatherWing.
# For other boards set RX = GPS module TX, and TX = GPS module RX pins.
#RX = board.RX
#TX = board.TX

# Create a serial connection for the GPS connection using default speed and
# a slightly higher timeout (GPS modules typically update once a second).
#uart = busio.UART(TX, RX, baudrate=9600, timeout=3000)

# for a computer, use the pyserial library for uart access
import serial
uart = serial.Serial("/dev/ttyUSB0", baudrate=9600, timeout=3000)
```

And update the `"/dev/ttyUSB0"` device name if necessary to match your USB interface.

Whichever method you use, you should see output like this, with **$GP**"NMEA sentences" - there probably wont be actual location data because you haven't gotten a GPS fix. As long as you see those **$GP** strings sorta like the below, you've got it working!

![](https://cdn-learn.adafruit.com/assets/assets/000/095/241/medium800/python_gps_echotest.png?1601413669)

# CircuitPython Libraries on Linux and the NVIDIA Jetson Nano

## NeoPixels with SPI

You can even use NeoPixels on the Jetson Nano using the [CircuitPython NeoPixel\_SPI library](https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel_SPI). Using this library makes it really easy. The only requirement is you need to enable SPI first. If you haven't already done that, be sure to take a look at the **Initial Setup** page. For more information about the the NeoPixel SPI library itself, check out our [CircuitPython NeoPixel Library Using SPI](https://learn.adafruit.com/circuitpython-neopixels-using-spi) guide.

## Parts Used

You want some NeoPixels of course. You can use strips, matrices, or even rings.

### Adafruit NeoPixel Digital RGB LED Strip 144 LED - 1m Black

[Adafruit NeoPixel Digital RGB LED Strip 144 LED - 1m Black](https://www.adafruit.com/product/1506)
We crammed **ALL THE NEOPIXELS** into this strip! An unbelievable 144 individually-controllable LED pixels on a flexible PCB. It's completely out of control and ready for you to blink. This strip has a black mask, and an extra heavy flex PCB.  
  
These LED strips are even more...

In Stock
[Buy Now](https://www.adafruit.com/product/1506)
[Related Guides to the Product](https://learn.adafruit.com/products/1506/guides)
![Adafruit NeoPixel Digital RGB LED Strip wired to a microcontroller, with all the LEDs in a rainbow](https://cdn-shop.adafruit.com/640x480/1506-00.jpg)

### Flexible 16x16 NeoPixel RGB LED Matrix

[Flexible 16x16 NeoPixel RGB LED Matrix](https://www.adafruit.com/product/2547)
For advanced NeoPixel fans, we now have a bendable, **Flexible 16x16 NeoPixel LED Matrix**! Control all 256 ultra-bright LEDs using a single microcontroller pin, set each LED as you wish to scroll messages or draw little images. This matrix has a thick flexible PCB backing that...

In Stock
[Buy Now](https://www.adafruit.com/product/2547)
[Related Guides to the Product](https://learn.adafruit.com/products/2547/guides)
![Video of two white hands holding a rainbow pulsing Flexible 16x16 NeoPixel RGB LED Matrix.
](https://cdn-shop.adafruit.com/product-videos/640x480/2547-00.jpg)

### NeoPixel Ring - 16 x 5050 RGB LED with Integrated Drivers

[NeoPixel Ring - 16 x 5050 RGB LED with Integrated Drivers](https://www.adafruit.com/product/1463)
Round and round and round they go! 16 ultra bright smart LED NeoPixels are arranged in a circle with 1.75" (44.5mm) outer diameter. The rings are 'chainable' - connect the output pin of one to the input pin of another. Use only one microcontroller pin to control as many as you can...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1463)
[Related Guides to the Product](https://learn.adafruit.com/products/1463/guides)
![Hand holding NeoPixel Ring with 16 x 5050 RGB LED, lit up rainbow](https://cdn-shop.adafruit.com/640x480/1463-00.jpg)

If you're using more than a few NeoPixels (and why wouldn't you want to?), then you'll want an external power supply. For more about power requirements see [Powering NeoPixels](https://learn.adafruit.com/adafruit-neopixel-uberguide/powering-neopixels).

### 5V 10A switching power supply

[5V 10A switching power supply](https://www.adafruit.com/product/658)
This is a beefy switching supply, for when you need a lot of power! It can supply 5V DC up to 10 Amps, running from 110V or 220V power (the plug it comes with is for US/Canada/Japan but you can use any plug adapter for your country, or just replace the cable with a standard computer/appliance...

In Stock
[Buy Now](https://www.adafruit.com/product/658)
[Related Guides to the Product](https://learn.adafruit.com/products/658/guides)
![5V 10A switching power supply brick with IEC power port.](https://cdn-shop.adafruit.com/640x480/658-07.jpg)

### 5V 4A (4000mA) switching power supply - UL Listed

[5V 4A (4000mA) switching power supply - UL Listed](https://www.adafruit.com/product/1466)
Need a lot of 5V power? This switching supply gives a clean regulated 5V output at up to **4 Amps** (4000mA). 110 or 240 input, so it works in any country. The plugs are "US 2-prong" style so you may need a plug adapter, but you can pick one up at any hardware store for $1 or so,...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1466)
[Related Guides to the Product](https://learn.adafruit.com/products/1466/guides)
![Angled shot of 5V 4A switching power supply brick with power cable.](https://cdn-shop.adafruit.com/640x480/1466-10.jpg)

And here's a couple more products to make it easier to hook it all up.

### Premium Female/Male 'Extension' Jumper Wires - 40 x 6" (150mm)

[Premium Female/Male 'Extension' Jumper Wires - 40 x 6" (150mm)](https://www.adafruit.com/product/826)
Handy for making wire harnesses or jumpering between headers on PCB's. These premium jumper wires are 6" (150mm) long and come in a 'strip' of 40 (4 pieces of each of ten rainbow colors). They have 0.1" male header contacts on one end and 0.1" female header contacts...

In Stock
[Buy Now](https://www.adafruit.com/product/826)
[Related Guides to the Product](https://learn.adafruit.com/products/826/guides)
![Angled shot of Premium Female/Male 'Extension' Jumper Wires - 40 x 6 (150mm)](https://cdn-shop.adafruit.com/640x480/826-04.jpg)

### Female DC Power adapter - 2.1mm jack to screw terminal block

[Female DC Power adapter - 2.1mm jack to screw terminal block](https://www.adafruit.com/product/368)
If you need to connect a DC power wall wart to a board that doesn't have a DC jack - this adapter will come in very handy! There is a 2.1mm DC jack on one end, and a screw terminal block on the other. The terminals are labeled with positive/negative assuming a positive-tip configuration...

In Stock
[Buy Now](https://www.adafruit.com/product/368)
[Related Guides to the Product](https://learn.adafruit.com/products/368/guides)
![Angle shot Female DC Power adapter - 2.1mm jack to screw terminal block](https://cdn-shop.adafruit.com/640x480/368-03.jpg)

## Wiring
Warning: 

- Connect **+5V** &nbsp;on the power supply to the&nbsp; **NeoPixel VIN**
- Connect **Ground** &nbsp;on the power supply to the&nbsp; **NeoPixel GND**
- Connect **RPI GND** &nbsp;to&nbsp; **NeoPixel GND**
- Connect **RPI MOSI** &nbsp;to&nbsp; **NeoPixel DIN**

![python_NeoPixels_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/095/282/medium640/python_NeoPixels_bb.jpg?1601491024)

[Fritzing Diagram](https://cdn-learn.adafruit.com/assets/assets/000/095/287/original/NeoPixels.fzz?1601491649)
Double-check you have the right wires connected to the right location. It can be tough to keep track of GPIO pins as there are forty of them!

## Install the required libraries

The CircuitPython NeoPixel\_SPI library is very easy to install. Just type:

`pip3 install adafruit-circuitpython-neopixel-spi`

If you're using a NeoPixel matrix, you may also want to try out the **CircuitPython Pixel Framebuf library** as well, which works well with the **NeoPixel SPI library**.

`pip3 install adafruit-circuitpython-pixel-framebuf`

For more information on using the Pixel Framebuf library, check out our [Easy NeoPixel Graphics with the CircuitPython Pixel Framebuf Library](https://learn.adafruit.com/easy-neopixel-graphics-with-the-circuitpython-pixel-framebuf-library) guide.

## Run that code!

The finish line is right up ahead. You can now run one of the (many in some cases) example scripts we've written for you.

Check out the examples for your library by visiting the repository for the library and looking in the example folder. In this case, it would be&nbsp;[https://github.com/adafruit/Adafruit\_CircuitPython\_NeoPixel\_SPI/tree/master/examples](https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel_SPI/tree/master/examples)

As of this writing there's only one example that runs NeoPixels on SPI:

https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel_SPI/blob/main/examples/neopixel_spi_simpletest.py

Warning: 

Save this code to your Jetson Nano by copying and pasting it into a text file, downloading it directly from the Jetson Nano, etc.

You'll want to edit the script and number of NeoPixels that you are actually using and possibly the type if the colors don't look correct.

Then in your command line run:

`python3 neopixel_spi_simpletest.py`

Each pixel should individually light up Red, then Green, then Blue and loop back to Red and so on.

## Using Many NeoPixels

If you need to use a lot of them, like more than 170 RGB NeoPixels (about 128 for RGBW type), it will require you to make some changes on the Jetson Nano first. This is because the SPI buffer is set to 4096 by default and each NeoPixel takes 24 bytes. If we use any more than that, it overflows and behaves oddly.

To increase this, we need to make changes in a couple of different places. Although this was tested on the Jetson Nano, it will likely work on other NVIDIA Jetson boards.

### Increase the Jetson Nano's Spidev Buffer Size

The first place we increase it is in the Jetson Nano's **spidev.bufsize** parameter. This is done in the **boot/extlinux/extlinux.conf** file. We can check the current size with:

`cat /sys/module/spidev/parameters/bufsiz`

![](https://cdn-learn.adafruit.com/assets/assets/000/095/270/medium800/python_buffer_4096.png?1601488939)

Let's change that. Start by opening the config file in an editor:

`sudo nano /boot/extlinux/extlinux.conf`

At the top of the file, you should see a line that looks like **DEFAULT [labelname]**. If you enabled spi1 using the directions in the Initial Setup, it likely is using **JetsonIO** which we'll go with for the rest of this section.

```python
DEFAULT JetsonIO
```

Scroll down in the file to a section that starts with LABEL and has a name that matches.

```python
LABEL JetsonIO
```

Just below that, there is a line that starts with **APPEND**. Go to the end of that line and at the end add

`spidev.bufsiz=65536`

It should look something like the following:

```python
APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 spidev.bufsiz=65536
```

Go ahead and save the file, then exit and reboot:

`sudo reboot`

Once it restarts, type the following command to verify that it is now 65536:

`cat /sys/module/spidev/parameters/bufsiz`

![](https://cdn-learn.adafruit.com/assets/assets/000/095/272/medium800/python_buffer_65536.png?1601488951)

### Change Adafruit PureIO's buffer size

First of all, be sure you're running the latest version of Blinka. This will ensure that you have the latest PureIO as well, which was recently updated for this purpose:

`pip3 install --upgrade adafruit-blinka`

To change Adafruit PureIO's buffer size, we can simply set the **SPI\_BUFSIZE** environment variable and it will use that. If you just want to use it once, you can type at the command line:

`export SPI_BUFSIZE=65536`

If you want to have it set the variable every time the Jetson Nano boots, you can add it to your **.bashrc** file, which is located in your home directory. So fi your username is **pi** , you would find it in **/home/pi/.bashrc**. Open it up in an editor:

`nano ~/.bashrc`

And just add the export line to the bottom of your file and save. Once it is added, you can either reboot or type the following command to immediately reload it:

`source ~/.bashrc`

That's it, you're ready to rock with lots of NeoPixels now.

# CircuitPython Libraries on Linux and the NVIDIA Jetson Nano

## More To Come!

That's just a taste of what we've got working so far

We're adding more support constantly, so please hold tight and [visit the adafruit\_blinka github repo](https://github.com/adafruit/Adafruit_Blinka) to share your feedback and perhaps even submit some improvements!

If you'd like to contribute, but aren't sure where to start, check out the following guides:

- [Adding a Single Board Computer to PlatformDetect for Blinka](https://learn.adafruit.com/adding-a-single-board-computer-to-platformdetect-for-blinka)
- [Adding a Single Board Computer to Blinka](https://learn.adafruit.com/adding-a-single-board-computer-to-blinka)

# CircuitPython Libraries on Linux and the NVIDIA Jetson Nano

## FAQ & Troubleshooting

There's a few oddities when running Blinka/CircuitPython on Linux. Here's a list of stuff to watch for that we know of!

This FAQ covers all the various platforms and hardware setups you can run Blinka on. Therefore, some of the information may not apply to your specific setup.

## Update Blinka/Platform Libraries

**Most issues can be solved by forcing Python to upgrade to the latest `blinka` / `platform-detect` libraries**. Try running

`sudo python3 -m pip install --upgrade --force-reinstall adafruit-blinka Adafruit-PlatformDetect`

### Getting an error message about 'board' not found or 'board' has no attribute

Somehow you have ended up with either the wrong&nbsp; **board** &nbsp;module or no&nbsp; **board** &nbsp;module at all.

**DO NOT** &nbsp;try to fix this by manually installing a library named&nbsp;`board`. There is&nbsp;[one out there](https://pypi.org/project/board/)&nbsp;and it has nothing to do with Blinka. You will break things if you install that library!

The easiest way to recover is to simply force a reinstall of Blinka with:  
`python3 -m pip install --upgrade --force-reinstall adafruit-blinka`

Additionally, and especially if you are using a more recent version of Python, you may run into this error if you either do not have a Virtual Environment active or setup. See the [Python Virtual Environment Usage on Raspberry Pi](https://learn.adafruit.com/python-virtual-environment-usage-on-raspberry-pi) guide for more information or check out the guide's Installation page.

### 
       
       
       
       
       
       
       
       
       
       Mixed SPI mode devices 
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
    

Due to the way we share an SPI peripheral, you cannot have two SPI devices with different 'mode/polarity' on the same SPI bus - you'll get weird data

95% of SPI devices are mode 0, check the driver to see mode or polarity settings. For example:

- [LSM9DS1 is mode 1](https://github.com/adafruit/Adafruit_CircuitPython_LSM9DS1/blob/master/adafruit_lsm9ds1.py#L408), please use in I2C mode instead of SPI
- [MAX31865 is phase 1](https://github.com/adafruit/Adafruit_CircuitPython_MAX31865/blob/master/adafruit_max31865.py#L97), try using this on a separate SPI device, or read data twice.

### 
       
       
       
       
       
       
       
       
       
       Why am I getting AttributeError: 'SpiDev' object has no attribute 'writebytes2'? 
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
    

This is due to having an older version of [spidev](https://pypi.org/project/spidev/). You need at least version 3.4. This should have been [taken care of](https://github.com/adafruit/Adafruit_Blinka/blob/8a4686cbc7ebd7f338f64517fa42db4dc5b5c78c/requirements.txt#L6) when you installed Blinka, but in some cases it does not seem to happen.

To check what version of spidev Python is using:

> `$ python3`  
> `Python 3.6.8 (default, Oct 7 2019, 12:59:55) `  
> `[GCC 8.3.0] on linux`  
> `Type "help", "copyright", "credits" or "license" for more information.`  
> `>>> import spidev`  
> `>>> spidev. __version__ `  
> `'3.4'`  
> `>>>`

If you see a version lower then 3.4 reported, then try a force upgrade of spidev with (back at command line):

`sudo python3 -m pip install --upgrade --force-reinstall spidev`

### No Pullup/Pulldown support on some Linux boards or MCP2221

Some Linux boards, for example, AllWinner-based, do not have support to set pull up or pull down on their GPIO. Use an external resistor instead!

### Getting OSError: read error with MCP2221

If you are getting a stack trace that ends with something like:

> `return self._hid.read(64)`  
> `File "hid.pyx", line 122, in hid.device.read`  
> `OSError: read error`

Try setting an environment variable named **BLINKA\_MCP2221\_RESET\_DELAY** to a value of **0.5 or higher**.

Windows:

`set BLINKA_MCP2221_RESET_DELAY=0.5`

Linux:

`export BLINKA_MCP2221_RESET_DELAY=0.5`

This is a value in seconds to wait between resetting the MCP2221 and the attempt to reopen it. The reset is seen by the operating system as a hardware disconnect/reconnect. Different operating systems can need different amounts of time to wait after the reconnect before the attempt to reopen. Setting the above environment variable will override the default reset delay time, allowing it to be increased as needed for different setups.

### 
       
       
       
       
       
       
       
       
       
       Using FT232H with other FTDI devices. 
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
    

Blinka uses the libusbk driver to talk to the FT232H directly. If you have other FTDI devices installed that are using the FTDI VCP drivers, you may run into issues. See here for a possible workaround:

[https://forums.adafruit.com/viewtopic.php?f=19&t=166999](https://forums.adafruit.com/viewtopic.php?f=19&t=166999)

### 
       
       
       
       
       
       
       
       
       
       Getting 

This is probably only an issue for older versions of Windows. If you run into something like this, see this issue thread:

[https://github.com/pyusb/pyusb/issues/120](https://github.com/pyusb/pyusb/issues/120)

which describes copying the 32bit and 64bit DLLs into specific folders. ([example for Win7](https://github.com/pyusb/pyusb/issues/120#issuecomment-322058585))

### 
       
       
       
       
       
       
       
       
       
        Getting 

Check out this issue thread:

[https://github.com/pyusb/pyusb/issues/355](https://github.com/pyusb/pyusb/issues/355 "https://github.com/pyusb/pyusb/issues/355")

which has **lots** of discussion. It is probably worth reading through it all to determine what applies for your setup.&nbsp; Most solutions seem to rely on setting the **DYLD\_LIBRARY\_PATH** environment variable.

This issue thread has further information:

[https://github.com/orgs/Homebrew/discussions/3424](https://github.com/orgs/Homebrew/discussions/3424)

### 
       
       
       
       
       
       
       
       
       
       I can't get neopixel, analogio, audioio, rotaryio, displayio or pulseio to work! 
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
     
       
        
       
    

Some CircuitPython modules like may not be supported.

- Most SBCs do not have analog inputs so there is no `analogio`
- Few SBCs have `neopixel` support so that is only available on Raspberry Pi (and any others that have low level neopixel protocol writing
- Rotary encoders (`rotaryio`) is handled by interrupts on microcontrollers, and is not supported on SBCs at this time
- Likewise `pulseio` PWM support is not supported on many SBCs, and if it is, it will not support a carrier wave (Infrared transmission)
- For display usage, we suggest using python `Pillow` library or `Pygame`, we do not have `displayio` support

We aim to have, at a minimum, `digitalio` and `busio` (I2C/SPI). This lets you use the vast number of driver libraries

For analog inputs,[the MCP3xxx library](https://github.com/adafruit/Adafruit_CircuitPython_MCP3xxx) will give you `AnalogIn` objects. For PWM outputs, [try the PCA9685](https://github.com/adafruit/Adafruit_CircuitPython_PCA9685). For audio, use pygame or other Python3 libraries to play audio.

Some libraries, like [Adafruit\_CircuitPython\_DHT](https://github.com/adafruit/Adafruit_CircuitPython_DHT) will try to bit-bang if pulsein isn't available. Slow linux boards (\<700MHz) may not be able to read the pins fast enough), you'll just have to try!

### 
       
       
       
       
       
       
       
       
       
       Help, I'm getting the message 

It looks like **libgpiod** may not be installed on your board.

Try running the command: `sudo apt-get install libgpiod2`

### 
       
       
       
       
       
       
       
       
       
       = v5.5.0

Be sure you have the latest libgpiod.py script and run it with the `-l` or `--legacy` flag:

`sudo python3 libgpiod.py --legacy`

All Raspberry Pi Computers Have:

- 1 x I2C port with **busio** (but clock stretching is not supported in hardware, so you must set the I2C bus speed to 10KHz to 'fix it')
- 2 x SPI ports with **busio** 
- 1 x UART port with **serial** - note this is shared with the hardware console
- **pulseio.pulseIn** using gpiod
- **neopixel** support on a few pins
- No AnalogIn support (Use an MCP3008 or similar to add ADC)
- No PWM support (Use a PCA9685 or similar to add PWM)

![sensors_raspberry_pi.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/099/medium640/sensors_raspberry_pi.jpg?1560709288)

Google Coral TPU Dev Boards Have:

- 1 x I2C port with **busio**
- 1 x SPI ports with **busio** 
- 1 x UART port with **serial** - note this is shared with the hardware console
- 3 x PWMOut support
- No NeoPixel support
- No AnalogIn support (Use an MCP3008 or similar to add ADC)

![sensors_google_coral.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/100/medium640/sensors_google_coral.jpg?1560709528)

Orange Pi PC Plus Boards Have:

- 1 x I2C port with **busio**
- 1 x SPI ports with **busio** 
- 1 x UART port with **serial**
- No NeoPixel support
- No AnalogIn support (Use an MCP3008 or similar to add ADC)
- No PWM support (Use a PCA9685 or similar to add PWM)

![sensors_47688275371_ab6f25d2f2_k.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/102/medium640/sensors_47688275371_ab6f25d2f2_k.jpg?1560709858)

Orange Pi R1 Boards Have:

- 1 x I2C port with **busio**
- 1 x SPI port with **busio** 
- 1 x UART port with **serial**
- No NeoPixel support
- No AnalogIn support (Use an MCP3008 or similar to add ADC)
- No PWM support (Use a PCA9685 or similar to add PWM)

![sensors_orange_pi_r1.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/105/medium640/sensors_orange_pi_r1.jpg?1560710441)

ODROID C2 Boards Have:

- 1 x I2C port with&nbsp; **busio**
- No SPI support
- 1 x UART port with **serial** - note this is shared with the hardware console
- No NeoPixel support
- No AnalogIn support (Use an MCP3008 or similar to add ADC)
- No PWM support (Use a PCA9685 or similar to add PWM)

![sensors_product.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/107/medium640/sensors_product.jpg?1560710758)

DragonBoard 410c Boards Have:

- 2 x I2C port with&nbsp; **busio**
- 1 x SPI port with&nbsp; **busio**
- 1 x UART port with&nbsp; **serial**
- No NeoPixel support
- No AnalogIn support (Use an MCP3008 or similar to add ADC)
- No PWM support (Use a PCA9685 or similar to add PWM)

![sensors_dragonboard410c.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/714/medium640/sensors_dragonboard410c.jpg?1562085887)

NVIDIA Jetson Nano Boards Have:

- 2 x I2C port with&nbsp; **busio**
- 2 x SPI ports with **busio**
- 2 x UART port with&nbsp; **serial** &nbsp;- note one of these is shared with the hardware console
- No NeoPixel support
- No AnalogIn support (Use an MCP3008 or similar to add ADC)
- No PWM support (Use a PCA9685 or similar to add PWM)

![sensors_faq_troubleshooting.jpg](https://cdn-learn.adafruit.com/assets/assets/000/080/798/medium640/sensors_faq_troubleshooting.jpg?1568157791)

FT232H Breakouts Have:

- 1x I2C port **OR** SPI port with **busio**
- 12x GPIO pins with **digitalio**
- No UART
- No AnalogIn support
- No AnalogOut support
- No PWM support

If you are using [Blinka in FT232H mode](https://learn.adafruit.com/circuitpython-on-any-computer-with-ft232h), then keep in mind these basic limitations.

- SPI and I2C can not be used at the same time since they share the same pins.
- GPIO speed is not super fast, so trying to do arbitrary bit bang like things may run into speed issues.
- There are no ADCs.
- There are no DACs.
- UART is not available (its a different FTDI mode)

![sensors_2264-04.jpg](https://cdn-learn.adafruit.com/assets/assets/000/081/745/medium640/sensors_2264-04.jpg?1569886041)

MCP2221 Breakouts Have:

- 1x I2C port with **busio**
- 4x GPIO pins with **digitalio**
- 3x AnalogIn with **analogio**
- 1x AnalogOut with **analogio**
- 1x UART with **pyserial**
- No PWM support
- No hardware SPI support

If you are using Blinka in MCP2221 mode, then keep in mind these basic limitations.

- GPIO speed is not super fast, so trying to do arbitrary bit bang like things may run into speed issues.
- UART is available via `pyserial`, the serial COM port shows up as a second USB device during enumeration

![sensors_mcp2221_small_iso.jpg](https://cdn-learn.adafruit.com/assets/assets/000/086/115/medium640/sensors_mcp2221_small_iso.jpg?1576799406)

# CircuitPython Libraries on Linux and the NVIDIA Jetson Nano

## Downloads

## Application Notes

- [Customizing the Expansion Header Configuration](https://developer.nvidia.com/embedded/dlc/Jetson-Nano-40-Pin-Expansion-Header-1.2)


## Featured Products

### USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi

[USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi](https://www.adafruit.com/product/954)
The cable is easiest way ever to connect to your microcontroller/Raspberry Pi/WiFi router serial console port. Inside the big USB plug is a USB\<-\>Serial conversion chip and at the end of the 36" cable are four wire - red power, black ground, white RX into USB port, and green TX out...

In Stock
[Buy Now](https://www.adafruit.com/product/954)
[Related Guides to the Product](https://learn.adafruit.com/products/954/guides)
### FTDI Serial TTL-232 USB Cable

[FTDI Serial TTL-232 USB Cable](https://www.adafruit.com/product/70)
Just about all electronics use TTL serial for debugging, bootloading, programming, serial output, etc. But it's rare for a computer to have a serial port anymore. This is a USB to TTL serial cable, with a FTDI FT232RL usb/serial chip embedded in the head. It has a 6-pin socket at the end...

Out of Stock
[Buy Now](https://www.adafruit.com/product/70)
[Related Guides to the Product](https://learn.adafruit.com/products/70/guides)
### Adafruit BME280 I2C or SPI Temperature Humidity Pressure Sensor

[Adafruit BME280 I2C or SPI Temperature Humidity Pressure Sensor](https://www.adafruit.com/product/2652)
Bosch has stepped up their game with their new BME280 sensor, an environmental sensor with temperature, barometric pressure&nbsp;and&nbsp;humidity! This sensor is great for all sorts of indoor environmental sensing and can even be used in both I2C and SPI!

This precision sensor from...

In Stock
[Buy Now](https://www.adafruit.com/product/2652)
[Related Guides to the Product](https://learn.adafruit.com/products/2652/guides)
### Adafruit Ultimate GPS GNSS with USB - 99 channel w/10 Hz updates

[Adafruit Ultimate GPS GNSS with USB - 99 channel w/10 Hz updates](https://www.adafruit.com/product/4279)
The Ultimate GPS module you know and love has a _glow-up_ to let it be easily used with any computer, not just microcontrollers! With the built-in USB-to-Serial converter, you can now plug-n-play the Ultimate GPS into your computer, laptop, embedded Linux computer, and more. Power and...

In Stock
[Buy Now](https://www.adafruit.com/product/4279)
[Related Guides to the Product](https://learn.adafruit.com/products/4279/guides)
### Adafruit Ultimate GPS Breakout - 66 channel w/10 Hz updates

[Adafruit Ultimate GPS Breakout - 66 channel w/10 Hz updates](https://www.adafruit.com/product/746)
We carry a few different GPS modules here in the Adafruit shop, but none that satisfied our every desire - that's why we designed this little GPS breakout board. We believe this is the **Ultimate** GPS module, so we named it that. It's got everything you want and...

In Stock
[Buy Now](https://www.adafruit.com/product/746)
[Related Guides to the Product](https://learn.adafruit.com/products/746/guides)
### Premium Male/Male Jumper Wires - 40 x 6" (150mm)

[Premium Male/Male Jumper Wires - 40 x 6" (150mm)](https://www.adafruit.com/product/758)
Handy for making wire harnesses or jumpering between headers on PCB's. These premium jumper wires are 6" (150mm) long and come in a 'strip' of 40 (4 pieces of each of ten rainbow colors). They have 0.1" male header contacts on either end and fit cleanly next to each other...

In Stock
[Buy Now](https://www.adafruit.com/product/758)
[Related Guides to the Product](https://learn.adafruit.com/products/758/guides)
### Half Sized Premium Breadboard - 400 Tie Points

[Half Sized Premium Breadboard - 400 Tie Points](https://www.adafruit.com/product/64)
This is a cute, half-size breadboard with&nbsp;400 tie points, good for small projects. It's 3.25" x 2.2" / 8.3cm&nbsp;x 5.5cm&nbsp;with a standard double-strip in the middle and two power rails on both sides.&nbsp;You can pull the power rails off easily to make the breadboard as...

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

## Related Guides

- [CircuitPython Libraries on Linux and the 96Boards DragonBoard 410c](https://learn.adafruit.com/circuitpython-libraries-on-linux-and-the-96boards-dragonboard-410c.md)
- [Textable Sensor with FONA and CircuitPython](https://learn.adafruit.com/textable-sensor-with-fona-and-circuitpython.md)
- [No-Code Offline Data Logger with WipperSnapper](https://learn.adafruit.com/no-code-offline-data-logging-with-wippersnapper.md)
- [Adafruit IO Environmental Monitor for Feather or Raspberry Pi](https://learn.adafruit.com/adafruit-io-air-quality-monitor.md)
- [DIY Trinkey No-Soldering USB Air Quality Monitor](https://learn.adafruit.com/diy-trinkey-no-solder-air-quality-monitor.md)
- [CircuitPython Libraries with the Binho Nova Multi-Protocol USB Host Adapter](https://learn.adafruit.com/circuitpython-with-binho-nova-multi-protocol-usb-host-adapter.md)
- [Reverse Geocache Box](https://learn.adafruit.com/reverse-geocache-engagement-box.md)
- [Adafruit BME280 Humidity + Barometric Pressure + Temperature Sensor Breakout](https://learn.adafruit.com/adafruit-bme280-humidity-barometric-pressure-temperature-sensor-breakout.md)
- [Adafruit Ultimate GPS Logger Shield](https://learn.adafruit.com/adafruit-ultimate-gps-logger-shield.md)
- [PyPortal IoT Weather Station](https://learn.adafruit.com/pyportal-iot-weather-station.md)
- [No-Code IKEA Vindriktning Air Quality Sensor Hack with Adafruit IO](https://learn.adafruit.com/no-code-ikea-vindriktning-hack-with-qt-py-esp32-s3-and-adafruit-io.md)
- [CircuitPython Essentials](https://learn.adafruit.com/circuitpython-essentials.md)
- [Air Quality Sensor 3D Printed Enclosure](https://learn.adafruit.com/air-quality-sensor-silo-house.md)
- [CircuitPython Libraries on Linux and ODROID C2](https://learn.adafruit.com/circuitpython-libaries-linux-odroid-c2.md)
- [I2C Addresses and Troublesome Chips](https://learn.adafruit.com/i2c-addresses.md)
