Author Topic: Trying to get LM339 battery tester circuit working...  (Read 1423 times)

0 Members and 1 Guest are viewing this topic.

Offline doublec4Topic starter

  • Regular Contributor
  • *
  • Posts: 119
  • Country: ca
Trying to get LM339 battery tester circuit working...
« 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!

 

Offline kosine

  • Regular Contributor
  • *
  • Posts: 159
  • Country: gb
Re: Trying to get LM339 battery tester circuit working...
« Reply #1 on: July 26, 2019, 03:13:24 pm »
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
« Last Edit: July 26, 2019, 03:21:02 pm by kosine »
 
The following users thanked this post: doublec4

Offline doublec4Topic starter

  • Regular Contributor
  • *
  • Posts: 119
  • Country: ca
Re: Trying to get LM339 battery tester circuit working...
« Reply #2 on: July 26, 2019, 03:24:51 pm »
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.

 

Offline kosine

  • Regular Contributor
  • *
  • Posts: 159
  • Country: gb
Re: Trying to get LM339 battery tester circuit working...
« Reply #3 on: July 26, 2019, 03:42:49 pm »
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!
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3382
  • Country: gb
Re: Trying to get LM339 battery tester circuit working...
« Reply #4 on: July 26, 2019, 08:03:15 pm »
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 for LTSpice.  A vast number of third party models of all sorts, including typical jellybean op-amps.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf