LED Sequencer
November 14th, 2020
After completing my sand drawing machine, I needed a way to illuminate the sand art. I chose Adafruit's DotStar LEDs because of their existing libraries for Arduino and Python (for Raspberry Pi). With the hardware selected, I set out to create and control various lighting effects for the Sand Table.
Using the DotStar Python libraries, I developed about a dozen different sequences and transitional effects, such as cross-fades between sequences. Some sequences were programmed directly in Python, while others were created using different methods, like reading RGB values from a text file or reading pixel values row by row from a PNG image file.
The LED displays can be controlled with predefined shows defined in JSON files, which allow for variables like colors, speed, and duration to be adjusted. These JSON files are read by a control script that runs as a cron job on the Raspberry Pi. Additionally, I set up a Flask web server on the Raspberry Pi as an easier access method for remote control of the LEDs.
To test the sequences, I developed a Python script to create animated GIFs of the sequences. While this effectively displayed the individual LED colors, it did not accurately render the effects of the projected and mixed light from the LEDs. To achieve more accurate previews, I later implemented a solution using Three.js, which provided much more realistic renderings of the sequences as they would appear in real life. I was also able to eventually create the 2D simulation of the light blending using WebGL shaders. All of this is available on Github.
I had these lights set up and running for several months at home and it really provided some nice ambiance to the room.
Media: