Maker Pro
Maker Pro

Multiple Leds from single analog output

Hi, I'm new to this and need help with something simple.
I have a control with a 0-10vdc (5ma max) analog output that I want to use to control three leds. The idea is to have one led working at 2.5v another at 5v and the third at 7.5v while never having more than one of them on simultaneously. I'm thinking it should be very simple using some zeners but couldn't figure out how to turn off the lower voltage led when I raise the voltage to turn the others on. I appreciate any hint. Thanks.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
LEDs don't operate at a voltage, so what you describe doesn't make sense.

Perhaps you can describe what you want to do rather than how you think you can do it.
 
LEDs don't operate at a voltage, so what you describe doesn't make sense.

Perhaps you can describe what you want to do rather than how you think you can do it.

Thank for the reply Steve.

What I'm trying to do is to have a separate led indicator for each of the three states my machine can operate at. I used up all digital outputs available on my control but I have a 0-10v analog output available. I'm trying to power all three leds from that same analog output as follows:
Only led1 is on if the voltage is set (by my program) to 2.5v
Only led2 is on if the voltage is set to 5v
Only led3 is on if the voltage is set to 7.5v
I am aware that each led will have to have an appropriate resistor connected to it.

Am I making more sense now?
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
What you ask for is not trivial.

The traditional approach is to have a couple of comparators, each comparing the voltage with a reference, switching each of the LEDs on and off as required. (This is probably overkill)

The LM3914 chip has all of this built in.

However, you're already using a microcontroller and you've run out of pins. There may be better ways to use the pins you have so that you don't need any extra hardware.

This would be especially true if you wrote the software yourself (so you can easily change it).

Can you describe the uses for the other outputs (are you driving other LEDs for example? Are some pins used for digital inputs (from switches)?

There are lots of tricks which can be used to multiplex pins for different purposes (for example to read from a switch AND use it to illuminate a LED), or to use 3 pins to control 6 LEDs, etc.
 
What you ask for is not trivial.

The traditional approach is to have a couple of comparators, each comparing the voltage with a reference, switching each of the LEDs on and off as required. (This is probably overkill)

The LM3914 chip has all of this built in.

However, you're already using a microcontroller and you've run out of pins. There may be better ways to use the pins you have so that you don't need any extra hardware.

This would be especially true if you wrote the software yourself (so you can easily change it).

Can you describe the uses for the other outputs (are you driving other LEDs for example? Are some pins used for digital inputs (from switches)?

There are lots of tricks which can be used to multiplex pins for different purposes (for example to read from a switch AND use it to illuminate a LED), or to use 3 pins to control 6 LEDs, etc.


Thanks for the thoughtful reply.

Yes, I am writing the program but I'm driving real world high voltage motors and have already looked for ways to get more functionality out of the number of pins available to me.
In fact I'm still trying to figure out how to use another analog output to drive a relay so I can power six actuators out of four DO pins. I read on another thread that I could possibly do that with a ULM2XXX driver chip and I appreciate any other ideas if you have any.

For the LEDs, the LM3914 is exactly what I'm looking for provided that it works with fewer than 10 LEDs. At $2 a piece and since I am currently designing a relay board to go along with my control I'll go a head and give it a try.

Very helpful, thanks again.
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
A uC can provide 3 output states. High, Low and Off. This translates to controlling 2 loads per output.

Logic...

Output High: Load1 is On Load2 is Off
Output Low: Load2 is On Load1 is Off
Output Off: Load1 & Load2 are Off

Chris
 
Top