A small 17mm led battery guage, *first pcb design*

When I started working on the series mod for 7135 drivers a few months ago I soon realized that I would lose the low voltage warning programmed into the Tiny13A and other similar boards that I modded. While cruising the net search of …( thank you Leonard) I came across and it looked simple enough for even me to understand( not how it works but how it goes together) and it looked like it might be made to fit on a 17mm board with smd LEDs included. I know I can get a numerical guage for just a few dollars but I thought I might be able make something REALLY small. There were some comments that went along with this schematic, namely, the way the pot is connected and how the LEDs are powered but it looked like something that could be tuned for a variety of battery voltages and might even be incorporated into a tailcap pcb. Can any one tell me how this circuit is lacking and how to adjust it to operate at different voltage ranges(3-4.2V, 6- 8.4V, 9-12.6V)? I expect to spend some time familiarizing myself with opamps or whatever else is used. I would very much appreciate tutelage anyone has to offer. This is not a “for profit” venture but a way to fill a need.

Thanks

I would guess that it’s the resistors on the left (R2-6) that create the voltage values on the right and the gaps between them. Something in the dim depths on my mind is quietly saying “voltage divider you fool!” but I don’t know who’s saying it and I’d wish he’d shut up as I’m trying to concentrate!

As for figuring out the resistor values needed for the voltages you want and the steps between them, hopefully someone more knowledgeable (not hard, admittedly) will come along and illuminate you :slight_smile:

In the back of my mind i’m thinking youtube youtube. Yes got it! just the thing for you, check out EEV BLOG #204 Designing A Li-ion Battery Gauge. A video by that crazy aussie dave jones. Be warned its long but very interesting if you are into electronics , and covers in great detail designing and building a battery gauge, although if focuses on two series cells the same principles apply for different voltages, including calculating those resistors. Sorry i cant post a link, i will do next time i’m on a pc. Hope you find the video helpful he knows his stuff that guy.

This is a new thread but I have already spent several weeks reading up on this so yes, I too recognize the voltage divider part from other similar circuits. Notice how the pot is connected via two points to the same pin? Weird. What I know wouldn’t fill a thimble but I’d like to find out how to vary the circuit to span different battery voltages. The LM324 is a chip with 4 opamps in one package. Gotta go now.

Thanks, I tend to be long winded myself so I won’t hold it against him. Thanks for the heads up.

The input voltage divider on that circuit will drain an 18650 cell rather quickly… not suited for leaving across a flashlight battery unless it is switched on/off. It was designed for a car battery.

Thanks, I have seen other types of voltage divider circuits but I started with this as an example of what I’m looking for. A low current (50mA or less) would be a requirement as well.

Thanks Major, interesting video. Just the sort of tutelage I need. The LM3914 would be perfect if it came in a 4 channel 8 pin smt package as I don’t need 10 LEDs and want to keep it on a small pcb.

The four triangles representing operational amplifiers (op-amps) are wired up as voltage comparators — the output goes high if the + input voltage is above the - input voltage (there are lots of other fun tricks you can make op-amps do by appropriately feeding the output back into one of the inputs).

R2 and D1 together generate a reference voltage, here 5.6 volts. R3 through R6 then further divide those 5.6 volts to get three additional reference voltages. The pot R6 is wired to form a variable resistor, allowing you to fine-tune the additional voltages.

R1 and R7 divide the battery voltage to make it equivalent to the reference voltages at desired values.

Since op-amps need very little input current in comparator mode, you should be able to multiply the resistances for R1 through R7 by 10 or even 100 to reduce drain, though the op-amp chip itself may draw tens of milliamps (I don’t have a data sheet handy). To change the threshold voltages for having the LEDs light up, you’ll need to adjust the relative values of the resistors, and if you want the lowest threshold to be below 6 volts, you’ll need to find a zener diode with a lower breakdown voltage.

That’s a great post thanks. Some good info coming in so far. Obviously, an abbreviated version of the LM3914 would be the simplest to implement, but I’ll learn more using something like this.

I’m mulling over the idea of using 4 discrete opamps spaced around a ring with the ladder on a inner ring and res+diode on an outer ring. The smallest single chip opamp I’ve seen is a to23-5 which is small . Great space saver but might be too micro for me to do. Question: What is the diameter of a tail cap switch pcb for an 18650 light? Also, is there a single opamp chip in a slightly larger package? Maybe to223-5?

  • I’ve spent the last few evenings trying to sort through different circuits and figure out voltage dividers and this is where I am.
    Copied here for reference:

EDIT Note: each opamp turns on when the voltage on the + pin is higher than the voltage on the - pin.

.p If I change R1 from 15K to 6K then by the formula for a voltage divider all of the + inputs would see (10K/6K+10K)Vbattery or .625Vbatt.

.p If I use a 5V Zener for D1, then with an 8.4V supply D2 lights at Vbatt> 8.0V since .625 x 8 = 5.

.p If I then adjust the 10K pot to 5731 ohms, with the remaining resistors unchanged, the other trip points become: 7.3V, 6.6V, and 5.9V respectively.

.p QUESTION Could R1 and D1 be replaced with an LD7981 5V 100mA voltage regulator that also controls the input voltage to the LM324?

.p If that were the case then I could maintain 2mA to each led as it lights regardless of battery voltage.

.p The current consumed would be 4 x 2mA + 2-3mA for the LM324 + .4mA for the 7981(or 1-3mA for Zener + R2) +…64mA across R1 & R7 = 12-15mA.

.p How I got here:
I wanted all the LEDs To be on down to 8V and I wanted to use an LD7981 5V. That provided me with the ratio .625 to recalculate R1. I the chose my trip points .7V apart and used that voltage drop to figure the current through one resistor R3 at EDIT(.7V x .625 / 680) =~.64MA.Then I divided the Zener voltage by this current to get the total of R3-R6 and from this total subtracted the 3 x 680 ohm R’s to get R6. -EDIT-To get the most accurate value for R6 I should probably use a 5.5KR and a 500 ohm linear pot.

I’m going to wait a bit or until someone with a clue can verify ALL^ before I do more just in case I have it all wrong.

I’d probably try to do that in the MCU, just like the NANJGs do it, but with a matching voltage divider. With the 3 unused pins you could control 3 LEDs easily or up to 6 LEDs with some more effort. How abour a duo-LED or a RGB-LED?

I like that and it would be great but seemed above my current ability. Since this is in parallel with that OTHER idea (which works due mostly to your suggestion of the 7805) I was just taking a baby step in that direction. What would be really nice would be to replace the tailcap switch pcb and 105C(or like driver), and this gizmo with a single board. I know it saves wire but it just seems like poor design to put both heat sources(LEDs and 7135’s) back to back in one pill. I think it might be fun to share the development of that idea(or another) with a few others as a sort of BLF family letter both to share the cost and pool skills while sharing the knowledge in the forum.

  • Back on thread I chose 4 LEDs initially to give trip points for switching out drive resistors and to let me know when I should switch to low mode and when to replace the pack. 3 LEDs just limits the amount of info displayed.

I am probably misunderstanding this but the max Vdrop across R2 is 14V - 5.6V = 8.4V, divided by R2(1.2K)= 7mA.

  • Across R1 + R7 = 14V/25K = .56mA plus some nanoA input currents.
  • The ratio for this circuit is 10K/(10K + 15K) = .4. .4 x 14V = 5.6V hence 5.6V Zener. D2 wont be on for long. .4 x 13V = 5.2V which is .4V less than ZenerV so R3 = 680 ohms dropping .4v has .4V/680 = .59 mA plus some more nanoA bias current.
  • 5.6V drops across R3-R6 is .000588A so R6 = (5.6V/.000588A) - 3(680 ohms) = 7480ohms hence 10K ohm pot.
  • Total losses not including LEDs and quiescent supply is < 9mA.
  • The choice of R8-R11 will determine Io and the LM324 is rated at 3mA or less(don’t know if this is per opamp or for the whole IC). So the whole could easily be less than 50mA.
  • EDIT- You are quite correct that 50 mA is much to high a drain to leave on the battery all the time. I had assumed but not stated that this gizmo would only function when the light was in use. I know that voltage dividers are only accurate when the output urrent (in this case the bias currents) are small relative to the divider current. How small is small enough? I read that errors can occur when the ratio approaches 1/10. Is 1/100 enough? This would in essence reduce the power consumption to that of the LM324 and LEDs alone as the rest would be less than 1 mA

I just found a site Oshpark that will make three copies of a two-sided board for $5/sq inch. They “batch” different orders together to save set up cost on each. That’s $5 for three copies, wow! By varying the resistors I could make one for 1s, 2s, and 3s li-ion. I assume shipping would be extra.

The question now is do I use Eagle or Gerber. Any recommendations?

If you have a modernish inkjet or laser printer and are planning on using eagle CAD program i am sure you could make the PCB’s yourself with this stuff

http://www.ebay.co.uk/itm/12xA5-6x8in-Dry-Film-Photoresist-Developer-Remover-Kit-for-PCB-Photo-Resist-/300706676221?pt=Vintage_Electronics_R2&hash=item460383bdfd

i bought some (from china tho the same)and its awesome stuff, even if you are not doing them yourself buy some anyway i love it!
I consider it better than the toner transfer method and cheaper than sensordised pcb’s. plus if you heat it above ~160c it turns dark blue/black and goes really hard which is handy for lettering panels etc.

I am using the free eagle but couldnt make it work at first, so started watching the beginner tutorials on youtube and have got the the stage i can make simple surface mount pcb’s no problem, this is how i do it with that great dry film mask stuff.

I dont use all the fancy laminater and exposure stuff a halogen light bulb exposes it just great.

Good luck with your project.

Sweet find on the oshpark thing. Wish I could contribute more to your apparent progress man- you are really moving here. Love to follow your work and progress like this so thank you for sharing this stuff :-)

I’ve used them for many boards. They do excellent work.

Eagle is a schematic capture and PCB layout program. Gerber is a standard format for generating images of the PCB traces. Eagle (and most other PCB laybout programs) can produce Gerber format files (and drill files). The nice thing about using Eagle with this service it you don’t need to go through the steps of making the Gerber files, they can do it directly from the Eagle files. Producing Gerber and drill files can be a bit tricky and error prone… every board production house seems to have their own requirements for what they expect.