Author Topic: Op Amp Comparator Battery Charger Indicator  (Read 5878 times)

0 Members and 1 Guest are viewing this topic.

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Op Amp Comparator Battery Charger Indicator
« on: May 02, 2014, 12:02:55 pm »
Hello recently i saw Daves video about op amps and the thing that they can also be used as comparators intrigued me.
So i created a schematic using one as a comparator but it does not work when i tried it on the breadboard.
Look at a picture of the schematic.
 

Offline yashrk

  • Frequent Contributor
  • **
  • Posts: 274
  • Country: in
  • A MAKER, AN ENGINEER, A HOBBYIST FOR LIFE
    • My Personal Blog
Re: Op Amp Comparator Battery Charger Indicator
« Reply #1 on: May 02, 2014, 12:41:03 pm »
I dont think you need those couple of 100R resistor instead you should calculate the current going to transistor base with respect to its gain and then add a resistor on the base if needed. I guess in your case there not enough current to drive the led
Find me and things I'm working on - https://www.yashkudale.com/
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: Op Amp Comparator Battery Charger Indicator
« Reply #2 on: May 02, 2014, 12:57:55 pm »
I need the resistors so the non inverting input of the op amp has 1.1 v (batteries charge to 1.2 so when they are charged the output voltage triggers the transistor).
Because its an open loop configuration the output voltage and current wont have a problem driving the led
 

Offline madshaman

  • Frequent Contributor
  • **
  • Posts: 698
  • Country: ca
  • ego trans insani
Re: Op Amp Comparator Battery Charger Indicator
« Reply #3 on: May 02, 2014, 01:51:47 pm »
Is it by any chance a blue LED?
To be responsible, but never to let fear stop the imagination.
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: Op Amp Comparator Battery Charger Indicator
« Reply #4 on: May 02, 2014, 03:03:04 pm »
No used a red low power one .
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: Op Amp Comparator Battery Charger Indicator
« Reply #5 on: May 02, 2014, 03:06:54 pm »
Update : i connected the inverting input to ground and the led came on.
But it should light up when the inverting input goes high (1.2 volts or more )....
 

Offline Galaxyrise

  • Frequent Contributor
  • **
  • Posts: 531
  • Country: us
Re: Op Amp Comparator Battery Charger Indicator
« Reply #6 on: May 02, 2014, 03:31:53 pm »
Opamps raise their output voltage when IN- is less than IN+.  So as you have it wired now, the LED should come on when the battery voltage is lower than your divider voltage, which is consistent with coming on when you attach IN- to ground.  If you want a "battery ok" light instead of a "battery low" light, then swap the inputs to the opamp.

I'm also curious why you have that parallel bunch of resistors coming off the voltage divider. I don't see how that helps get 1.1V at IN+; there's not going to be any current through them except the bias current for the opamp.
I am but an egg
 

Offline rdl

  • Super Contributor
  • ***
  • Posts: 3667
  • Country: us
Re: Op Amp Comparator Battery Charger Indicator
« Reply #7 on: May 02, 2014, 04:28:40 pm »
The two 100R resistors aren't doing anything. To get 1.1 volts on the op amp input your divider resistors need to be in the ratio of 3.545 : 1

You'll probably have to use a trimmer (or multiple individual resistors in series) because two standard value resistors probably won't get you close enough.
 

Offline madshaman

  • Frequent Contributor
  • **
  • Posts: 698
  • Country: ca
  • ego trans insani
Re: Op Amp Comparator Battery Charger Indicator
« Reply #8 on: May 02, 2014, 05:14:02 pm »
Can you post a picture of your circuit please?
To be responsible, but never to let fear stop the imagination.
 

Offline Fank1

  • Regular Contributor
  • *
  • Posts: 159
Re: Op Amp Comparator Battery Charger Indicator
« Reply #9 on: May 02, 2014, 09:53:19 pm »
I suspect your circuit is OK.
But I also suspect you are floating the (-) side of the op amp when you tested it.
Tie the (-) side down to ground with a 10K or so resistor and try it again.
Op amps don't like unconnected pins.
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: Op Amp Comparator Battery Charger Indicator
« Reply #10 on: May 02, 2014, 10:09:15 pm »
First of all thank you all for your responses.
Ill try to figure out what the resistor values need to be so i get 1.1 v out
(i still have not figured out exactly how to calculate the voltage drop across a resistor i saw many tutorials online but i am still quite confused.
I know the basic ohms law I=V/R but i do not know how to use it to calculate the drop )
Also the inverting input is connected with a 100k ohm resistor to ground.
I thought that this low voltage will stimulate the 2 charging batteries.
(because i want the op amp to output 5 volts when the inverting input voltage is over the non inverting)
The op amp i use is a double op amp (LM358)
i have the other pins disconnected but i dont think that interferes with the op amp im using.
 

Offline AG6QR

  • Frequent Contributor
  • **
  • Posts: 863
  • Country: us
    • AG6QR Blog
Re: Op Amp Comparator Battery Charger Indicator
« Reply #11 on: May 02, 2014, 10:34:18 pm »
Comments on the circuit as hand-drawn in the original posting:

1. You have no current limit on the LED, nor on the base-emitter diode of your drive transistor.  Remember that the op-amp output is a relatively low-impedance voltage output, so when it is high, it is able to source fairly high currents (see the data sheet for details).  The output of the op-amp is connected through the base-emitter diode to the LED.  You have a resistor on the collector of your drive transistor, but nothing to limit the current going from op-amp to base to emitter to LED.  You don't say what kind of op amp you're using -- maybe the output won't mind this, but maybe it will.  A suitable resistor between the op amp output and the transistor base will make sure you don't stress the op amp output, and will help you avoid blowing out the LED or drive transistor.

2. Remember one of the basic rules of op-amps, no current goes in our out of the inputs (this isn't strictly true, but it's a close approximation to the truth).  So your two paralleled resistors on the + input have no current going through them, thus no voltage across them, so they're not doing anything useful.  You can replace them with a wire directly connecting the voltage divider to the + input, without changing the behavior of your circuit significantly.  Others have pointed this out. 

I see in your latest post you say you've connected the inverting input to ground through a resistor, but again, there's no reason for the resistor, since no significant current will flow through it, so no voltage will appear across it.  If you connect the inverting input to ground, then the output of the op amp will be high any time the non-inverting input has any voltage above ground.  Is that what you want?

3. As has been pointed out, you've drawn it so that it will light up when the battery voltage is less than the output of the voltage divider.  If you want it to light up when the battery is high instead of low, then swap the + and - inputs.

4. Dave said it was possible to use an op amp as a comparator, but he didn't claim it was a great idea.  Some op amps aren't necessarily designed to work well when the inputs are at radically different voltages and the output is being driven hard to one end or the other.
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: Op Amp Comparator Battery Charger Indicator
« Reply #12 on: May 03, 2014, 09:33:42 pm »
Thanks for your answer.
1) I do not think i need a resistor because i supply the circuit with an ATMEGA
 does that mess up the circuit function ?
2) Right and now i know the ration of the resistors thank you for that :D i removed them :D
2) ii) yes thats what i want!! and i tried experimenting with it (changing the (-) and (+) inputs.
4) i just wanted something fast because i could not wait for a comparator chip to arrive.
I dont know what comparator to get that fits my needs but ill search a bit and find out :D

Anyway its working now but i dont know why the led light up dimmer that usually.....
 

Offline madshaman

  • Frequent Contributor
  • **
  • Posts: 698
  • Country: ca
  • ego trans insani
Re: Op Amp Comparator Battery Charger Indicator
« Reply #13 on: May 04, 2014, 07:41:25 pm »
Hi ChrisGreece52.

The next step you need after learning V = IR, Ohm's law, is to learn Kirchhoff's voltage and current laws.

Those will help you calculate things like voltage drops, in fact they will let you calculate any current through or voltage across a device.

You should also learn the golden rules for opamps.

Also, the reason I asked for a picture of the actual circuit is that sometimes a circuit won't match the schematic and troubleshooting becomes confusing.
To be responsible, but never to let fear stop the imagination.
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: Op Amp Comparator Battery Charger Indicator
« Reply #14 on: May 04, 2014, 09:02:31 pm »
Thanks for your advice i double checked the connections everything is fine :-) also as for the basics do you need any article or website to read and learn? I hate being a noob

Sent from my C5303 using Tapatalk

 

Offline madshaman

  • Frequent Contributor
  • **
  • Posts: 698
  • Country: ca
  • ego trans insani
Re: Op Amp Comparator Battery Charger Indicator
« Reply #15 on: May 06, 2014, 01:16:42 pm »
Google MIT open courseware.

Find the EE courses; there should be a basic circuit theory-like one.  You can watch all the videos as if you were attending MIT.

Pretty nice of them huh?

(There are also many other online learning resources, google and wikipedia are your friends)
To be responsible, but never to let fear stop the imagination.
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: Op Amp Comparator Battery Charger Indicator
« Reply #16 on: May 06, 2014, 01:23:55 pm »
Did not know about that :-)  thank you I'll start right now

Sent from my C5303 using Tapatalk

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf