Comparator LED Circuit--Help Plz

Thread Starter

LetSmokeOut

Joined Oct 9, 2010
23
Note: In the future I'll use blue text when referring to the light bar circuit (circuit 3) and red text when referring to the Red-Yellow LED circuit (circuit 2).

I just threw this together as a theoretical design in the works for a light bar circuit I want to build later. This light bar circuit is meant to be activated via switch and should illuminate up to 10 LEDs indicating different charge statuses of a 12v battery (subject to charging) not under load. I know I'm getting a little ahead of myself here as I'm not even finished working on the Red-Yellow LED circuit, but if you don't mind I figured I'd work on the two simultaneously. Anyway, the following is my initial design (which probably would not work, but it gives me somewhere to start):


The resistor values are not correct because they are based on a rail voltage of 18 volts, which I don't believe would be sufficient to power all of the LEDs simultaneously. I believe new resistor values would have to be calculated and potentiometers would need to be used to get specific (non-standard) resistances.


With respect to the Red-Yellow LED circuit we've been talking about since the beginning: The only reason I'm hesitant to just build your design and call it good is because I don't fully understand it yet. Having a full understanding of the circuit and how everything works in the circuit is every bit as essential to me as having a finished product that works.

Over the next few days I'd like to develop a clearer understand of how your circuit design works, as it is better and should function properly under more conditions.
 
Last edited:

Thread Starter

LetSmokeOut

Joined Oct 9, 2010
23
You calculate resistor power rating requirements by E^2/R or I^2R or EI, and then double the result to make certain the resistors stay reasonably cool. As far as the schematic I posted, even 1/10 Watt resistors would be adequate.

I made a revision to the circuit to add a bit of hysteresis. The worst-case current draw is ~6mA@18v, which is a small fraction of your 4.72A charge current. If the battery is down to 12v, the current draw is just under 4mA.

I don't see a need to use two 9v batteries to power the LEDs.






Would this circuit still work (would the Red LED still illuminate) in perfect dark conditions where the solar panel is only capable of putting out 0.017v? It is important that our LEDs work regardless of the voltage output of the solar panel (which is why I was thinking an independent voltage source would be required).
 

SgtWookie

Joined Jul 17, 2007
22,230
If you connect it like the attached schematic, yes.

I don't know what kind of battery you are planning to charge, but if it's a sealed lead-acid type, you probably don't want to let it get up to 15v. You should look at my post about battery maintenance in the Tips and Tricks thread, here: http://forum.allaboutcircuits.com/showpost.php?p=262143&postcount=38

Instead of all those individual comparators, look at National Semiconductor's LM3914. It's a linear 10-segment LED dot-bar driver that will save you lots of time and wiring.
Link: http://www.national.com/mpf/LM/LM3914.html#Overview

Avnet Express: http://avnetexpress.avnet.com/store...=500201&langId=-1&storeId=500201&listIndex=-1
Digikey: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=LM3914N-1-ND
Jameco: http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_300003_-1

Have a look at this circuit using the LM3914:
http://www.electronics-project-design.com/BarGraphLED.html
 

Attachments

Last edited:

Thread Starter

LetSmokeOut

Joined Oct 9, 2010
23
If you connect it like the attached schematic, yes.

I don't know what kind of battery you are planning to charge, but if it's a sealed lead-acid type, you probably don't want to let it get up to 15v. You should look at my post about battery maintenance in the Tips and Tricks thread, here: http://forum.allaboutcircuits.com/showpost.php?p=262143&postcount=38

The following is the battery we are using to charge in our charging circuit. It is also the battery we will be using to read charge status via light bar:
Battery Datasheet.pdf

The following is our charging circuit (primary circuit) from which a twitch will reroute connectivity to circuit(s) 1 and/or 2 (depending one how we choose to incorporate the switching mechanism(s). The charging circuit is actually one we borrowed from an online source cited below the circuit diagram:

Courtesy of <http://projectsworld.wordpress.com/2009/10/04/lead-acid-battery-charger-circuit/>
 

Attachments

Thread Starter

LetSmokeOut

Joined Oct 9, 2010
23
I'd like to go ahead and build the circuit you designed for the Red-Yellow LED circuit (circuit 2). Even though my circuit works, I had to admit yours is better. It'll be an education experience too as I need to figure out how everything works. Is there any chance you could give me a parts list for it so I can order them online? Thanks a ton.
 

SgtWookie

Joined Jul 17, 2007
22,230
--- Bill of Materials ---

Ref. Mfg. Part No. Description
D1 Motorola 1N4148 diode
D2 Motorola MBR735 diode
LED1 RED REDLED light emitting diode, red
LED2 RGYA RGYALED light emitting diode, green
R1 -- -- resistor, 140K
R2 -- -- resistor, 100K
R3 Various manufacturers; 5k Ohm potentiometer, 10-turn or 21-turn preferred
R4 -- -- resistor, 3.3K
R5 -- -- resistor, 3.3K
R6 -- -- resistor, 100K
R7 -- -- resistor, 100K
R8 -- -- resistor, 4.7M
U1 National Semiconductor LM2903 or LM393 integrated circuit, dual comparator

You will also need a 0.1uF capacitor with at least a 25v rating to go across the power pins of the LM2903/LM393 comparator (not shown on schematic). It can be a metalized poly film or ceramic cap.
Also, unless you want to have an LED on all the time, get some kind of switch to go between the battery and this circuit.

You're also going to need a circuit to prevent overcharging your battery/batteries, but since you haven't told us what you're going to charge, we can't go much further.
 
Last edited:

Thread Starter

LetSmokeOut

Joined Oct 9, 2010
23
You're also going to need a circuit to prevent overcharging your battery/batteries, but since you haven't told us what you're going to charge, we can't go much further.

Thank you again for the help. I actually did create a rather lengthy post which included my datasheet as an attachment for the battery we are using in our charging circuit. The post also included a bunch of additional information including a circuit diagram of our primary charging circuit. When I tried to "submit reply" I just got a message saying the post won't be posted until viewed and accepted by a forum moderator. I don't know what happened to it. The post I am referring to I believe I created over this past weekend.
 

Wendy

Joined Mar 24, 2008
23,421
Did you put it in the completed projects forum? We get a lot of posts there that don't belong, as it is for completed projects only, so it gets moderator review.
 

SgtWookie

Joined Jul 17, 2007
22,230
New members' posts can be delayed pending Moderator approval. Very long posts or in particular, links to other sites can trigger it, among other things. I don't claim to know all the logic behind what triggers it; just that it happens.

Our Moderators seem to have been pretty busy. Give them a bit more time to look into the matter. I suspect it'll be resolved within the next day or so.
 

Thread Starter

LetSmokeOut

Joined Oct 9, 2010
23
Should I assume the post I tried to submit was lost or should I give it more time? It has been about 3-4 days now. I'll retype and attempt to resubmit it if necessary.
 

SgtWookie

Joined Jul 17, 2007
22,230
Unfortunately, I think it's probably lost. :(

Sorry that you went to all of that trouble. This does happen occasionally.

If you are going to prepare a long post, I suggest you do it using NotePad or other text editor on your PC, and then paste the complete text into a message box for posting. That way if it doesn't "take", you will still have a copy on your computer, and can retry later.
 

bertus

Joined Apr 5, 2008
22,277
Hello,

I approved the post, so it is visible now.
Sometimes it happens that the forum software is triggered by some words and sees it as spam and makes the post invisible.

Bertus
 

SgtWookie

Joined Jul 17, 2007
22,230
Oh, OK - Thanks, Bertus!

I've simulated that circuit before. Keep in mind the specs in the datasheet; it's a 7AH battery, and so the maximum charge rate is 0.1C, so you need to limit your maximum charge current to 700mA. To do this, change R1 to 1 Ohm. R1 should be rated for 1W or higher. You should use a nice large heat sink for the regulator.

You should also use a diode (Schottky preferred) between the output of the circuit and the battery, to prevent the charge circuit from draining the battery if the input voltage is turned off.

Use a capacitor and 4.7k resistor in parallel to set the output float voltage; it should be ~13.65v if the battery will be maintained at room temp (25°C/77°F). If this is going to be used outdoors, you really need temperature compensation.
 

Thread Starter

LetSmokeOut

Joined Oct 9, 2010
23
Hello! We are still waiting for parts to arrive before I can build and test your Red-Yellow LED circuit, SgtWookie. In the meantime I've been working on the light bar circuit. We purchased an LM3914 chip and have built the circuit but we've encountered a problem. The LM3914 only accepts reference voltages ranging from .125v to 1.25v. To elaborate, the LED connected through pin 1 turns on when the voltage reference is above 1.25v (up to it its max voltage). The LED connected through pin 18 (second LED in the sequence) turns on when the voltage reference is below 1.25v and equal to or above 1.125v. The LED connected through pin 17 (third LED in sequence) turns on when the voltage reference is below 1.125v and equal to or above 1v. The following 7 LEDs turn on for each increment falling within the range of its previous condition and - another 0.125. An equation illustrating this looks like the following:

n=number of LED in sequence (pins 1, 18, 17, 16, 15, 14, 13, 12, 11, 10 - in that order)

Minimum Voltage Reference=1.25-(n-1)*0.125

The problem we are having is that the range we wish to use to illuminate our 10 LEDs must fall between around 10v to exactly 12.7v. The reason 12.7v is an essential value corresponding to an LED is because 12.7 represents our batteries charge status of 100%. Above this value is dangerous for the battery and below this value is less than fully charged. Ideally, we would use a range using only 1 LED below 11.89v and the remaining 9 LEDs between the range of 11.89 and 12.7v (to indicate the various charge levels of the battery). We don't need the percentages to be as neat as 0%,10%,20%,30%, etc... as long as we have at least 9 of our LEDs corresponding to percentages falling between the range of 11.89v and 12.7v.

So we've been trying to figure out a way using voltage divider to construct a "level shifting" circuit to convert our raw reference voltages which will always range between 11.89v and 12.7v after steady state no load voltage has been reached to a range from 0.125v to 1.25v so that our LM3914 can be used. I believe we need to do this in a linear, 10 step fashion, but I'm not sure how to make it work without using additional chips to over complicate our light bar circuit. One idea was to use three quad comparator chips to use logic so that the voltage divider used will be dependent on the raw reference voltage, but this would require additional voltage supplies and I'd like to avoid that if possible. Simplicity is my aim. Is anyone able to help me find a solution to our little problem? As always, your help is highly appreciated. Thank you, gentlemen.

Additional Potentially Helpful Information:

LM3914 Data Sheet:
View attachment LM3914.pdf

Battery Charge Levels:
0%=11.89v
25%=12.06v
50%=12.24v
75%=12.45v
100%=12.70v
 

Thread Starter

LetSmokeOut

Joined Oct 9, 2010
23
I'm still hoping to get a response to our latest problem as described in the previous post. In the meantime, though, I figured I'd share some information regarding something we've recently tried.

So I wanted to know how much resistance would be required to reduce the voltage from 12.70v to 1.25v. So I set up a simple voltage divider equation and solved for x as follows:
((x)/(x+1k))*(12.70)=1.25v, x=109.17

This was fine except when I began putting together a table to show each of the corresponding reference voltages for each subsequent interval I noticed after only one repetition the reference voltage dropped below a 0% charge status for the battery. To elaborate, we know 11.89v = 0% charge status for our battery (data sheet posted earlier in thread), and that,
((109.17)/(109.17+1000))*(x)=(1.25-0.125), x=11.43

And since 11.43 < 11.89, I immediately realized a single simple voltage divider such as this would not work. Now I'm thinking it might be a lot easier just to scrap the whole LM3914N chip idea and just go with 10 different 741 op amps. I'm not sure how else to make our light bar work.

I do realize there are some less than ideal conditions involved with using 741 op amps. One problem to be specific would be the required source voltages for each of the op amps and that the batteries would need to be near full capacity for the consistent accuracy of our light bar.

If anyone can offer any suggestions or help me to come up with a design that works it'd be highly appreciated. Thank you.
 

SgtWookie

Joined Jul 17, 2007
22,230
<snip>
I've been working on the light bar circuit.
This one, right? :
http://www.electronics-project-design.com/BarGraphLED.html

Did you build the circuit exactly as shown?
We purchased an LM3914 chip and have built the circuit but we've encountered a problem. The LM3914 only accepts reference voltages ranging from .125v to 1.25v. To elaborate, the LED connected through pin 1 turns on when the voltage reference is above 1.25v (up to it its max voltage). The LED connected through pin 18 (second LED in the sequence) turns on when the voltage reference is below 1.25v and equal to or above 1.125v. The LED connected through pin 17 (third LED in sequence) turns on when the voltage reference is below 1.125v and equal to or above 1v. The following 7 LEDs turn on for each increment falling within the range of its previous condition and - another 0.125. An equation illustrating this looks like the following:

n=number of LED in sequence (pins 1, 18, 17, 16, 15, 14, 13, 12, 11, 10 - in that order)

Minimum Voltage Reference=1.25-(n-1)*0.125

The problem we are having is that the range we wish to use to illuminate our 10 LEDs must fall between around 10v to exactly 12.7v. The reason 12.7v is an essential value corresponding to an LED is because 12.7 represents our batteries charge status of 100%. Above this value is dangerous for the battery and below this value is less than fully charged.
Did you look at the battery maintenance spreadsheet in the link that I posted earlier?
http://forum.allaboutcircuits.com/showpost.php?p=287368&postcount=23

It's typical to float-charge a SLA battery at around 13.6v-13.8v when their internal temp is ~25°C. It is not dangerous for the battery's life at all.

Your battery would be 100% charged at 12.8v at 25°C, and fully discharged at 11.5v at 25°C. Ideal float charge voltage would be 13.76v @ 25°C. Cycle charge voltage would be 14.72V @ 25°C; charging at a 1.4A rate max.

Ideally, we would use a range using only 1 LED below 11.89v and the remaining 9 LEDs between the range of 11.89 and 12.7v (to indicate the various charge levels of the battery). We don't need the percentages to be as neat as 0%,10%,20%,30%, etc... as long as we have at least 9 of our LEDs corresponding to percentages falling between the range of 11.89v and 12.7v.

So we've been trying to figure out a way using voltage divider to construct a "level shifting" circuit to convert our raw reference voltages which will always range between 11.89v and 12.7v after steady state no load voltage has been reached to a range from 0.125v to 1.25v so that our LM3914 can be used.
I guess you made changes to the schematic shown in the link, as you can easily adjust the high and low threshold levels by changing VR1 and VR2, just like it says.
 

Thread Starter

LetSmokeOut

Joined Oct 9, 2010
23
This one, right? :
http://www.electronics-project-design.com/BarGraphLED.html

Did you build the circuit exactly as shown?

No, I built it based off the data sheet information (pages 7 and 18). I have not seen this website before. Thank you for the resource.


On a side note, I was actually looking at page 11 of the data sheet in more detail today and was thinking I'd need a transformer to step the voltage down. I will attempt to build the circuit as shown in the website you linked me beforehand, though.


Did you look at the battery maintenance spreadsheet in the link that I posted earlier?
http://forum.allaboutcircuits.com/showpost.php?p=287368&postcount=23

It's typical to float-charge a SLA battery at around 13.6v-13.8v when their internal temp is ~25°C. It is not dangerous for the battery's life at all.

Your battery would be 100% charged at 12.8v at 25°C, and fully discharged at 11.5v at 25°C. Ideal float charge voltage would be 13.76v @ 25°C. Cycle charge voltage would be 14.72V @ 25°C; charging at a 1.4A rate max.

Yes. I actually printed off your battery charge sheet as well. The 12.70v = 100% and 11.89v = 0% is actually information I found on a different website before you provide me with your table. I figured the values were close enough that the 0.1v difference would be trivial. I would be perfectly content with using 12.8v as my 100% charge status though. The remaining values corresponding to each of the LEDs in the light bar don't really matter so long as at least 8 of the remaining 9 LEDs fall between the range of 0%-100% charge status (at 25 C).


I guess you made changes to the schematic shown in the link, as you can easily adjust the high and low threshold levels by changing VR1 and VR2, just like it says.
I must have missed the link if it was mentioned previously. I apologize. I will make the necessary alterations to my circuit first thing tomorrow and attempt to get things working as intended.



I consider myself very fortunate for your kindnes and generosity in helping me with this project. Thank you very much, SgtWookie. I'd give you a hug or atleast shake your hand if not for the restrictions of the internet. ;)
 
Last edited:

Thread Starter

LetSmokeOut

Joined Oct 9, 2010
23

Hello. I spent a good 6 hours today testing and attempting to get working the circuit in the aforementioned link. I was able to get the LEDs to light up in sequence with the proper voltage intervals but not with the correct scale. The lowest minimum voltage I could get was around 16.6v for the first LED. I noticed that changing the screw on potentiometer VR1 did absolutely nothing with respect to when (at what corresponding voltage) the LEDs illuminate. I wasn't able to get any 5K potentiometers so I used 10K pots (10 turns) hoping this would work as long as I adjusted them properly. I suppose it is possible that this is the problem, but I doubt it because one of the problems I noticed was that the LEDs would all illuminate simultaneously as a certain (small) voltage around 2.5v. Also, at another voltage they would illuminate in groups (the big green LED at one instant, then the two yellows, then the 4 reds, then the flasher LED). So not only did they illuminate in reverse sequence, but groups of them illuminated simultaneously at different voltage levels. This [seemingly] random behavior has me thoroughly confused. If the potentiometers were the problem wouldn't that just prevent me from being able to adjust to the correct scale? The behavior of VR1 almost suggests it is a faulty potentiometer but I measured it by itself and verified a varying resistance with a multimeter when turning the screw. How can I explain all this other weirdness?


If anyone has the free time, could you attemp to build the circuit as shown in the diagram and let me know if you encounter any of the same problems? Please use actual devices as a simulation might not be helpful if the problem is indeed due to faulty parts. I did try replacing the LM3914N, using different LEDs, different resistances (both via the potentiometers VR1 and VR2 and also by switching R2), and rebuilding the entire circuit 3 times to account for loose connections. Thanks.
 

wayneh

Joined Sep 9, 2010
17,498
I suggest you post a photo of your build. Your problem may well lie in the difference between reality and the way it looks "on paper". Ground isn't always ground, and my guess is you've got some sort of oscillation going on.
 

SgtWookie

Joined Jul 17, 2007
22,230
Yes, a good photo will definitely help.

I'll see about building it up after a bit.

[eta]
Ran out of time this afternoon; maybe within the next day or so.
 
Last edited:
Top