CircuitPython Wiring

First, wire up the 74HC595 to your Raspberry Pi Pico. Then, connect all the NeoPixel strips. Once you've double-checked the wiring, you can connect the 5V 2A power supply and then connect the Pico to your computer using a USB cable.

To make this diagram clearer, it is shown on a full-size breadboard. However, a half-size breadboard has plenty of room for the connections you need.
  • Pico VSYS to TOP SIDE power rail on breadboard
  • Pico GND to TOP SIDE ground rail on breadboard
  • TOP SIDE Ground rail on breadboard to BOTTOM SIDE ground rail on breadboard
  • 74HC595 Pin 16 to TOP SIDE power rail on breadboard
  • 75HC595 Pin 10 to TOP SIDE power rail on breadboard
  • 75HC595 Pin 13 to either ground rail on breadboard
  • 75HC595 Pin 8 to either ground rail on breadboard
  • 75HC595 Pin 14 to Pico GP0
  • 75HC595 Pin 11 to Pico GP1
  • 75HC595 Pin 12 to Pico GP2
  • 5V 2A "+" to BOTTOM SIDE power rail
  • 5V 2A "-" to BOTTOM SIDE ground rail
  • 8 x NeoPixel GND to ground rail on breadboard
  • 8 x NeoPixel VCC to BOTTOM SIDE ground rail on breadboard
  • 74HC595 Pins 1-7, 15 to 8 × NeoPixel DATA pins
Depending on your NeoPixel strip, you may have to solder wires to the strip itself or use an adapter cable. The suggested strips have JST PH connectors, and you can insert male jumper wires into them to create the connections.
You can do this project with fewer than 8 strands. If you have fewer strands, connect them to the pins in this order: 15, 1, 2, 3, 4, 5, 6, 7.

If you want to power the Pico from the 5V 2A power supply, you can connect the TOP SIDE power rail and the BOTTOM SIDE power rail together. This way, you don't need an additional USB cable except when you need to connect the Pico to the computer to make changes to the code.

Copying & Running the code

Use the "Download Project Zip" link below and unzip the files onto the CIRCUITPY drive that appears when you plug the Pico into your computer via a known good power + data USB cable.

CircuitPython will automatically re-load and start displaying 8 independent rainbow chases on your 8 LED strands. If you run into trouble, double-check your connections and if necessary open the REPL/serial in Mu to see any Python errors that may have occurred.

From here, you can apply any of the animations from the Adafruit LED Animations Library! Treat the LEDs as a single strand, or independent strands using PixelMap.

To discover more about how the code works behind the scenes, continue on with this guide.

import random
from adafruit_led_animation.animation.rainbowcomet import RainbowComet
from adafruit_led_animation.helper import PixelMap
from import AnimationGroup
from neopio import NeoPIO
import board

# Customize for your strands here
num_strands = 8
strand_length = 30

# Make the object to control the pixels
pixels = NeoPIO(board.GP0, board.GP1, board.GP2, num_strands*strand_length,
    num_strands=num_strands, auto_write=False, brightness=.18)

# Make a virtual PixelMap so that each strip can be controlled independently
strips = [PixelMap(pixels, range(i*strand_length, (i+1)*strand_length), individual_pixels=True)
    for i in range(num_strands)]

# This function makes a comet animation with slightly random settings
def make_animation(strip):
    speed = (1+random.random()) * 0.02
    length = random.randrange(18, 22)
    bounce = random.random() > .5
    offset = random.randint(0, 255)
    return RainbowComet(strip, speed=speed, tail_length=length, bounce=bounce,

# Make an animation for each virtual strip
animations = [make_animation(strip) for strip in strips]

# Put the animations into a group so that we can animate them together
group = AnimationGroup(*animations, )

# Show the animations forever
while True:

This guide was first published on Feb 23, 2021. It was last updated on 2021-02-23 12:32:27 -0500.

This page (Wiring and Code) was last updated on Apr 20, 2021.

Text editor powered by tinymce.