How would you make such circuit? - Page 1
Forum section: electronics / beginners

author: ZeTeX
author_rank: Frequent Contributor
timestamp: October 14, 2016, 04:58:04 pm
content: 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 onbut led "A" turns off., then when the voltage source output 5V, led "C" turns onbut 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*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.

author: elgonzo
author_rank: Unknown
timestamp: October 14, 2016, 05:11:14 pm
content: What if the output is 3.5V?You could use a LM3914, no?

author: chris_leyson
author_rank: Super Contributor
timestamp: October 14, 2016, 05:11:37 pm
content: Texas Instruments LM3914http://www.ti.com/lit/ds/symlink/lm3914.pdf

author: Lee Leduc
author_rank: Regular Contributor
timestamp: October 14, 2016, 05:13:46 pm
content: LM3914 in DOT mode.https://learn.sparkfun.com/tutorials/dotbar-display-driver-hookup-guide

author: ZeTeX
author_rank: Frequent Contributor
timestamp: October 14, 2016, 05:15:35 pm
content: Quote from: elgonzo on October 14, 2016, 05:11:14 pmthen 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.

author: elgonzo
author_rank: Unknown
timestamp: October 14, 2016, 05:21:43 pm
content: Quote from: ZeTeX on October 14, 2016, 05:15:35 pmYou 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.

author: oldway
author_rank: Super Contributor
timestamp: October 14, 2016, 06:33:46 pm
content: 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 !

author: kripton2035
author_rank: Super Contributor
timestamp: October 14, 2016, 07:25:50 pm
content: use some pic, atmel, cypress microcontroller with 1 analog input and 4 digital outputsprogram the chip the way you want.

author: Ian.M
author_rank: Super Contributor
timestamp: October 14, 2016, 07:56:10 pm
content: Actually, this is absolutely trivial. No logic required, only OPAMPs.

author: mariush
author_rank: Super Contributor
timestamp: October 14, 2016, 08:33:49 pm
content: 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 thinkPIC10F320would work just fine, butPIC12LF1571is 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$

author: ZeTeX
author_rank: Frequent Contributor
timestamp: October 14, 2016, 08:56:04 pm
content: Quote from: mariush on October 14, 2016, 08:33:49 pmBut I don't know how to codeIan.M gave a good solution to the problem, and is even cheaper then a micro-controller.

author: mariush
author_rank: Super Contributor
timestamp: October 14, 2016, 09:30:21 pm
content: Quote from: ZeTeX on October 14, 2016, 08:56:04 pmCheaper 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.

author: Ian.M
author_rank: Super Contributor
timestamp: October 14, 2016, 10:11:20 pm
content: 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.

author: Brumby
author_rank: Unknown
timestamp: October 15, 2016, 03:45:02 am
content: As I started reading this thread, I had an approach in mind....ButIan.Mbeat me to it: