EEVblog Electronics Community Forum
Electronics => Beginners => Topic started by: ZeTeX on October 14, 2016, 04:58:04 pm
-
Lets say I have 5 leds, lets call them A B C D E.
I have a voltage source that can vary it out from 2-10V for example, now I need a circuit that when the voltage source output 3V (for example), led "A" turns on. now when the voltage source output 4V, led "B" turns on but led "A" turns off., then when the voltage source output 5V, led "C" turns on but led B turns off, so only 1 led at the time turns on, so I cant just put a few comparators with the non inverting input sensing the voltage and the inverting input having the threshold voltage because then A and B for example are going to turn on.
0 = off, 1 = on
(https://i.gyazo.com/410e1712ca6408409441103739c930e4.png)
*under no circumstances I can have 2 LEDs turn on at the same time (for more then a few ms), there has to be ALWAYS at least 1 led on, the circuit has to be that there is no way of 2 LEDs turning on at the same time.
-
What if the output is 3.5V?
You could use a LM3914, no?
-
Texas Instruments LM3914 http://www.ti.com/lit/ds/symlink/lm3914.pdf (http://www.ti.com/lit/ds/symlink/lm3914.pdf)
-
LM3914 in DOT mode.
https://learn.sparkfun.com/tutorials/dotbar-display-driver-hookup-guide
-
What if the output is 3.5V?
then the "C" led is going to stay on till the voltage hit 4V and then "D" is going to turn on.
LM3914 is a dot mode is a problem, I taught about using it but there is a problem that 2LEDs can be on at the same time, I can not have this.
-
What if the output is 3.5V?
then the "C" led is going to say on till the voltage hit 4V and then "D" is going to turn on.
LM3914 is a dot mode is a problem, I taught about using it but there is a problem that 2LEDs can be on at the same time, I can not have this.
You could still go ahead with comparators. Process the output of the comparators through a few logic gates and/or some demuxer ICs (such as the 74HC(T)154 or 74HC4067, for example) to select the appropriate LED for whatever combination of comparator output values.
-
This is a good exercice for a beginner.....Do the circuit yourself.
Some ideas: Use a LM324 (four comparators) and a logic with diodes and transistors so the comparator of the highest voltage inhib the output of the comparators of lower voltages.
Enjoy !
-
use some pic, atmel, cypress microcontroller with 1 analog input and 4 digital outputs
program the chip the way you want.
-
Actually, this is absolutely trivial. No logic required, only OPAMPs.
-
Well, a cheap microcontroller with internal voltage reference and an adc would be enough if you can power it separately with at least 1.8v or something that's above the forward voltage of each led (at least around 1.7v for red leds)
Even a 6 pin micro (I think PIC10F320 (http://www.digikey.com/product-detail/en/microchip-technology/PIC10F320T-I-OT/PIC10F320T-I-OTCT-ND/2772076) would work just fine, but PIC12LF1571 (http://www.digikey.com/product-detail/en/microchip-technology/PIC12LF1571-I-SN/PIC12LF1571-I-SN-ND/4739318) is really cool and even easier to use) would be enough as you can control 4 leds with just 2 i/o pins and you're left with voltage and ground pins and two pins, one for adc and one extra.
If you don't want to depend on separate power, there are microcontrollers which work from around 0.9v up to 3.3v or 3.6v, a simple zener diode would block the input voltage from going above maximum voltage , a couple of resistors could be a voltage divider to keep the voltage less than the reference voltage you configure in the microcontroller (could be 1.024v or something like that) but when the input voltage is 1v or higher (less than 2v) you'd have to also add a voltage doubler or something like that on the pin from where the 1v is turning on.
LM3914 is expensive, a microcontroller can be less than 0.5$
-
Well, a cheap microcontroller with internal voltage reference and an adc would be enough if you can power it separately with at least 1.8v or something that's above the forward voltage of each led (at least around 1.7v for red leds)
Even a 6 pin micro (I think PIC10F320 (http://www.digikey.com/product-detail/en/microchip-technology/PIC10F320T-I-OT/PIC10F320T-I-OTCT-ND/2772076) would work just fine, but PIC12LF1571 (http://www.digikey.com/product-detail/en/microchip-technology/PIC12LF1571-I-SN/PIC12LF1571-I-SN-ND/4739318) is really cool and even easier to use) would be enough as you can control 4 leds with just 2 i/o pins and you're left with voltage and ground pins and two pins, one for adc and one extra.
If you don't want to depend on separate power, there are microcontrollers which work from around 0.9v up to 3.3v or 3.6v, a simple zener diode would block the input voltage from going above maximum voltage , a couple of resistors could be a voltage divider to keep the voltage less than the reference voltage you configure in the microcontroller (could be 1.024v or something like that) but when the input voltage is 1v or higher (less than 2v) you'd have to also add a voltage doubler or something like that on the pin from where the 1v is turning on.
LM3914 is expensive, a microcontroller can be less than 0.5$
But I don't know how to code :(
Ian.M gave a good solution to the problem, and is even cheaper then a micro-controller.
-
But I don't know how to code :(
Ian.M gave a good solution to the problem, and is even cheaper then a micro-controller.
Cheaper is relative. The opamp itself may be cheaper, but you have bigger chip (more pins), you have extra resistors and it requires a higher voltage to work (i see 9v on schematic). Sometimes the pcb space is worth something.
But I agree, for just one project it's not worth it. If you plan on doing more projects in the future it's worth buying a programmer and as for learning, you can find a huge amount of tutorials and example code online to teach you how to initialize a microcontroller and start/stop leds or read a voltage from one pin.
-
Use a true rail to rail quad opamp, and you can run it from 5V. However you'll then need to use an input divider to cope with the input range going above the supply rail and add a resistor above the reference chain to rescale it accordingly.
The other benefit of the analog approach is if its part of a low level audio or instrumentation gadget of some sort. Unlike a MCU, it will cause negligible noise on the supply rail.
-
As I started reading this thread, I had an approach in mind....
But Ian.M beat me to it:
(https://www.eevblog.com/forum/beginners/how-would-you-make-such-circuit/?action=dlattach;attach=262557;image)