LED Audio Waveform Display (100% Code Free!!1)
by TSJWang in Circuits > Audio
2888 Views, 23 Favorites, 0 Comments
LED Audio Waveform Display (100% Code Free!!1)
Hey Instructables!
I realized that I haven't published anything... for a year. Things have been busy. That doesn't mean that I haven't had any new projects, however.
This project is an LED Audio Waveform Display, which is 100% code free. Throw away your laptop because you won't be needing to type anything to get this circuit to work. (don't actually).
I got this idea while working in the Student Center at my school. I haven't worked with many IC chips in my lifetime, and I also haven't worked with pure electronics in a while, so I thought I'd build this project for fun and educational purposes.
Function:
This circuit will display the waveform for live audio. Just to be clear, the waveform is not the audio spectrum. It's the audio amplitude over time.
Check out the video to see what the finished project is!
Prototype and Theory
I'll explain more about how this circuit works, but first I would like to lay out some background on some of the major circuits in this project.
LM3916 Dot/Bar Display
You put an audio input into this thing, and LEDs light up. It's useful for VU meter and Spectrum Analyzer displays.
Here is a video from your's truly:
74HC595 Shift Register
You've probably seen people use these so they can use use more LEDs in their Arduino projects. Basically, you send in binary data to the shift register, and it displays that over 8 outputs (0 - 7). The inputs are clocked in on the rising edge of a clock signal, and confirmed when the latch pin is pulled high.
For the purposes of this project, we'll be using them a lot like this:
555 Timer Astable Multivibrator
555 timers are so fun to play with. One way to use this is as an astable multivibrator, which basically just means it turns on and off constantly at a determined duty cycle.
This will be our clock signal for the 74HC595 shift register.
Video:
Putting it together
Think about this:
- Take the LED outputs of the Dot/Bar dispaly...
- Feed it into the shift register...
The amplitude at each stage gets shifted down the shift register as time goes on. This would in effect show rate of change of amplitude over time.
And that gives us a live audio waveform display!
Parts and Equipment
This project requires a lot of parts. That's the trade-off of being code-free; A lot of components will be needed to get the desired results.
I happened to have a ton of 5.1k ohm resistors, 3.3uF, and 100uF capacitors. You don't have to use the same components I'm using. This isn't a precise RF circuit or anything. As long as your circuit works, just use values that are around what I used.
Also, the amount of parts you use will depend on how large you want your display to be. This will be covered in the next step.
Recommended Equipment/Supplies
- Soldering Iron and Solder
- Dremel
- Perfboard/Protoboard
- A computer (not to code, just to read this Instructable and do research)
Parts
- 1x TDA2822 Audio Amplifier
- 1x 555 Timer
- 5x 74HC595 Shift Registers
- 1x LM3916 Dot/Bar Display Driver
- 3x CD4011 NAND gates
- 1x 74LS04 Hex Inverter
- 40x LEDs (you decide on color and type)
- 4x 3.3uF electrolytic capacitors
- 4x 100uF electrolytic capacitors
- 1x 100nF ceramic capacitor (code 104)
- 5x 10nF ceramic capacitor (code 103)
- 54x 5.1k ohm resistors
- 9x 300k ohm resistors
- 2x 10k ohm resistors
- 1x 1.7k ohm resistor
- 1x 68 ohm resistor
- 1x 5k ohm trimmer/potentiometer
- 1x electret microphone
LEDs!!
You can choose to make your display as large or small as you want. The larger it is, the better the resolution.
The amount of columns you have can be 8*(n), and the amount of rows you want will be the number of shift registers you need * n.
For example, I chose to make my display 5 rows by 8 columns (40 LEDs). I need 5*1 shift registers.
To make my display, I soldered a bunch of SMD LEDs onto a separate perfboard. Each LED has it's own anode, and all shared a common cathode.
- When soldering in your SMD LEDs, just be careful about orientation and polarity. It's harder to notice the smaller the LED.
After you're done, I recommend soldering your LED display into your perfboard first. You want to build the circuit around the most important/flashy part of the circuit right?
Power Struggles
I usually use this module to power my 5v projects. It's super cheap and I can power the circuit with a few batteries.
However, after hours of debugging I realized that this power supply, although inexpensive, was extremely noisy. The transformer emitted a ton of EMF and messed with the audio amplification circuit.
I then decided to use USB power supply. After I finished building the entire circuit, the LED display just showed a bunch of oscillation.
- At first, I thought the problem was with the audio amplifier, so I replaced the TDA2822 like 2822 times.
- Then I realized the oscillation was from the LM3916 chip. Referring to page 11 in the Application Hints section of the datasheet, I thought I could fix the oscillation by adjusting the voltage divider values. nope.
I noticed that the oscillation correlated heavily to the 555 timer oscillation, and when the 555 timer was disconnected, there was no oscillation.
The outcome:
It turns out that when you combine 11 chips and 40 LEDs, they can draw a lot of current. The 555 timer is reputable for current spikes when it changes states. Apparently it drew more than the 0.5 amps which my laptop USB power provided.
Powering the circuit with ample current (haha) seemed to fix the oscillation issue. The oscillation could be replicated when not enough current was provided.
TL;DR
Don't use USB or a step up boost converter to power your circuit. You're going to want to use a 5v power supply that can handle current spikes. In my case, I ended up using a bench power supply.
Audio Amplifier (TDA2822)
The mic signal is too weak to trigger any output for the LM3916 circuit. We need an audio amplifier.
I used the TDA2822 because I've had very positive experiences with it. I'm sure you could pull of the same results with an LM386 audio amp.
For this circuit, look at page 4 of the datasheet. I used only one output for the stereo amp as shown in Figure 1. You can just follow the circuit I drew. Feel free to play around with the values until you get what you want. When it comes to audio circuits, each resistor and capacitor matters to get the right results, so try to adhere to the datasheet recommendations as much as possible.
Vertical Component (LM3916)
The LM3916 will be the vertical component of this circuit, displaying audio amplitude. The shift registers will be used to translate/shift the display horizontally.
This link from Sparkfun gives a good walk-through of the function and wiring of the LM3916 chip.
Since I didn't want to use 80 LEDs and 10 shift registers, I limited my display to 5 LEDs. The wiring for this circuit should be pretty straightforwards.
Signal Modification (Monostable Multivibrator + Inverter)
We can't just input the signals from the LM3916 into the shift registers.
If you observe the signals, it's actually turning on and off really quickly. The LEDs are actually oscillating really quickly to give the illusion that it stays on. It doesn't actually.
In fact, the signals are so short that they aren't long enough to be captured on the rising edge of the clock signal of the shift register. It's too fast to be picked up.
There are multiple ways of tackling this problem, but I decided that adding a monostable multivibrator to each of these outputs would fix it. What this circuit basically does is stay turn on for a set amount of time after a trigger signal is received.
Here's how to do with with NAND gates, and a video explaining it.
The time it stays on for is T = 0.7*RC.
I used R = 100,000 ohms and C = 3.3 e -6 F.
T = 0.231s.
After the signal is sent through the monostable multivibrator, it's still inverted. The LM3916 goes from HIGH to LOW. I added an inverter to make it LOW to HIGH.
Helpful datasheets:
Clock (555 Timer)
The 555 timer is the driving force for the 74HC595 shift register in this circuit. I'm using it for the CLOCK and LATCH pins on the the shift register. However fast you want the 555 timer to be depends on how fast you want your LEDs to scroll on the display.
This is a helpful link for learning about the different functions of a 555 timer. Check out the section "Basic Astable 555 Oscillator Circuit"
From that section, you'll see that the equation for frequency is
f = 1.44 / ((R1-2R2)*C)
Do calculations to see what components you need for your desired duty cycle. The 5k potentiometer/trimmer is useful here so you can fine tune the scroll speed.
I configured my 555 timer with whatever resistors and capacitors I had, and it happens to have a frequency range of 17.11 Hz to 28.52 Hz
Horizontal Component (74HC595 Shift Register)
This part of the circuit will be for translating/shifting the display along horizontally. The 74HC595 will give the display a second dimension so you can see change over time.
Kevin Darrah has a really good video if you really want to understand how these work:
Wiring this circuit is pretty straightforwards. LATCH and CLOCK are connected to the 555 output, some pins are pulled HIGH or pulled LOW, and the outputs are connected to resistors.
the annoying part
connecting to LEDs.
This is where you need to be careful about:
- considering the flow: do you want the LEDs to flow left to right or right to left? The shift register outputs from 0 to 7, so consider orientation.
- which shift register goes to which row of LEDs. As a reference, the output 0 from the LM3916 is the bottom.
In general, you need to be consistent and trace the outputs from the LM3916 to it's shift register, to it's proper LED row!
The End.
That's it for the circuit! It's finished but not perfect of course.
I did this project for fun with a limited variety of parts. There were many things that could be improved:
- LEDs were not efficiently wired or connected
- The display skips LEDs sometimes
- Too much current draw (could be fixed with more accurate component values)
- Inefficient energy draw
- Inefficient space usage
- Inefficient construction
- Just inefficient design in general lol
There IS a better version of this project, design by Forrest Mims. It uses the LM3916 and the CD4017 Decade Counter as the main chips in the circuit. It's much simpler. It's a Solid State Oscilloscope. This might be fun to look into!
I hope you all enjoyed this project as much as I enjoyed building it.