This project is the both the origin of my maker journey, and the greatest continuing driver of it. I wanted to create an interface for controlling a super cool RGB LED strip and to replace the crappy IR remote that it came with. That was the original goal. It started as a small box with 3 potentiometers, 3 MOSFETs, and an LCD screen. Since then, it has morphed countless times and is now - as of Feb 2018 - a Raspberry Pi-driven, web-connected, music-sensitive lighting powerhouse, which just happens to double as my sunrise alarm clock.
A 5m strip fits nicely around a coffee can
First iteration
Under advisement from some electrical engineering colleagues, I delved headfirst into the world of Arduinos and transistors with only an intro circuits course under my belt. A +12V line fed the entire strip, and the R, G, and B channels were individual paths to ground, so using PWM from an ATMega 328 (Arduino Uno or Nano), I could, with 8-bit fidelity, control the intensity of each of the red, green, and blue channels of my strip. That’s switching a lot of power though, so it was important to heatsink the MOSFET bodies in the end product, lest they melt the insulation of a passing wire and cause a dangerous short circuit.
The very beginnings
Now it was all about putting the pieces into a neat enclosure, tidying it up, and coding a simple text UI for the LCD screen / 5-way switch.
Arduino Nano, 3 potentiometers, 5-way switch, backlit 2x16 LCD, microphone, 4P2T switch, power adapter
Nice and cleaned up. In constant color mode.
The small knob in the center is a 5-way switch, which lets you navigate left, right, up, down, and through a menu. The menu consisted of different modes, including “Constant Color” where the knobs dictate red, green, and blue color intensity respectively. There was also a “Strobe” mode, “Clapper” mode, “Fade” mode, and a half-functional “Party” mode.
Here’s a video of the clapper in action! snap snap
Second Iteration
While the package was pretty, and the screen was neat, the device spent 98% of its time in “Constant Color” mode simply lighting the room and doing nothing particularly fancy. It was bulky and needed to be downsized/modernized. I could scrap the screen and the 5-way switch, I just needed 3 tactile knobs in a light switch-sized package that I could affix to the wall. Adafruit offered a Altoid tin-sized enclosure specifically for this purpose, as well as a really cool compatible breadboard.
Partly finished wiring
The Arduino headers and the transistors ended up too tall for the tin. So I had to hover the board in between the base and the top of the tin with some standoffs. I was underwhelmed by the design, but at least it was interesting and efficacious.
Finished Side-View
Third Iteration
The previous iteration was doing its job as a way to gently light a room with color. It was tactile and responsive and small and good at its job. But I wanted it to be smarter. People had been singing the praises of “sunrise alarm clocks” for some time, and I figured that there had to be a way to do that sort of automation on my own. I also wanted to pair the raising of the lights with the raising of music volume. A sunrise alarm for both lights and music! Some phone apps can use Pandora as an alarm, but few can use a Spotify playlist, and none can do it well. So I built my own, and called it Rise!
It involved
- The same transistor and Arduino set-up for actually changing the LED strip color/intensity.
- A Raspberry Pi to keep the time and run a webserver to interface with the lights via the internet.
- A Flask App that runs said server and translates requests into actions to push to the Arduino
- A brilliant 3rd party app called Mopidy which is my interface to and from Spotify
- mpc, a command line line media controller that allows me to script the music events via Mopidy’s MPD daemon
- a cron job to instantiate the alarm (yes, it’s very hacky I know)
- a conveniently sized can to wrap the LED’s around so they act more lamp-like, while also hiding the Arduino/transitor internals inside.
The picture at the top of this page shows how it’s set up currently - as of February 2018.
I also hacked into the the Python code running Mopidy, to see whether I could send web requests to my Flask server in tune with the frequencies of the music being played. Without an addressable LED strip though, it is pretty hard to turn music into a very convincing visual. Here’s my best go at it.
I’ve made significant progress in Mission Wrap-An-LED-Strip-Around-A-Coffee-Can-And-Make-It-Light-Up-In-Sync-With-Ridiculous-Songs-From-The-Hamilton-Musical