I wanted to control LED strips with music, but couldn't find a good off-the-shelf solution so I created my own. I'll explain the project and how I start and go about with hobby projects.
Market research and competitionThere were some commercial devices available and I did purchase and test them, but I wasn't satisfied with performance. I guess the basic problem in many designs was that either there wasn't enough processing power (or rather code was not optimized) or the processor would run an operating system that wasn't designed for real time operations.
SpecificationSpecification was quite simple
- React to music frequency with as little delay as possible
- Control addressable LEDs
- 3.5 mm input for audio
- Some customization for colors, speed of animation etc (needs buttons and indicators)
- Robust plug-and-play design
- Remember settings after power cycle
- Flanges for mechanical mounting
I first picked an enclosure and decided to have some simple PCB mounted push buttons for easier assembly. I selected a 7-segment display to indicate settings and device state. 7-segment displays are easy to read even in dark environment.
The UI elements are mounted on a PCB in the enclosure, so the whole thing is easy to assemble and take apart.
For the actual analysis there were some integrated chips to do music analysis, I guess they date back to Walkman etc. era, when equalizer displays were something new and not everything was run on single chip.
I planned to test a standard microcontroller and move up to a more powerful processor with a real-time OS, it I couldn't reach the expected performance. Turns out that with some optimization you won't need that much processing power to extract enough information for your eyes to process.
Amplification stage needs a huge input range as a normal headphone output voltage is much lower than what is considered the line-level in the industry.
DesignI designed the PCBAs using Autodesk Eagle. I had the full version, but the free version does suffice for this project.
I could've gotten away with using prototype boards, but designing my own PCBs gave a finished look for the product and I was able to fit in all input and output protection as well as EMC considerations you would want for a robust product.
Input protection has a polarity protection with a Schottky diode, over voltage protection for the electronics with a Zener diode and even a fuse for extra fire protection. By-pass capacitors and ferrites minimize any electrical noise in and out of the device.
Output is buffered with a low propagation delay logic gate that has a better protection circuitry than the microcontroller. I like to take all the load off the microcontroller and driving multiple parallel LED strips is not something I like to do with a microcontroller.
7-segment display is simply driven with a Microchip MCP23017 IO expansion chip. I originally also buffered the buttons with Schmitt triggers, but figured that would be over-engineering and decided to remove them.
I also implemented a voltage reference and an option to control LED with PWM, even if my primary goal is to drive addressable LEDs, which work with a sort of a shift register.
The main PCB is connected to the button PCB with an FFC cable, which is routed so that that the bending point pushes to the enclosure wall to prevent the cable from coming off in vibration.
The mechanics I designed with Autodesk Fusion 360, as it has a great integration to Eagle and you get a 3D model of your PCB pushed in your design with a click of a button and the link works both ways. You can even run Eagle within Fusion 360, but I'm used to having them as separate apps.
Fusion 360 has a free license that wouldn't really prevent my usual projects in any way. I am running a commercial license as it's bundled with Eagle license nowadays, but I have been using the free version in the past.
I was able to build the models, check for mistakes like overlap, create toolpaths for my CNC mill and renderings that you see here too.
I've also made the PCB outlines and graphics with Fusion 360.
The ResultsHere's a video of my device (in the middle) in comparison with the best performing competitors:
The driver supports several types of LED strips (more info in the linked GitHUB repository). You can select a static color or different modes for audio display.
Comments