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

31 posts / 0 new
Last post
Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state
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

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

Edited by: Rufusbduck on 09/26/2012 - 22:40
mattthemuppet
Offline
Last seen: 16 hours 19 min ago
Joined: 01/04/2012 - 16:20
Posts: 1271
Location: WA

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 Smile

Major
Major's picture
Offline
Last seen: 4 years 7 months ago
Joined: 11/10/2011 - 13:59
Posts: 232
Location: Peak district, UK

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.

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

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.

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state
Major wrote:
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.

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

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

texaspyro
Offline
Last seen: 7 months 2 weeks ago
Joined: 04/29/2011 - 12:43
Posts: 4593

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.

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

texaspyro wrote:
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.

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

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.

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

ralf
Offline
Last seen: 1 year 4 months ago
Joined: 05/12/2011 - 22:49
Posts: 108
Location: USA

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.

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

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.

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

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?

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

  • 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 × 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 × 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 × 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.

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

DrJones
DrJones's picture
Offline
Last seen: 3 years 9 months ago
Joined: 01/05/2011 - 13:30
Posts: 1044
Location: Frankfurt, Germany

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?

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state
DrJones wrote:
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.

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

texaspyro wrote:
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.

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 × 14V = 5.6V hence 5.6V Zener. D2 wont be on for long. .4 × 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

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

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.

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

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

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

Major
Major's picture
Offline
Last seen: 4 years 7 months ago
Joined: 11/10/2011 - 13:59
Posts: 232
Location: Peak district, UK

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-6×8in-Dry-Film-Photoresist-Developer-Re...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.

http://www.instructables.com/id/Killer-PCBs/

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

Good luck with your project.

Ledsmoke
Ledsmoke's picture
Offline
Last seen: 10 months 1 week ago
Joined: 08/08/2011 - 16:05
Posts: 1995
Location: Denmark

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 Smile

~ Ledsmoke ~

Dutch humor:

[quote=djozz]

 I do not think that the BLF-community ben

texaspyro
Offline
Last seen: 7 months 2 weeks ago
Joined: 04/29/2011 - 12:43
Posts: 4593

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.

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

I love this forum. You guys are the greatest.

  • Major, I have an HP Photosmart C4680 printer, scanner, copier. Will that work? Thanks for the links. I’ll watch them.
  • Texas, thanks, that’s the sort of detailed info that leads me on and helps me grow. Like a QB leading a receiver. I understand enough to reach for more. So you’re with Major and would reccommend learning to use Eagle?
  • Ledsmoke, I get so much info and entertainment from all the threads here, from the daily joke thread to the welcoming committee plus all of the fantastic mod work done that its nice to find a gap where I can tuck my shoulder in and push. It’s pretty slow going most of the time but that’s how I work. Read and learn up front, then apply and learn some more by doing.

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

I think the HP is an inkjet not laserjet so may just try Oshpark if I can generate a decent file in Eagle. The rest of the parts are pennies.

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

I’ve loaded Eagle freeware onto my laptop and have read the tutorial from end to end. I’m taking it on faith that after 2 or 3(maybe 4 or 5) more read throughs it will start making sense. There are quite a number of terms that are not part of my vocabulary and it will take a while to burn in my organic eprom. While its possible to make a pcb with a pen, in order to get the board size I want I’ll need to learn some kind of software to generate the narrow traces and ic footprints needed. Unless someone expresses an interest (or I get stuck) I will avoid posting the gory details and stick with pictures and short sentences like: Is there an Eagle for Dummies anywhere? And Why is there no glossary in the tutorial pdf. The circuit above is certainly not complicated so as soon as I get a handle on the toolbars and commands it should go quickly(dream on McDuff). :Sp

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

I’ve been sadly neglecting my homework with eagle however instead I drew it up the old fashioned way to see how the pieces would fit. I started by blowing up the scale by 10:1 and laying out the footprint of the quad op-amp and going from there. Right away it became obvious that I would have to use the resistors as jumpers to generate a one sided board. This is desirable so that I can stack this board on a 105C and put the battery spring on the bottom of this board. After dinner I will edit this post to include a picture of my artwork. I’m pretty certain that I will be using Oshpark to make the boards as my minimum trace width is 16 mil and the minimum spacing is 12mil and I’m not confident this can be done with photo resist and for the price it’s not worth trying. Maybe another board but not this one.
There are some extra lines in the middle where I decided to add copper to the input and ground traces. The Zener diode has been eliminated in favor of a 5 volt regulator chip and I’m using 1% resistors instead of a pot.

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

mattthemuppet
Offline
Last seen: 16 hours 19 min ago
Joined: 01/04/2012 - 16:20
Posts: 1271
Location: WA

very inspiring! I may end up going a similar route for a wireless remote receiver if I can’t find what I want commercially. The 5V chip you mentioned – this is to provide the 5V power supply for the board, right? What’s the input voltage (higher, I’m guessing)? Getting the right voltage to a receiver from a 2S li-ion battery is proving quite a challenge.

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

Dr Jones was kind enough to clue me into the 7805 chip in my other thread 7135 drivers at higher voltages
It works from ~7V-30V and looks just like a 7135. For a 2s battery I’ll use a similar chip, the ld2981 which should work from 5.2V-16V. The dropout voltage is much lower (.2V@100mA-.007V@1mA) on the 2981 which allows it to work down to full discharge. The 7805 has a 2V overhead so it works with 3s or more. Both chips are available from Mouser but I bought the 7805’s off eBay. The 2981 also requires capacitors that the 7805 does not. They are available in different output voltages.

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

mattthemuppet
Offline
Last seen: 16 hours 19 min ago
Joined: 01/04/2012 - 16:20
Posts: 1271
Location: WA

interesting, thanks!

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

Making progress. I’ve managed to do the schematic capture part and now need to turn it into a board file. One neat thing about this design is only 2 resistors(R1&R6B , see paper pcb layout) need to change for different battery voltages. I think I’ll change the orientation of R6B to make it easier to access. I think I may increase board diameter to 17.5mm to give me room for I/O capacitors. This might give me room for a second ground ring via to better connect/support the pcb on the driver pcb. I’d remount the + spring on this pcb. The most current working idea is to set this board up so it stacks on a 105C board. The LEDs are in a 90 degree arc so would all be visible at the same time.

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

Stayed up into the wee hours plunking away. The good news is that the software seems to work properly. The bad news is that my soft tissue is slower on the uptake so I keep doing things over as I learn. I’d show the progress but I haven’t figured out how to copy the board file page. The 0805 solder pads are too large and I need to either resize them or create a new library device that has the size I want. I wonder if an 0805 jumper has smaller pads.

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott

Ledsmoke
Ledsmoke's picture
Offline
Last seen: 10 months 1 week ago
Joined: 08/08/2011 - 16:05
Posts: 1995
Location: Denmark

You sure are tenacious Scott.

Though I don't completely follow what you are saying here I do understand that you are still making progress. Personally I'd love to learn about this but I figure that I'd never get to use it anyway. Already I never have any time for simple mods so this? Way beyond me. But when you get it to work it sure will be something else. I can't help but wondering how I might incorporate it into my beloved X7.... Smile 

~ Ledsmoke ~

Dutch humor:

[quote=djozz]

 I do not think that the BLF-community ben

Rufusbduck
Rufusbduck's picture
Offline
Last seen: 11 months 1 week ago
Joined: 04/04/2012 - 15:34
Posts: 10389
Location: Golden state

Although I’m not designing this to sell, I am trying to make it possible to add it to an existing light if anyone wants one. Hence the small diameter. Last year I spent way too much time on Sudoku puzzles and spider solitaire. This is much harder and I Learn something new as well. That OTHER mod, the one with 7135’s is ready to go. I’d like to have this ready before I actually build a light even though I already have an idea cooking: quad XTE or XPG on a 25mm Cutter board 2s2p from 2s 18500’s using a 105C with each side of the board pushing 1.2A to each pair all in a copper headed host. I need to finish before post #1000. What a mouthful. I just found out I need to create my own “library” chips in order to make all the solder pads fit on this penny sized board. 12 resistors, 4 LEDs, a quad opamp, and the VR chip. Single sided of course.

Three Tanna leaves to give him life, nine to give him movement. But what if he eats the whole bag?

Scott