LED circuit question

Started by ugly_guitar_guy, July 18, 2013, 12:46:18 PM

Previous topic - Next topic

ugly_guitar_guy

Hey guys, I have a question that's only partially stompbox related, but figured you all might be able to help me out with this one.

I've started with my LED circuit here:



Think of this as repeatable with how ever many LED's you want to run together. Positive is on the left, ground on the right, and what I'm looking to do is find out how to place my diodes in this circuit so that when I close switch #1 only LED one comes on, but when I close switch 2, LED 1 and 2 come on, and when I close switch 3, LED 1 2 3 come on, etc. I'm probably going to repeat this 24 times (think of a sound meter). Any help you guys can give me to accomplish this??

Thanks!
Check out my metal band here: www.facebook.com/hollowshell
or
my personal effects building page here: www.facebook.com/brotronics

Digital Larry

Can't draw the circuit, but one way you could do that is by adding more diodes (not of the light emitting variety) that would block switch connections from interfering with each other.  By the time you get to 24 you're going to have a LOT of diodes on the board.
Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

ugly_guitar_guy

Quote from: Digital Larry on July 18, 2013, 12:57:06 PM
Can't draw the circuit, but one way you could do that is by adding more diodes (not of the light emitting variety) that would block switch connections from interfering with each other.  By the time you get to 24 you're going to have a LOT of diodes on the board.

I guess that's the part I can't figure out, or if it's even possible because everything has to happen before the switch, it can't happen afterwards, and I don't know if that's possible. I don't have a problem with lotsa diodes either. My last design used 36 of them to get the desired effect, but I can't wrap my head around this one for some reason...
Check out my metal band here: www.facebook.com/hollowshell
or
my personal effects building page here: www.facebook.com/brotronics

ugly_guitar_guy

Nevermind, got it.



This way when the 2nd/3rd/4th. etc switch is on it completes the circuit and ground the LED's behind it, but not forward. That was stupid simple. Geeze. Sorry for the waste of space guys!
Check out my metal band here: www.facebook.com/hollowshell
or
my personal effects building page here: www.facebook.com/brotronics

ugly_guitar_guy

Check out my metal band here: www.facebook.com/hollowshell
or
my personal effects building page here: www.facebook.com/brotronics

Digital Larry

#5
Hmmm... that's interesting in that you only needed one extra diode per LED, but consider that you're going to start stacking up voltage drops across each diode.  Unless you have a lot of headroom in your power supply you will run out of volts to make your LEDs turn on, and the voltage across the LED will change depending on which switch was thrown.  My idea (which may or may not hold water) was that the first switch/LED would need 1 extra diode, the second would require 2, etc. but ultimately you only wind up with 1 extra diode drop in series with any given LED.

[Edit] - think of it this way.
LED #1 has to go on when ANY of the switches are thrown.  So it is wired, through series diodes, to every switch.  1 diode per switch... 24 LEDs?  24 diodes.
LED #2 has to go on when any of the switches > 1 are thrown.  So it is wired, through series diodes, to every switch > 1.  23 diodes.
...
LED #24 only turns on when switch #24 is closed.  So just wire it directly to that (or thru 1 diode, but you don't need it).

Switch 24 has 24 diodes hanging off it going to each LED.  Or 23 if you leave off the last one.

The multiple diodes tie together at the cathode (bar) of the LEDs.
Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

mistahead

Quote from: Digital Larry on July 18, 2013, 05:34:31 PM
Hmmm... that's interesting in that you only needed one extra diode per LED, but consider that you're going to start stacking up voltage drops across each diode.  Unless you have a lot of headroom in your power supply you will run out of volts to make your LEDs turn on, and the voltage across the LED will change depending on which switch was thrown.  My idea (which may or may not hold water) was that the first switch/LED would need 1 extra diode, the second would require 2, etc. but ultimately you only wind up with 1 extra diode drop in series with any given LED.

[Edit] - think of it this way.
LED #1 has to go on when ANY of the switches are thrown.  So it is wired, through series diodes, to every switch.  1 diode per switch... 24 LEDs?  24 diodes.
LED #2 has to go on when any of the switches > 1 are thrown.  So it is wired, through series diodes, to every switch > 1.  23 diodes.
...
LED #24 only turns on when switch #24 is closed.  So just wire it directly to that (or thru 1 diode, but you don't need it).

Switch 24 has 24 diodes hanging off it going to each LED.  Or 23 if you leave off the last one.

The multiple diodes tie together at the cathode (bar) of the LEDs.

This was what I was thinking, but was not going to comment out of newbidity - each time you add an LED you are compounding the amount of LEDs you need to control/isolate, and thefore the diodes required to do so - without the experience of the Guru guys I thought you were looking at ending up with a exponential issue screwing scaleability....

Doesn't RG talk about being able to do basically this exact sort of switching using PIC or something similar somewhere around here?

Digital Larry

Quote from: mistahead on July 18, 2013, 09:31:29 PM
- without the experience of the Guru guys I thought you were looking at ending up with a exponential issue screwing scaleability....

If each added switch/LED adds a number of diodes equal to the number you already have - it's exponential.  Nice call!   :icon_smile:

http://en.wikipedia.org/wiki/Exponential_growth
Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

mistahead

Heh - yeah I wasn't sure if my understanding of the circuit that was required was right, I knew that my definition of exponentials was fine  :icon_wink:

Anything that creates exponential growth has a cap on its scaleability so really comes down to application there, but again - there are other ways to do what you want with IC's that will keep the parts count low and will scale much better, I'm just not ofay with them.

ugly_guitar_guy

Woah, so in essence I'm actually looking at needing 300 diodes to make this happen properly??? That's completely impractical. There's gotta be a better way to go about this because I have very limited room to work with it. Any other ideas??
Check out my metal band here: www.facebook.com/hollowshell
or
my personal effects building page here: www.facebook.com/brotronics

WaveshapeIllusions

Voltage divider string. Set up a string of resistors from V+ to ground, with the LED cathodes connected to each resistor junction. The LED closest to ground might only require the forward voltage to turn on, but each LED up will require that plus whatever the voltage divider set its cathode to. All the anodes can probably be connected together. Each switch places a different voltage at the anodes. Switch 1 could be enough to turn the bottom LED on, switch 2 enough for that and the next one, and so forth until all are on. You just need to pick a supply voltage and division ratio. You may want to make the supply a bit higher for the anode side, to account for the LED forward voltage.

Digital Larry

I would probably do it this way:

Use a PIC, Arduino or some other small easily programmable microcontroller.
Arrange 24 switches in an 8 x 3 matrix, with isolating diodes.  8 pins go to inputs of PIC.  3 rows are driven high one at a time by the PIC.
Connect your LEDs to 3 chained latchable shift registers connected to a couple of GPIO outputs of the PIC.
Write the program to scan the switch matrix and determine the highest switch that is turned on.
Create a 24-bit pattern that represents that and then shift it out to the shift registers. 
Repeat 10x per second or whatever seems right.

The resistor-chain approach might work but I'm having trouble visualizing it.
Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

PRR

> think of a sound meter

LM3915?

> when I close switch #1 only LED one comes on, but when I close switch 2, LED 1 and 2 come on, and when I close switch 3, LED 1 2 3 come on, etc.

This is a job for a Series Circuit.



In addition you only need 10mA for ALL the LEDs, instead of 10mA *each*. If any LED is lit, load is constant, no clicks in the audio. (A slight mod absorbs the current when no LED is lit.)

However if you wanna go 24 LEDs you want 48 Volts; more if you like green blue or white. 

The diode matrix proposed above works for "a few" LEDs but gets out of hand for "many" LEDs.

Here's a way with 2 Q 4 R per LED. 14 extra legs to solder, times 24 is 336 legs, which is somewhat less than the ~~600 legs of the 300-diode approach. It can be scaled to a few volts, but does use zero to 240mA for zero to 24 LEDs.

  • SUPPORTER

ugly_guitar_guy

Thanks PRR,

That makes much better sense, but it seems like I may be imagining something that just isn't possible. I was trying to work out the kinks in a smaller, few LED scenario, but realistically I'm trying to make this happen with 48 LED's, 2 per switch (so 24 circuits of 2 LED's) for an appearance similar to a sound meter (8 sets of green, 8 sets of yellow, and 8 sets of red). On top of that, I'm trying to make it happen with just 18V (two 9V batteries), and I am absolutely, 100% stuck with my momentary switch being the very last part of my circuit, so everything has to happen before the final ground connection.

Last night I set up a 10 segment LED block on my breadboard and created a circuit like my original idea just to see if I was on the right track.



I used 580R resistors (cause that's what I had 10 of) and 1N4148 diodes. Strangely, when I connected ground to LED1, all of the LED's came on, and when I connected ground on LED2, 2-10 came on, then 3 through 10 and so on. I'm having trouble understanding why the diode is working backwards of how I thought it would be operating. Ultimately though, the last led was definitely dimmer than the first because of the voltage drop from the diodes, so I'm going to have to keep experimenting with this to see if it's even a possibility to make happen.

Is there a way to calculate a smaller resistor for each set of LED's to offset the voltage drop from the diode? Just for example what if my first set of LED's require a 680R resistor to keep from burning out, but the next would be slightly smaller because of the voltage drop to allow more voltage directly from the +, and the next slightly smaller, and the next smaller, and so on until the end? Does that sound like a reasonable and measurable theory?

Thanks to all of you that jumped in on this so far. You guys are always a wealth of knowledge!
Check out my metal band here: www.facebook.com/hollowshell
or
my personal effects building page here: www.facebook.com/brotronics

PRR

> ground to LED1, all of the LED's came on, and when I connected ground on LED2, 2-10 came on, then 3 through 10 and so on. I'm having trouble understanding why the diode is working backwards...

Looks correct to me. Maybe how you look at it? I like to draw so the current "falls top to bottom", and diodes pass in the direction of the arrows.



The resistor voltage drops 0.6V at each stage. So 24 diodes lose 14.4V. There's another 1.5V-4V in LED. So extending the numbers on my mark-up, but assuming 18.0V supply, you have 12V on the first resistor and nearly-zero voltage on the last resistor.

If you scale the resistors by their all-LED voltages, then with just one LED it gets way too much current.

You could try current-sources, but that's more legs to solder. (One R and one PNP per LED, plus a master bias source, or find Current Regulator diodes {selected JFETs}.)

That 0.6V diode-drop adds-up. There's alternative diodes with ~~0.4V drop, better but still adds-up. There's a bazillion Active Ideal diode schemes, none I would want to wire two dozen of. (PNP NPN and one R may be the simplest almost-Ideal diode.)

Note that the last diode in the array must handle current from ALL the LEDs. Little 1N4148 may stand it on breadboard but maybe not a long concert on a summer day. 1N4007 is ample, not costly, and has lower drop than '4148 (at the same current); but still adds-up.

I say again: LM3914. Even though you seem to want switch control instead of voltage control. '3914 has the dot/bar logic inside, has the current limiting inside, can be stacked to 20 and I think to 30 (or 24) LEDs. Your switches work a resistor string to generate a (say) 0V to 2.4V voltage. The '3914s are stacked to a 2.4V reference with thresholds 0.1V apart. Tolerances should be tolerable.
  • SUPPORTER