Electronic – Light Organ — Need help with LED grid

analogfilterrectifiervoltage-regulator

I'm building a light organ for a school project.

I've got a crossover to separate the frequencies, now I need to make an LED grid.

The input will be an constantly changing analog signal (whose voltage ranges I don't actually know yet, but I can adjust that as needed later).

First, I need to rectify the signal (as I understand LEDs tend to burn out when a negative voltage is applied across them?), then I'd like to light up a different number of LEDs based on the value of the rectified signal.

  • If it's low voltage (but higher than zero), then I'll want 4 (or maybe 6 or 8 or whatever) of some color LED to light up (say blue).

  • At a slightly higher voltage, I'll want the 4 blue LEDs to light up, but also 4 more LEDs (say green) to light as well.

  • At a slightly higher voltage, I'll have the 4 blues and 4 greens plus 4 yellows light up.

I'd like to have at least 4 different stages (each stage being 4 more LEDs light up), and this needs to be voltage regulated (I don't want to blow the blues, when I have a high enough voltage to turn on the yellows).

The input voltages will be changing pretty fast, so ideally this needs to be pretty responsive.

NOTE: Because this is a school project, I need to be able to build as much of this as possible with just basic components (R's, L's, C's, transistors, op-amps, diodes, etc) as opposed to just buying ICs which do everything for me.

I figure I can rectify it with 4 diodes made into a diamond (I forget what that's called) at the front, and I think I should be able to use switches with varying resistors to turn on each new set of LEDs (will that work?), but how do I regulate the voltage so that I don't blow the first stage (blue) LEDs when I turn on later stage (yellow) LEDs?

Best Answer

There are many ways to achieve your result, starting from using some diodes to making an analog to digital converter.

In any case you need to put a low pass filter at the beginning of the signal processing chain since you don't want the led to flicker. What you need is called an envelope detector:

env schematic env result

in blue \$V_{in}\$, in red \$V_{out}\$. You will need to choose the RC time constant so that it is low enough to produce acceptable ripple at low frequencies, but high enough to be able to follow the signal when it changes rapidly. I'm assuming we're treating audio signal, so the range is 20Hz to 20kHz, that is 50ms to 50us, a good tau will then be \$\tau=\sqrt{50ms\cdot50us}=1.6ms\$. You might want to use a precision rectifier if you don't want to amplify your signal too much.

Now you have a voltage that is proportional to the input signal amplitude, how can you possibly light up the leds sequentially?

The easiest way that comes to mind is using only the leds: as you know the leds have a characteristic forward voltage drop that can change significantly changing the color. You can make chains of four leds in series, connect them in parallel and they would light in sequence. Problem is that you can't choose the sequence, the forward voltage drop is unreliable, you must add series resistors to protect the leds that light first... It would be a mess. And of course the input signal must be carefully regulated to have it between two very precise values:

  • upper voltage is limited by the maximum forward voltage that the first lighting chain can withstand
  • lower voltage is limited to a value probably over zero because you want to light the first chain when the signal is a bit over zero, but the first chain need something around 5V to light

So what can you do? There is a solution that I believe would work that needs only some BJT's:

schematic

simulate this circuit – Schematic created using CircuitLab

What happens here? As you know a BJT "turns on" when its \$V_{BE}\$ reaches approximately 0.7V. In my sketch the signal coming from the envelope detector, ie \$V_s\$, is fed to all the bjt's bases through a resistor, but as you can see Q1 and Q2 have two and one diodes between the emitter and ground. So what basically happen is that when \$V_s\$ reaches 0.7V only Q3 turns on, lighting the rightmost chain (I drew only one led per chain because I am lazy). To turn on Q2 you need to forward bias the base-emitter junction and the diode, that's 1.4V and that's when the second chain kicks in, and so on. The uppermost resistors are there to limit chains currents, while the base resistors should be chosen to guarantee saturation of the bjt but avoid exceeding the base maximum current. This is a nice solution, you only need a few transistors, you can even fine tune the turn on voltage adding a potenziometer before each base: one side to signal, one side to ground, center tap to base through base resistor. Problem is that of course bjt's are linear components and you might end up with chains that are nor on nor off because the bjt is "just starting to conduct", ie it is making the transition from cutoff region to forward active region. The chain will be at full power when the transistor finally reches saturation.

The last solution uses opamps: that's quite an overshoot but as I understant you are building this circuit for educational purposes so using op amp can actually be a plus. What you need is a comparator (thanks to Analog Devices):

enter image description here

I am not analyzing the circuit because you can find plenty of material on it, because that's not your question and because Analog gives us the formulas. What you want to do is make one comparator per chain, tie the chain between the op amp output and ground (don't forget the limiting resistor!). You don't need Rpull-up.

\$V_{OH}\$, output high, and \$V_{OL}\$, output low, are parameters of the particular op amp you will be using and you can find them on the datasheet. You start choosing \$V_{REF}\$, put it at the voltage you want the transition to happen, so let's say 1V for the first chain, 2V for the second and so on. From \$V_{REF}\$ you can calculate R1 and R2, assume R1+R2=\$100k\Omega\$. You can also put a 100k\$\Omega\$ potentiometer on the inverting input and fine tune the \$V_{REF}\$ after. Now choose HYST, a good value might be 200mV but it depends on your signal swing and the noise. 100mV is probably more than enough. Assuming HYST=200mV you can calculate R3 and R4, stay in the tenths of k\$\Omega\$. And you're done! Connect all the comparators input to the envelope detector output and that's it. Actually you might want to add a buffer stage in the middle, the comparator input resistance can be quite low. Just throw in a non inverting buffer and you are done.