LED Volume Bar

by kevin200617 in Circuits > Audio

5168 Views, 50 Favorites, 0 Comments

LED Volume Bar

DSC_1058.JPG

My workshop is too bland. Despite the varnished, 80s-Esque wood planks that cover my walls, it lacks both color and of course: LEDs. Likewise, 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.

Theory and Op-amp Basics

opamp comparator theory.gif

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 the above figure for further help.

Op-amp Comparator Array

Op-amp comparator region graph.png

It is important to notice that in the first figure, 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 the first figure, we can create an op-amp comparator array. Using 8 op-amps and 8 resistors, we create 8 voltage "regions" (Refer to the above image). 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.

Audio Amplifier

LM386.jpg
LM386 Pinout.png

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

Schematic Design

lm358.png
Op-Amp Comparator.png

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:

Download schematics here

Explanation:

As you can see, most of the second schematic 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 the op-amp comparator array 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.

The first image is just a basic circuit design for the LM386. Read more about this circuit from Circuit Basics

Prototype

LED Volume Bar Prototype Demo
DSC_0958.JPG
DSC_0957.JPG

It is always smart to make a prototype before you make the final product. 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!

PCB Design

LED Volume bar PCB.png

After building the prototype I moved onto making a printed circuit board (PCB) for the final design. Since I made the schematic 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 the above figure) creating this PCB:

Download PCB and Gerber files here

Ordering PCBs

DSC_1033.JPG
DSC_1042 - Copy.JPG

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).

Soldering Time!

LED Volume Bar Build

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 along the way. 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 then finally the power adapter and audio plug.

Final Product

DSC_1058.JPG
LED Volume Bar

Once done with soldering, I checked over all my solder points, plugged in a 12v barrel jack and turned off my lights. Let the LED show begin!