How to Create a Beer Bottle LED VU Meter
Create your own Beer Bottle LED Volume Unit Meter!
This instructable will show you how to create a LED beer bottle VU Meter. A volume unit meter is a device that is used to display a relative volume of audio signals. Basically, sound gets converted into electricity, then amplified and run into a dedicated IC (Integrated Circuit). The IC then determines the level of sound and outputs it accordingly onto its outputs. This particular VU Meter uses a LM3915 Dot/Bar Display Driver to determine the sound level. This circuit is more flexible than a regular VU Meter though, due to the fact that I incorporated a microcontroller into the project. This makes it a little more complex, but also way more flexible.
The main reason that I built this project is because I have always been fascinated with LEDs. There is just so many cool projects that a person can make with them. Also, a couple years ago I made a Chevrolet logo VU Meter which didn’t use a microcontroller. Although it was really cool, there wasn’t a lot that I could do with it once it was made. I had the options of bar mode or dot mode and that was it. With the help of a microcontroller, you can design a project so that you are able to turn on any individual LED or groups of LEDs at any of the 10 different sound levels. That makes things a little more challenging, but also more interesting.
By following each and every step, you will be able to complete your own beer bottle LED VU Meter just like this one. Or if you are feeling really ambitious, create your own customized LED VU Meter and just use this instructable as a guideline.
Step 1: Skills Required
This isn’t a very difficult project to complete, however it does take quite a bit of time (especially if you make the PCB yourself). There are more than 330 drill holes in the PCB, 78 LEDs that have to be soldered into place and 224 SMD connections. Therefore you should possess the following skills:
– Basic knowledge of electronics
– Basic knowledge of boolean logic and digital circuits
– Know how to solder (This includes SMD parts)
– Know how to create a PCB
– Know how to program a PIC18F4550 microcontroller
– Know how to use a multimeter (This is used if you run into errors)
– Know how to program in C
– Know how to use the MPLAB IDE and the C18 compiler
With enough time and patience, anyone can complete this project. If you are looking at this project right now and thinking that it may be too difficult for you, take baby steps and start building the smaller circuits inside of the main circuit and get accustomed to them. For example, play around with the PIC18F4550 and get to know how it works. Then play around with the LM3915 so you know how to operate it, etc. The schematic may seem intimidating, but its really not. Like most electronic circuits, it is comprised of a bunch of smaller electronic circuits all linked together.
Step 2: Tools Required
Here is a list of tools and supplies that were used to build this project:
– Soldering Iron
– Flux Pen
– Drill/Rotary Tool (If making a PCB)
– Needle Nose Pliers
– Side Cutters
– Scalpel/Utility Knife (Used for PCB touch-ups)
– PIC Programmer (I used a MPLAB ICD2 Clone)
– Anti-Static Tweezers for small SMD components
– Perfboard/Breadboard or Materials required to make a PCB
– Toothbrush and Rubbing Alcohol to clean the flux off the PCB
All of the tools are pretty basic and should be found on most electronic hobbyists workbenches.
Step 3: Components Required
Here is a list of the following electronic components required:
34x – 5mm Green LEDs
28x – 5mm Blue LEDs
16x – 3mm Yellow LEDs
2x – 1N4148 Fast Switching Diodes
1x – 1N4007 Rectifier Diode
1x – PIC18F4550 TQFP PIC Microcontroller
4x – 74HC595 SOIC 8-Bit Shift Registers
1x – LM3915N (DIP) Dot/Bar Display Driver
1x – LM7805 TO-220 +5V Regulator
2x – IRL510 TO-220 Logic Level MOSFETs
2x – MMBT2222A SOT23 Transistors
2x – 27pf 0805 Capacitors
1x – 0.1μF Ceramic Disc Capacitor
1x – 1μF Electrolytic Capacitor
1x – 4.7μF Electrolytic Capacitor
2x – 22μF Electrolytic Capacitors
1x – 47μF Electrolytic Capacitor
1x – 220μF Electrolytic Capacitor
36x – 100Ω 0805 SMD Resistors
8x – 10kΩ 0805 SMD Resistors
3x – 50Ω 0805 SMD Resistors
1x – 10kΩ SIL9 Resistor Network
1x – 10kΩ Trim Potentiometer
1x – 390Ω Through-Hole 1/4W Resistor
1x – 2.7kΩ 0805 SMD Resistor
1x – 2.2kΩ 0805 SMD Resistor
1x – 1kΩ 0805 SMD Resistor
1x – 4.7kΩ 0805 SMD Resistor
1x – RJ-11 6p6pc ICSP Connector
1x – 2-Pin 0.1″ Molex Connector
1x – 2-Pin 0.1″ Molex Header
1x – Electret Condenser Mic
1x – SMD Momentary Tactile Switch
1x – SPST Rocker Switch
1x – 2-Position DIP Switch
1x – 20MHz Through-Hole Crystal
1x – TO-220 Heat Sink
All these components I had already had on hand, but I would estimate the cost of this project to be around $40. I have shown a couple of the components used in this project in the photo.
Step 4: Schematic/PCB/Software/Data Calculator
Before we go on to how it works, I have posted the downloadable zip file below which includes:
– Circuit Schematic
– PCB Top and Bottom Layers (PDF and PNG)
– PCB Top Silkscreen (PDF and PNG)
– VU Meter Data Calculator Program
– PIC18F4550 Firmware
I thought I’d post this right away in the instructable so you have it as we go through the steps, rather than get it at the last step when we’re finished.
Step 5: How It Works
I will try to explain how it works in the next couple of paragraphs, however if you are still unclear as to how it works after reading them, check out the photos (they look really unprofessional, but they might help you understand the concept better). Just take your time and if you have any questions feel free to ask.
The first stage of the circuit is an electret mic pre-amplifer. An electret mic is great for applications like this because it is small and versatile, but it has a drawback. When it picks up sound it only puts a small signal, much too small for the LM3915 to even notice it. Therefore we have to amplify the signal of the electret microphone. The two MMBT2222A transistors are the heart of the amplifier and bring the signal of the electret mic up to a large enough value for the LM3915 to work with. Now the sound that goes into the mic gets converted into AC electricity. In order for the LM3915 to be able to work with the amplified input signal, we need to convert the AC signal to a DC signal. This is taken care of by the 1N4148 diodes. Once the signal is converted to DC, it is fed into the signal line of the LM3915.
The second stage of the circuit is the LM3915 itself. We don’t need to actually know how the LM3915 works, we just have to know how to use it. If your curious, on page 7 of the LM3915 datasheet it shows a simplistic version of the internal wiring diagram. So, we now have a valid signal going into the IC, but how does the MCU (Microcontroller Unit) know what sound level the LM3915 is at? Well if you look at the schematic you’ll notice that each of the LM3915s outputs (LED1 – LED10) are fed into an input on the PIC18F4550. Each output is also tied high by a 10k resistor (I used a resistor network) because the LM3915s outputs are an open collector type. Meaning, the LM3915 can force its outputs into a low state (0v) but it cannot force them into a high state (+v). So when an output is not being forced low, the resistor is keeping it held high. If all of the outputs are in a high state, the LM3915 isn’t detecting any sound. If any or all of the outputs are low, the PIC18F4550 can then interpret the intensity level of the sound.
The third stage of the circuit is the PIC18F4550. The LM3915 may be the heart of the circuit, but the microcontroller is definitely the brains. This stage reads the outputs of the LM3915 and turns on the LEDs according to the sound level. The nice thing about using a microcontroller is that we can turn on any of the inside LEDs (the 28 blue LEDs inside the “bottle”) that we want. Therefore, there is an endless amount of animations that we can create and display (ok, maybe not endless…). I have also added an element to this circuit so that we can control the 16 3mm yellow LEDs which form the lemon at the top of the bottle and we can control the 34 5mm Green LEDs which form the bottle.
The fourth stage of the circuit is the 4x 74HC595’s. Once the MCU has read the sound level, it will then figure out which LEDs it wants to turn on and which LEDs it wants to turn off (this is stored in 4 bytes of data), then it will serially transmit the 4 bytes of data (one byte to each 74HC595) and latch it. Once the 74HC595’s have been latched, the individual LEDs will either turn on or off.
Step 6: Power Supply
The power supply is the most important part of any electronic device. It doesn’t matter how great the device is, having an unreliable power supply can ruin all of that. And having no power supply at all…well that just speaks for itself. In order for us to determine the requirements for a power supply we need to perform a few calculations.
In the schematic you will notice that there are 8 rows of 4x Green LEDs in series and 1 row with only two green LEDs in series, 3 rows of 5x Yellow LEDs in series and 1 row with only one yellow LED and 28x individually controlled Blue LEDs.
LED Voltage Drops:
Blue LED = ~3.3v
Green LED = ~2.2v
Yellow LED = ~1.9v
LED Current Calculations
Blue LED = (5.0v – 3.3v) / 100Ω
= 17mA per Blue LED
Green LED = (10.0v – (4 LEDs * 2.2v/LED)) / 100Ω
= 12mA per Green LED row
Yellow LED = (10.0v – (5 LEDs * 1.9v/LED)) / 50Ω
= 10mA per Yellow LED row
Max LED Current = (9 Green LED rows * 12mA/row) + (4 Yellow LED rows * 10mA/row) + (28 Blue LEDs * 17mA/LED)
I595 = Max 74HC595 Current Draw From All 4x 74HC595’s
ICC (Io @ 0mA) = 80uA per 74HC595
I595 = 80uA * 4 74HC595’s
Max PIC18F4550 Current @ 48MHz
IMCU = Max PIC18F4550 Current
IMCU = 50mA
Max LM3915 Current @ 20v (All outputs off)
ILM3915 = Max LM3915 Current
ILM3915 = 9.2mA (There was only ratings for 5v and 20v, so I chose 20v to be safe even though were running at 10v)
The last 3 values are found in each devices datasheets. I left out a few calculations where there is still current draw in the circuit just for the sake of simplicity (We got the main sources of current draw, the other few are next to negligible). We’ll make sure that we use a power supply that can supply more than the bare minimum that we need. So an approximate value of our current draw is:
Current Drawn From +10v Power Supply
Isupply = Total Current Drawn From +10v Power Supply
Isupply = 624mA + 320uA + 50mA + 9.2mA
Checking my VU Meter when it is running at its max power consumption (All LEDs on) it draws 660mA. The reason it is lower than what we calculated is because we used the maximum current values in our calculations and not the typical current values (all those values are located in the datasheets). So at the very least, we’d want a +10v power supply that can supply 700mA. If you wanted to be safer (as I do), we’d use a +10v power supply that can handle 1.0A of current draw. The one I am currently using can actually handle up to 2.0A, which is way more than we need.
I run this VU Meter at +10v, but it is capable of running reliably from +9v to +18v. Keep in mind that you will want to change the green and yellow LED resistor values if you use a higher voltage or you may put too much current through them and burn them out. Also, if you put a higher voltage through it you will need to use a heatsink that can dissipate the extra heat produced by the LM7805.
Step 7: Wasted Power and Heat Dissipation
Now we need to calculate the current that is drawn from the LM7805 +5v regulator so that we can calculate the power that it wastes. If you look at the schematic you’ll see that the green and yellow LEDs run right off of the +10v supply. The only components that use power from the +5v regulator are the 74HC595’s, the PIC18F4550 and the 28 Blue LEDs. So we can calculate Ireg by adding up the current draw of those components.
Ireg = Total Current Drawn From +5v Voltage Regulator
Iblue_total = Total Current Drawn From The +5v Regulator With All Blue LEDs On
Iblue_total = 28 Blue LEDs * 17mA per LED
Ireg = IMCU + I595 + Iblue_total
= 50mA + 320uA + 476mA
Now, because we are using a linear voltage regulator to step our voltage down from +10v to +5v for the PIC18F4550 and the 74HC595’s, we are going to have some wasted power. The larger the current draw through the linear regulator, the more power that will be wasted in the regulator. Here we will do some calculations and find the wasted power in the voltage regulator:
Vin = +10v
Vreg = +5v
Ireg = 526.3mA
Pwasted = (Vin – Vreg) * Ireg
= (+10v – +5v) * 526.3mA
The power that is wasted by the LM7805 is 2.63W. Now you may be saying “Big deal, we’re not running it on a battery so we can afford to waste that power.” The only problem is that when a linear voltage regulator wastes power it turns that wasted power into heat. This is bad news for the LM7805, therefore we need to attach a heatsink to it to help it dissipate the heat that it generates. If I would have had a switching +5v regulator on hand I would have used it instead of the LM7805, simply because switching regulators are more efficient than linear regulators, which means less heat.
Step 8: LED Connections
This step builds off of Step 4: How It Works, so make sure that you understand step 4 quite thoroughly before you continue on to this step. In this step we will have a look at the PCB board and see where all of the LEDs are placed. From there we can learn how to write data to the 74HC595 shift registers and how to control the state of each individual LED inside the “bottle” (the blue LEDs).
Before we can start writing any code to control our LEDs, we first need to find out where exactly each LED is placed on the PCB. If you look at photo #2 you will see a silkscreen of the PCB board. The outside LEDs that make up the bottle shape are all green LEDs. We cannot control these individually, we can either turn them all on or all off. The same goes for the yellow LEDs that make up the lemon at the top of the bottle. Right now we are going to concentrate on the inside LEDs which are the blue LEDs that we can control individually. On the schematic all of the LEDs are labeled in a left to right, bottom to top manner.
Now, to know which LEDs to turn on we need to figure out which LED connects to which pin on which 74HC595. I have it set up so that if you count in a left to right, bottom to top manner, every 8 blue LEDs will make up one 74HC595 IC. The top 4 blue LEDs are connected to the 4th 74HC595 (IC4) and only use half of its outputs. Here are the LED connections to the 1st 74HC595 (IC1), as seen in photo #3.
QH -> LED7
QG -> LED8
QF -> LED9
QE -> LED12
QD -> LED13
QC -> LED14
QB -> LED17
QA -> LED18
The first 8 blue LEDs connect to IC1, the next 8 connect to IC2, the next 8 connect to IC3 and the next 4 connect to IC4. They all follow the same format as IC1**. Now I know what you’re thinking, “Why didn’t he wire QA to LED7 and QB to LED8 and QC to LED9…etc. instead so they all go in a straight through order?” Seems kinda backwards huh? Well the reason I chose to do it the way I did is because it made the PCB much easier to route. So I made it easier to route the hardware, but now it may make the software a little harder to write (its still quite easy).
Step 9: Controlling The LEDs
Now that we understand how the LEDs are wired up, we can begin learning how to write data to each shift register so that we can control the LEDs. When we write data out of our PIC18F4550, it will first go into IC4. Then after IC4 fills up with 8 bits of data (1 byte), every bit shifted into IC4 after that will cause the MSb (Most Significant bit) of IC4 to be shifted into IC3 which will become the LSb (Least Significant bit) of IC3. So on so forth, all the way to IC1. I won’t go into great detail with this because there are already quite a few instructables here that deal with shift registers, so if you don’t fully understand the concept you can read up on them. I also posted a link to a good tutorial on 74HC595 shift registers at step #16.
Every LED is represented by 1 bit. In order to control each LED, we have to send 28 bits to the shift registers from the PIC18F4550. Seeing as we use the SPI protocol to transfer data to the shift registers, we actually end up sending 32 bits of data (4 bytes). This is because the SPI protocol only sends data 8 bits at a time with this particular microcontroller. Anyways, the extra 4 bits are not used and we will just ignore them (we’ll always leave them as 0). Once we shift the data into the 74HC595’s, we then “latch” them. Which means that whatever data we shifted into them, it will put that value (1 (high) or 0 (low)) onto its outputs. We’ll head into some examples now which may clear up some questions.
Say we want to turn all of the blue LEDs ON. What would be the values for each byte of data we shift into each register? This is where some basic boolean logic will come into play. Seeing as these LEDs are active high (they turn on when we write a 1 to them) we have to write a 1 to turn them on or a 0 to turn them off. So if we want them all on, we would have to write this to the shift registers:
MSb Lsb Hex
IC1 – 1st Byte Sent -> 11111111 0xFF
IC2 – 2nd Byte Sent -> 11111111 0xFF
IC3 – 3rd Byte Sent -> 11111111 0xFF
IC4 – 4th Byte Sent -> 00001111 0x0F
So that one was pretty easy. We just made every bit that represents an LED equal to 1 (+5v). Then we’d latch the data in and it’d turn on all of the blue LEDs. Of course the 4 bits that are 0 are those ones that we are going to ignore and aren’t connected to any LEDs.
Say we want to turn all of the blue LEDs OFF. This is another easy one, but what would we write to the shift registers?
MSb Lsb Hex
IC1 – 1st Byte Sent -> 00000000 0x00
IC2 – 2nd Byte Sent -> 00000000 0x00
IC3 – 3rd Byte Sent -> 00000000 0x00
IC4 – 4th Byte Sent -> 00000000 0x00
Now we just made every bit that represents an LED equal to 0 (0v). Then we’d latch the data in and it’d turn off all of the blue LEDs.
What data would we send to turn on LED7, LED8, LED42, LED43, LED47 and LED52? All the other LEDs not mentioned should be turned off.
bit 7 —— bit 0
MSb Lsb Hex
IC1 – 1st Byte Sent -> 11000000 0xC0
IC2 – 2nd Byte Sent -> 00000000 0x00
IC3 – 3rd Byte Sent -> 00000110 0x06
IC4 – 4th Byte Sent -> 00001001 0x09
Once we latch it, it’ll turn on LED7 and LED8 which are bit 7 (QH) and bit 6 (QG) on IC1. Also bit 1 (QB) and bit 2 (QC) on IC3 will go high, turning on LED42 and LED 43. On IC4, bit 0 (QA) and bit 3 (QD) will go high, turning on LED47 and LED52.
Its really simple to turn on any of the inside LEDs. Just have a look at the schematic, figure out where the LEDs are that you want on and off, convert it into 4 bytes and your set. Next we’ll learn how to use functions that have been written for the PIC18F4550 to transmit the data to the shift registers.
For more detail: How to Create a Beer Bottle LED VU Meter
EasyEDA: Ideas for Circuit Design, Innovation for Electronics Access
Free Circuit Design: Schematic – Simulation – PCB Layout – Gerber Viewer
Cheapest PCB Prototype: Only $2 for 10pcs 10×10cm PCBs, 24 hours Quick Turn, DHL Delivery in 3 Days
Current Project / Post can also be found using:
- how to convert audio signal to dc for VU meter MCU
- How to Make Microcontroller
- pic16f88 led vu meter 16 led