# Connecting Adafruit NeoPixels to Jetson Xavier¶

Adafruit NeoPixels are a suite of programmable RGB LEDs. The NeoPixels strip can easily be shortened or extended depending on the application. Because of the timing requirements of the NeoPixels, this setup requires an Arduino board to interface between Jetson Xavier and the LED strip. If the board includes 5V logic, a level shifter is also required to convert from the 3.3V I2C logic of Jetson Xavier.

## Wiring Diagram¶

For instructions on how to wire NeoPixels to I2C bus 1 on the Jetson Xavier, see the following diagram. To use bus 8, use pins 27 for SDL and 28 for SCL instead of 3 and 5.

## Arduino Setup¶

To setup Arduino:

1. Connect the NeoPixel strip leads to the Arduino as shown above.

2. Set up the Arduino IDE for the Trinket: https://learn.adafruit.com/introducing-trinket/programming-with-arduino-ide. Under “Boards Manager,” download the Arduino AVR Boards package. Follow the instructions on the Trinket webpage to configure the IDE.

3. Download the Adafruit NeoPixel package and run the strandtest example to check the hardware: https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library-installation. In the Arduino code, set the NeoPixels pin and the number of NeoPixels to the appropriate values for your setup. In the wiring described above, the Trinket pin for NeoPixels is 1.

4. Configure the Arduino to be a “slave” for I2C communication with the Jetson Xavier, and load driver code onto the Arduino: https://github.com/pimoroni/programming-trinket-with-raspberry-pi/tree/master/examples/i2c-neopixels

5. Ensure you are using NEO_KHZ800 in the Adafruit_NeoPixel constructor.

## User Permissions¶

After connecting the Arduino to the Jetson Xavier as shown above, configure the Jetson Xavier for I2C communication.

On Jetson Xavier, /dev/i2c-* is owned by the user root, and is in the group i2c. The sample application must be run as either root or a user in the i2c group.

Add the current user to the i2c group with the following command:

sudo usermod -a -G i2c \$USER


## Sample Application¶

Deploy the sample application //packages/led/apps/led:sample_led-pkg` onto Jetson Xavier, making sure to set the appropriate bus parameters. The application causes the full Neopixel strip to cycle through red, green, and blue.