EEVblog Electronics Community Forum
Electronics => Beginners => Topic started by: doublec4 on July 26, 2019, 02:32:09 pm
-
Hi All,
I am trying to get a simple battery testing circuit working with the LM339 differential comparator IC. I have four LEDs to indicate the voltage level of the battery (Li-ion tool battery... 12.6V max, 9V min)
I put together an excel spreadsheet to calculate my resistor voltages to give me the LED outputs at the desired voltages. See attached.
I found a circuit online and replicated it... with one small change (see attached). The circuit I found online has the + side of the LEDs connected to the 12V supply. I figured I would connect the + side of the LEDs to the part of the circuit where the zener should keep the voltage at ~6.2V this way I could use smaller resistors. I'm not sure if somehow this is the source of my problems because the zener does not seem to be regulating the voltage to 6.2V... When the supply is set to 12V the zener is outputting ~11V
The result I am getting is that the LEDs stay lit all the way down to ~7.5V and then below that they start turning off... not at all the range I was hoping for.
Are the LEDs somehow affecting the zeners ability to properly regulate to 6.2V?
Thanks!
-
Try an LTspice simulation...
You need to connect your LEDs directly to the supply voltage, not to the zener.
Spice then says the LEDs should draw about 15mA and go out at (about) 12.4V, 11.4V, 10.4V and 9.5V. (Assuming I've copied your resistor values correctly.)
You're also running the LEDs quite hot, I'd use maybe 2k2 resistors to drop the current to about 5mA.
edit: have attached the spice file
-
I really need to learn how to use LTSpice :palm:
Thanks for simulating it! I will try running it as you suggest and see what happens. Also, I was running the LEDs a bit on the hot side because this circuit was going to be on a momentary push button so it would only light up for a moment, not continuous. I wanted it bright so it would be visible during the day.
-
Go and download it right now! It's pretty easy to use, and sooo much easier than messing around with a breadboard. Very useful and powerful software, loads of help and tutorials out there.
A few quirks and limitations, most of the opamp and comparator models are Linear Tech devices, but you can find other ones online if you need them. To start with, I just pick any old device from the list and see if it works. I swapped your LM339 for an LT1017 and just ran with it, seems to give sensible results.
Give it a try!
-
Go and download it right now! It's pretty easy to use, and sooo much easier than messing around with a breadboard. Very useful and powerful software, loads of help and tutorials out there.
A few quirks and limitations, most of the opamp and comparator models are Linear Tech devices, but you can find other ones online if you need them. To start with, I just pick any old device from the list and see if it works. I swapped your LM339 for an LT1017 and just ran with it, seems to give sensible results.
Give it a try!
Download Bordodynov's library (http://bordodynov.ltwiki.org/) for LTSpice. A vast number of third party models of all sorts, including typical jellybean op-amps.