Sunday, 24 November 2024

Adafruit RP2040 Prop-Maker Feather

The Adafruit RP2040 Prop-Maker Feather is an Adafruit Feather format board using the Raspberry Pi RP2040 processor with 8MB of QSPI FLASH with a terminal block connector at one end, QWIC/STEMMA connector, Servo connector and adjacent to the USB type C connector a battery connector (with charging capability). It can be used without any soldering.


There is a slightly more in-depth discussion here.

The terminal block has three connections for the NeoPixels (5V, ground and data), two for a 4-8 ohm speaker and one for a button.

Assembly

This set up is going to use a 500mm strip of 332 LED per metre ultra dense strip.

It is supplied with a female connector and a matching male connector with wires to connect to the Feather’s terminals.

Unfortunately, due to not completely comprehending the operation of the NeoPixel driver, I went through a number of iterations on connection, including removing the connector on the strip before finally realising that the NeoPixel driver is by default OFF, and a pin needs to be set to make it (and the speaker driver) live. Once that was set and the wires appropriately connected everything was fine.

Installation

CircuitPython is derived from MicroPython and makes the device appear as a USB storage device on the host computer.

This means that any editor can be used to edit the CircuitPython source as long as when it saves, it saves everything to the device.

I use a slightly different method, I have a simple Visual Studio program that I use to copy all the required files to the device - and develop using Visual Studio Code. This means that there is always a copy of the code on the laptop in the event that the device becomes unreadable.

The alternative is to use an IDE like MU.

Download the latest version of CircuitPython for the board from the CircuitPython site.

Connect the Prop-Maker Feather to the computer with a known good data (not charge only cable).

The Prop-Maker Feather has a Reset and a Boot Select button. This makes entering the Bootloader a lot easier tan having to unplu and plug the device in while holding down a tiny button.

Hold down the BOOT button and while continuing to hold it, press and release the reset button. Keep holding the BOOT button until a RPI-RP2 drive on the computer.

Copy and paste the UF2 file into the drive. When it has finished copying, the Feather will reboot.

Coding

This program repeatedly through runs the NeoPixel strip through a number of colours. The onboard LED is flashed during each cycle.

# Imports

import board

import digitalio

import time

import neopixel


# Use the builtin LED as a pulse

led = digitalio.DigitalInOut(board.LED)

led.direction = digitalio.Direction.OUTPUT


# Set a list of colour combinations

COLORS = (

    (255,   0,   0),

    (  0, 255,   0),

    (  0,   0, 255),

    (255, 255,   0),

    (255,   0, 255),

    (  0, 255, 255),

)

# Set up Neopixels

# This is for a 0.5m Ultra-dense RGB Micro LED Strip with 332 LEDs per metre

num_pixels = 165

pixels = neopixel.NeoPixel(board.EXTERNAL_NEOPIXELS, num_pixels, auto_write=True)

pixels.brightness = 0.02

# One of the features of the prop-maker is that the Neopixel 

# (and the amplifier and the speaker) can be switched on and off 

external_power = digitalio.DigitalInOut(board.EXTERNAL_POWER)

external_power.direction = digitalio.Direction.OUTPUT

external_power.value = True


# Loop indefinitely

while True:

    # Loop through the colour list

    for color in COLORS:

        # Set the built in LED on

        led.value = True

        time.sleep(0.5)

        # Set each pixel in turn

        for i in range(num_pixels):

            pixels[i] = color

        pixels.show()

        # Set the built in LED off

        led.value = False

        time.sleep(0.5)

Here is the device in action.



References

https://shop.pimoroni.com/products/adafruit-rp2040-prop-maker-feather-with-i2s-audio-amplifier?variant=41128910454867

https://shop.pimoroni.com/products/neon-like-rgb-micro-led-strip?variant=39395564585043

https://circuitpython.org/board/adafruit_feather_rp2040_prop_maker/

https://circuitpython.org/libraries

https://learn.adafruit.com/adafruit-rp2040-prop-maker-feather/overview

https://learn.adafruit.com/lightsaber-rp2040/code-the-lightsaber