Neopixel Stoplight

3D Printed Neopixel Stoplight

I had been looking for a STL of a stoplight to print for about a year now. I wanted to use the colors of the stoplight to signal to my younger kids when it was ok to wake up in the morning, and when it was time to go back to sleep. My ideal was that I could use Node-Red running on the home server via MQTT to regulate when the stoplight changed colors. Thingiverse’s search is horrible and you could spend days there and not actually get what you are looking for so I never found one that would work. The other day I was searching for some reference STLs of something and accidentally came across a STL for a stoplight. Not one, but three (two remixed from the other).

The first one looked great, good size and decent design. Except it was designed for LEDs and an ATTiny to drive its sequence. The second was a remix of the first. The third was another remix that extended the back casing. The remixes made things easier to print but still relied on LEDs and an ATTiny of sorts. This was a great starting point for me. I have no problems modifying STLs for my purposes. I like to use Tinkercad, not very good with Fusion 360. I downloaded the files and started my own remix. I took elements from all three versions of the stoplight.

I modified the back case to allow a Lolin v3 to be able to mount to it. Then I had to create a cover for the Lolin. I took the front from the original thing, I preferred its one piece to the remixes four piece but I filled in the slot for the little switch. I used the LED panes/covers from the original, unmodified. This was great, I had a front and back a cover, LED panes and the inlay to hold the LEDs. So I printed it all out and went to work. First things first, I tested the LEDs. Like I thought, the LEDs I have are not the super bright ones and running off of the Lolins 3v they just didn’t have enough brightness to shine through very well. No super bright LEDs but I do have some WS2812 neopixels. I hooked one up to test and yes they were perfect. So I modified the LED inlay to hold three neopixels.

I wanted to be able to control the stoplight via MQTT from my server running Node-Red. I used the neopixel example from Adafruit and the default Pubsubclient example for an ESP8266. Mashed the two together and I was able to change the colors on the fly with no problems. I showed off the stoplight to a friend of mine and he loved it. He wanted one for himself, but he doesn’t have a server or anything that runs MQTT. No problem, the Lolin can handle web GUIs. A quick google for a web server on an ESP turned up a nice little tutorial on how to turn on and off GPIO pins from a web GUI. BAM! I took that code and mashed it up with the neopixel code I already had an I was able to get a nice little web page displayed to change the colors of the stoplight. This is awesome.

So behold! Two versions of a “smart” IoT stoplight, haha! One uses MQTT to change the colors. The other allows you to connect to a nice web page to change the colors of the light.

 

 

 

These are the devices I used

 

 

Stoplight Remix STL

You can grab the STLs here.

I also uploaded the STL to Thingiverse if you wanna head over there and grab em.

 

Neopixel Stoplight (Web GUI version) Code

This will host a web page to allow you to connect and change the lights. Connects to your WiFi.

Download the web GUI code

 

 

Neopixel Stoplight (MQTT version) Code

This will connect to a MQTT server and subscribe to a topic to listen for incoming messages.

Download the MQTT code

 

If you just wanted to run some basic light sequence code like on an Arduino or something you should check out this page

 

 

Where I found the web server code, over at Random Nerd Tutorials

Some good info I found on MQTT

https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library-use

 


Discover more from Its_All.Lost

Subscribe to get the latest posts sent to your email.

Leave a Reply