My workshop is too bland. Despite the varnished, 80s-Esque wood planks that cover my walls, it lacks both color and of course: LEDs. As well, I often play music while soldering electronics. This got me thinking, could I combine both music and LEDs to make my room less…boring? The answer: an LED Volume Bar.
What is an LED Volume Bar?
As a kid that grew up using a Windows Vista machine, I know a thing or two about volume bars. Windows Vista prominently utilizes a volume bar to show both the max sound set on a computer as well as the computer’s current volume. It is also apparent to me that Windows Vista holds the spot for the worst Windows operating system of all time (an opinion that I deeply disagree with).
In simple terms, a volume bar is just a rectangle that shows the varying levels of sound coming out of a speaker. As the volume increases, the bar will fill up and as the volume decreases, the bar will empty out.
The LED portion of the name comes from how I am going to display the volume: with LEDs!
Operational amplifiers are able to do many things. Besides being a structure of meticulously placed transistors, it can act as an audio amplifier, variable logic gates, and even as an active filter. However, in an op-amp’s most basic form it is a voltage comparator. As a voltage comparator, the op-amp is constantly “reading” the inputted signal, comparing it to a set reference voltage (called Vref). When the inputted signal is higher than Vref, the op-amp will go high, turning an LED on. When the inputted signal is lower than Vref, the op-amp will go low and turn off the LED. Review Fig 1.1 for further help.
Op-Amp Comparator Array
It is important to notice that in Fig 1.1, Vref is set through a resistor divider. This means that Vref is proportional to Vcc. Keeping this in mind, if we scale up the design in Fig 1.1, we can create an op-amp comparator array. Using 8 op-amps and 8 resistors, we create 8 voltage “regions” (Refer to Fig 1.2). When the inputted audio signal goes through one of the regions, it will turn an LED on. This will allow us to show the volume that the music is currently playing at.
Despite the simplicity of the current design, we are still missing a crucial part: an audio amplifier. For the op-amp comparator to work, the inputted volume must have a large enough voltage change to have any real effect on the LEDs. This is where my trusty friend, the LM386 comes in.
By the far the most popular amplifier IC of all time, the LM386 will allow us to amplify the inputted volume close to Vcc. This will allow us to easily see the volume swing up and down throughout the song.
A good way to visualize why we need an amplifier is to imagine that we are shifting the audio signal up and down on a graph. The loudest portion of the song must be able to turn on the top-most LED on the bar. For this to happen, the audio signal must be shifted up to match Vcc. Otherwise, without the amplifier, the loudest portion of the song may only turn on the 3rd or 4th LED*. This will be of no use to us.
* The average i-phone outputs music in the 0-1.5v range, too small to have a noticeable effect on the LEDs. This is why an amplifier must be used
Theory finally out of the way, the next step is to create the actual schematic for the volume bar. Using all the information above, I created the following schematics in Eagle:
As you can see, most of Fig 2.1 is just the repetition of an op-amp comparator. In the design, I only use 8 op-amps resulting in 8 different voltage regions but in your own design, you can use however many you want. As well, the transistors in Fig 2.1 are meant to act like LED drivers to turn on multiple LEDs. This is because the op-amp I chose (LM358) can only drive 50 mA of current. This is enough to drive one LED but with any more and you risk burning the chip.
It is always smart to make a prototype before the final product is made. Using a spare breadboard and an amplifier board I stole from a computer monitor, I hodgepodged together a working prototype of the volume bar. Watch the video to see the prototype in action!
After building the prototype, I moved onto making a printed circuit board (PCB) for the final design. Since I made the schematics in EAGLE, all I need to do to make the PCB is to switch from schematic mode to board mode. Once in board mode, I began placing all the necessary resistors, capacitors and IC’s. Once done, I routed the copper connections for them (seen as the blue and red lines in Fig 4.1) creating this PCB:
Done with the PCB design, I exported the board as Gerber files. From there, it was as simple as click, click, upload, and pay on the JLCPCB website, a Shenzhen based PCB factory. I highly recommend JLCPCB because of its high-quality and extremely low cost (which can be as low as $2!). However, although JLCPCB is very cheap, the shipping time is far from optimal. On average, it takes 2-3 weeks for the PCBs to be shipped using China post. In my case, due to coronavirus, it took longer for the shipment to arrive (about 4 weeks).
After the 4 week wait, the PCBs have finally arrived! All JLCPCB boards arrive in a vacuum-sealed plastic wrap. This keeps the PCBs as “fresh” as possible, preventing any possibility of oxidization during shipment. Besides that, JLCPCB also includes little gifts. This time they gave little JLCPCB thumbs up stickers. This is always a nice add on.
Turning my soldering iron to a scorching 350° Celius, I dabbed the tip in solder and began soldering all the electrical components. Soldering in a stepwise fashion, first came the resistors, then the capacitors, IC holders and then finally the power adapter and audio plug.
Once done with soldering, I checked over all my solder joints, plugged in a 12v barrel jack and turned off my lights. Let the LED show begin!
As just a bare PCB, the volume bar looks “naked” without a case. Thus using a 3D modeling software called Fusion 360, I designed a 3D case for my LED Volume Bar. I simply made the inner cavity the same dimensions as the PCB and made a 1/8 inch wall around it. I also made a hole for the barrel jack. I then printed this CAD design using a 3D printer.