I recently had an ugly sweater competition at work and decided to dominate the competition. Yes, you can buy sweaters with LEDs in them but what fun is that? I wanted the LEDs to dance to the music while it was playing, and while I was walking around. Check out the youtube playlist link to see how it turned out.Software
The software to control everything was written in Python 3 using circuit python libraries on the Pi.
Unlike commercial light-music-synchonization products, No PREDEFINED Sequence files are needed. The software does all the heavy lifting in real time. In general, each song (.wav) file has FFT analysis performed in real-time to determine which LEDs to turn on and off based on a config file which maps High Fidelity signals (e.g. Bass, Midrange, etc) to particular LEDs. You just put wav files in a songs directory and start the Python script.
I originally planned to use micropython on a TinyPico board with I2S so the speakers could be mounted on the sweater as well, but didn't have time to implement micropython ulab (numpy equivalent) functions to perform the FFT. I therefore was left with the Pi and all of its issues as a portable platform, with a portable bluetooth speaker to play the music out loud.
You can checkout the code on github: https://github.com/ndrogness/XmasSweaterShowPiMaterials
- Raspberry Pi 3B+
- 24 x Adafruit Ruby Red LED Sequins
- 12 x Adafruit Neopixel RGB LED Sequins
- 1 x Adafruit 24-Channel 12-bit PWM LED Driver (TLC5947)
- 1 x 74AHCT125 - Quad Level-Shifter (3V to 5V)
- 1 x bluetooth speaker
- 2 x PermaProto boards
- 2 x Momentary button switches
- 1 x 26800mAh portable charger
- Lots o duct tape :)
The final "product":
The inside "mess":
Conductive thread is extremely difficult to use, IMO. I started using it and had a lot of handling problems such as threading the needle!?! I was also concerned about powering that many LEDs with conductive thread that I ended up running 22 gauge wire and built a power "bus".
Controls/Interface to Pi
I carried the PI in my front pocket with an IDC cable connecting to a permaproto board where all of the inside wires ultimately interconnected. I carried a 26800 mAh battery charger pack in my back pocket to act as a power source. I then ran two standard USB charging cable from my that charger pack in my back pocket through my belt loops with one connecting directly to the PI and one connecting to the permaproto board to power the LEDs. This configuration, although very much a kludge, made it easy for me to rapidly disassemble/test/fix/reassemble and then rinse and repeat until I had a workable solution.
For "control" of the sweater, I added two momentary button switches to the sweater at the bottom. One (Yellow) for pause/resume and one (Green) play/next-song.