Traffic Light With Raspberry Pi Pico 2w and NeoPixel Strands

by donohum in Design > Art

6 Views, 0 Favorites, 0 Comments

Traffic Light With Raspberry Pi Pico 2w and NeoPixel Strands

IMG_0633.jpeg

Working traffic light with functionality for a red light, green light game. Made for Boston College's 2025 Festival of Light. Created by Gonzalo Verdugo (MCAS '26) and Michael Donohue (CSOM '28).

Gonzalo's contact info:

www.linkedin.com/in/gonzalo-verdugo

verdugog@bc.edu

Michael's contact info:

https://www.linkedin.com/in/michael-donohue-4131a8382/

donohum@bc.edu

Supplies

IMG_0542.jpg

Supplies:

Raspberry Pi Pico 2W with Header - https://www.adafruit.com/product/6315

Adafruit VL53L1X Time of Flight Distance Sensor - https://www.adafruit.com/product/3967

4-pin to Premium Male Headers Cable - https://www.adafruit.com/product/4209

Half-Size Breadboard - https://www.adafruit.com/product/4539

(x3) Adafruit NeoPixel LED Strip w/ Alligator Clips - 60 LED/m - 0.5 Meter Long - Black Flex - https://www.adafruit.com/product/3811

Jumper Wires - https://www.adafruit.com/product/1957

Optional:

Mono Enclosed Speaker - 3W 4 Ohm - https://www.adafruit.com/product/3351

Adafruit STEMMA Audio Amp - Mono 2.5W Class D - PAM8302 - https://www.adafruit.com/product/5647

Getting Your Box

78511436931__09BA44A1-7236-4EB9-9FD2-517A3D04A1E4.jpg

First, you need the box. We laser cut a rectangular prism (about 2 feet x 9 inches x 9 inches) with 1/4 inch birch, but any hollow box with about the same size will do. Additionally, the box must have a small 1-2x1 inch hole for the usb a to usb micro a cord to leave the box. This can go on the bottom of the box on either the back or either of the sides. Another small hole must go on the front to let the motion sensor detect motion ahead of the box. Because our box was laser cut, we were able to complete this project with the back open, which will make the following steps much easier.

CircuitPy Setup

IMG_0615.jpg

To power the whole thing, you need to configure your Pico2w and breadboard. Stick the pico into the breadboard so that the usb micro a port is facing the top edge of the board (the row labeled 1 should be up there), and that the pins are aligned in the middle. Plug the pico into your laptop or computer using a usb a to usb micro a cable, and install CircuitPython onto it if it hasn't been already. If you need help with this setup, follow the instructions in this video: https://www.youtube.com/watch?v=CcO3BWGdHhQ .

Lighting

IMG_0541.jpg

Cover the holes from the inside so that the lighting is set into the shape of the box. Arrange your 3 neopixel strips around the holes that that they are around the perimeter, and the alligator clips are inside the box. To begin wiring, stick a one side of a jumper pin cable in 3V power on the breadboard and the other side on the right rail (+). Do the same for ground on the left side rail (-). For each of the neopixel strips, clip the pin to ground (black alligator clip) and to anywhere on the ground rail. Pin one side to power (red alligator clip) and the other to the power rail. For the white clip, signal, the top light, red, goes to GP10. Middle, yellow, goes to GP11, and bottom, green, goes to GP12.

Sensor

IMG_0629.jpg

Next, the vl53 sensor goes outside the box. Plug the 4-pin to Premium Male Headers Cable into the vl53. Yellow goes to GP2, Blue to GP3. Black to ground rail and red to power rail.

Optional - Speaker

IMG_0769.jpg

If you decide you want to include audio, use the files attached to play squid games sound effects. Make sure they are put into a folder titled "squid-game-sfx" on your laptop/computer, then dragged into the pico CIRCUITPY folder while the pico is plugged in. Power goes to power rail, ground to ground rail, and signal to GP14.

Run Code

IMG_0768.jpg

Download the python file attached and put it into the pico's CIRCUITPY folder. Rename the file "code.py", and delete any previous code.py file in the folder. If done correctly, it should now run when connected to power. Attached video shows how ours works.

Decorate

IMG_8758.jpg
IMG_8759.jpg

We decided to utilize living hinges to replicate the curved top of a traffic light. It was painted green for some added color, and we added stickers and other media to give it a lived in feel. This was our personal preference, make the traffic light your own!