Go Down

### Topic: Light LED when supply voltage is 5V (Read 3287 times)previous topic - next topic

#### Chrono251

##### Mar 09, 2012, 12:30 am
Hi!
I'm building a stabilized power supply for a small device I'm making with an LM2576. The power supply part is already done but I would like to indicate if an undervoltage/overvoltage condition exists.

I found online some circuits using a transistor and some more components to light an LED when voltage falls below a threshold, and that works too (this one: http://i49.tinypic.com/2q2pspk.jpg - posted here http://forums.modretro.com/viewtopic.php?f=7&t=3640).

The problem I'm trying to solve is that I would like to light an LED only if the voltage is more or less 5V (eg +-0.5V). It is ok to do the opposite: I know how to light an LED when voltage is below 4.5V, but I don't know how to do the same when voltage is greater than 5.5V.

Thanks for the help!
Chrono251 - Stefano

#### Magician

#1
##### Mar 09, 2012, 01:27 am
You want the same led lights up or different one?

#2
##### Mar 09, 2012, 07:00 am
You could do something like this assuming you have a higher voltage that you are regulating down.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### Chrono251

#3
##### Mar 09, 2012, 12:17 pm
Ehi thanks for the schematic!
I'll try it later on today, I think that's exactly what I was looking for.
Chrono251 - Stefano

#### Chrono251

#4
##### Mar 09, 2012, 02:32 pmLast Edit: Mar 09, 2012, 07:38 pm by Chrono251 Reason: 1
The circuit works perfectly! Thank you very much.

I added an undervoltage lockout protection circuit (taken from the LM2576 datasheet) to power the step-down circuit only when supply voltage is greater than 7V (min input voltage for the LM2576).

I used a 680 ohm resistor in series with D1, so that the LED draws 10mA. Instead of resistor+diode for D2 and D3 I used two 2K2 ohm resistors, in order to light the "good voltage" LED only when voltage is within parameters.

EDIT:
Instead of the 2 pots, I used 2 voltage divider circuits. I had to round the values to acceptable levels, in particular because the input is not stabilized (it goes from 12.7 when battery is fully charged to about 11.7V when under heavy load).
Chrono251 - Stefano

#5
##### Mar 09, 2012, 08:52 pm
Cool.
You can just leave off the extra LEDs & resistors altogether if you are not using them.
Glad you were able to find resistor values that have created voltages in the range you needed.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### strykeroz

#6
##### Apr 01, 2013, 02:13 pmLast Edit: Apr 01, 2013, 03:27 pm by strykeroz Reason: 1
I love it when a question I have is already answered.  This forum is truly a goldmine.

You can just leave off the extra LEDs & resistors altogether if you are not using them.
Bob thanks for posting the schematic.  I'd like to use all 3 LEDs in your original design with a 12V input and 5V Vsource as per the OP.  I'm also thinking an audible alert with a piezo on overvoltage will also be sensible, though I'm not sure an ATmega etc will hold on for too long in that condition (but at least I'll have a buzzer telling me why it died).

Not wanting to mess this up, what voltages should I expect as "High" at pins 1 & 7?  Is it 12V in both cases? Sorry for the newbie question and please feel free to aim me at something that explains the LM358 in simple terms if you know such a resource.

Thanks
Geoff
"There is no problem so bad you can't make it worse" - retired astronaut Chris Hadfield

#7
##### Apr 02, 2013, 12:32 am
Wow, post from the past!
If the opamp is powered from 12V, then the outputs will swing pretty close to Gnd & ~10.5V (Vcc - 1.5V) since there's no negative feedback.
Re: LM358: if + input is > - input, the output goes high. If- input is > + input, the output goes low.  Pretty simple.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### strykeroz

#8
##### Apr 02, 2013, 11:40 am
Thanks Bob - glad I asked.  I'd never have found that detail (and still haven't!) in the datasheet you attached.

Very much appreciate your words of wisdom, cheers ! Geoff
"There is no problem so bad you can't make it worse" - retired astronaut Chris Hadfield

#### strykeroz

#9
##### Apr 14, 2013, 12:18 pm
Hi guys

One more question - I'm very close to exporting the gerber file and getting a board made when I realise I've (on autopilot almost) dropped a decoupling 0.1uF cap between pin 8 VCC on the LM358 and GND.

It's C2 on the attached.

Is there any downside with doing that?

Thanks
Geoff
"There is no problem so bad you can't make it worse" - retired astronaut Chris Hadfield

Go Up