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.
SoftwareThe 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/XmasSweaterShowPi
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".
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.
The Pi's logic level is 3.3V, which is not good for NeoPixels which require 5V power and 5V logic if you want to avoid undesirable results. Used a logic level shifter and it resolved my issues...which wasn't evident in any (easily referenced) documentation.
The Pi is really not a good at two things: audio and pwm...Turn off the broadcom chip's audio if you have any hope of making the PI do anything reasonable with PWM, as required by the NeoPixels...ugh!
Comments