Raspberry Pi Pico
Neopixels Over Bluetooth

This project is about using Adafruit's Bluefruit LE UART Friend breakout and the Bluefruit LE Connect phone app to control Neopixels over Bluetooth.

Here is a shot from the Color Picker module of the phone app.

Pico Circuit

This is the circuit that I built. Neopixels are hard to photograph - the colours on the app and the Neopixels were a reasonably close match.

Pico Circuit

Pico Circuit

You need a library for this - get the latest .mpy one from here,

This code is not perfect. You could check that the data packets are intended as colour choices - the first byte received tells you that. You can also do the CRC check to validate the packet. This isn't bad though for being able to choose a colour without having to interact directly with the circuit.

from time import sleep
import board
import busio
import neopixel

pixel_pin = board.GP16
num_pixels = 12
ORDER = neopixel.GRB
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.2, auto_write=False, pixel_order=ORDER)

uart = busio.UART(tx=board.GP12, rx=board.GP13, baudrate=9600)

while True:
    data = uart.read(6)
    if data is not None:
        data = list(data)
        if len(data)==6:
            dr = data[2]
            dg = data[3]
            db = data[4]
            pixels.fill((dr, dg, db))