Article: 64245 of rec.games.pinball
Path: aim.et.iupui.edu!indyvax.iupui.edu!usenet.ucs.indiana.edu!vixen.cso.uiuc.edu!uwm.edu!lll-winken.llnl.gov!nntp.coast.net!dispatch.news.demon.net!demon!mail2news.demon.co.uk!squidgy.sni.co.uk
Newsgroups: rec.games.pinball
Subject: PROJECT: Build Your Own Battery Level Indicator.
Message-ID: <31E51DA9@squidgy.sni.co.uk>
From: Clive Jones <CJones@sni.co.uk>
Date: Thu, 11 Jul 96 08:07:00 PDT
X-NNTP-Posting-Host: squidgy.sni.co.uk
Encoding: 307 TEXT
X-Mailer: Microsoft Mail V3.0
X-Mail2News-Path: gatekeeper2.sni.co.uk!squidgy.sni.co.uk
Lines: 306

No more lost high scores with the Squire's "Visubat"(tm).......

Well here it is as promised - a battery tester for giving visual   
indication of the battery pack in your pinball machine. Luckily I had a   
spare day forced on me by car trouble so I've managed to design and test   
the circuitry earlier than planned (fixed the car too!) and I've still   
got time to write this article, and maybe, down a bottle of my favourite   
wine!<hick>.


**READ THE INSTRUCTIONS CAREFULLY**.


<<Disclaimer>

I've designed, built and tested this circuit - so I know it works! I've   
posted it to the group with the provision that it is *not* manufactured   
for financial gain - make one for your self or a friend but *do not* sell   
it for profit! I take *no* responsibility for damage caused by bad   
installation - you should be able enough to take on the challenge of   
building it as the circuit is not complex - if you are unsure of your   
skills - DO NOT build and install it - ask a tech or a friend to do it   
for you. The circuit draws a pathetically low amount of power and *will   
not* damage anything - honest!!.

<<End>>

The circuit is designed to be fitted into a small box and then fitted   
into your backbox (the exact choice of position is yours). Only 3 wires   
are required - one for the battery +v, one for the *supply* +5 volts from   
the MPU board or power supply and a common return to ground. The circuit   
is designed for *4.5 volt battery packs* (3 cell x 1.5 volts). The   
circuit gives level indication using 3 LED's - one green (good), one   
amber/yellow (mid) and one *flashing* red LED indicating low battery   
power - 3.2v or less approx.

I think a 1.3-1.5 volt drop should be enough warning - I can't guage the   
drop-out voltage for CMOS memory standby in WPC games because of the   
ASIC, so, I've gone for what you see here.

*Theory of operation*

3 comparators compare the incomming battery voltage against 3 reference   
voltages provided by 3 potential dividers (see schematic), the 3   
comparators directly drive the LED's by sinking current to ground   
(internal). On power-up, the Green LED will always be on indicating good   
battery power. As the battery voltage drops, the amber LED will light,   
followed by the red flashing LED, the previous LED's remain *on* until   
all the LED's are lit.


I designed the circuit in this manner to cut down the component count and   
make the building easier. If you wish to modify the circuit so that LED's   
will extinguish one after the other - I suggest you use a 74HC03 quad   
NAND gate with *open-drain outputs* to sink the LED current, and, who's   
input's is switched by next comparator in sequence thereby turning the   
previous gate off (I would have given the schematic details here but I   
don't have the IC handy to incorporate into the design at the time).

IMPORTANT NOTE: If your battery pack provides 4.21 volts or greater when   
new then *all* the leds will remain off. In most cases, new batteries do   
not always put out their specified voltage - a small voltage drop is   
usual.

*Tools*

A decent soldering iron, a side-cutter, a small flat blade or philips 0   
screwdriver, a digital volt meter (DVM) or oscilliscope are all you need.

Okay, lets make a start - the circuit schematic;


[Circuit copyright - Clive Jones 7/1996]



 + = intersection (join), 339/n = connect to LM339 comparator pin "n",   
Gnd = ground (0 volts).


[Comparator Voltage References]


 +5v  +5v  +5v
  ^   ^   ^
  |   R1      |   R3      |   R5
       '--[1k0]--. '--[1k0]--. '--[1k0]--.
                 |           |           | 
       |      |           |
       +--.      +--.      +--.
       |  |       |  |      |  |
       |  |        |  |      |  '----->Vref3 (4.25v) to 339/4
       |  |      |  '------- | ------->Vref2 (3.75v) to 339/6
       |  '------- | --------- | ------->Vref1 (3.21v) to 339/8
       |       |      |
  .--[1k8]--' .--[3k0]--' .--[5k6]--'
  |   R2  |   R4  |   R6
  |   |   |
  -   -   -
 Gnd  Gnd  Gnd



[Power inputs and decoupling]


 +5v
  ^
  |
  '-----------+----------> +5 volts to circuit (339/3)
       C1 |
 Vbat   ---
  ^          0.1uF
  |          ---
  |           |
  '---------- | ----+----> Vbat (battery voltage) to R7, R8 and R9
    |  C2 |
    |    ---
    |    0.1uF
 Gnd    |    ---
  ^    |     |
  |           |     |
  '-----------+-----+----> Ground (0 volts) to rest of circuit (339/12)



[Comparators and LED drive]


                             |\
                   R7      4 |  \
 Vbat>---+---[1k0]------|+   \ 2     R10     LD1
              |            5 |     >-----[330]----|<]--------> +5 volts
              |   Vref3>-----|-   /              green
              |              |  /
              |              |/
              |
              |
              |                    3/4 IC1
              |
              |
              |              |\
              |    R8      6 |  \
         +---[1k0]------|+   \ 1     R11     LD2
              |            7 |     >-----[330]----|<]--------> +5 volts
              |   Vref2>-----|-   /              amber
              |              |  /
              |              |/
              |
              |
    |
              |
              |
              |              |\
              |    R9      8 |  \
         '---[1k0]------|+   \ 14    R12     LD3
                           9 |     >-----[330]----|<]--------> +5 volts
                  Vref1>-----|-   /               red
                             |  /              (flashing)
                             |/



Pretty simple eh?

The potential divers - R1+R2, R3+R4 and R5+R6 provide the reference   
voltages. If you wish to modify the circuit to output diferent   
references, then the potential divider voltage can be given by the   
formula;

   5(v) x R2
   ---------
    R1 + R2


*Building intructions*


DO NOT FIT THE 339 COMPARATOR UNTIL THE VERY END!

The circuit should fit on a board 2"x 2". Build the potential   
divders/voltage references *first*, supply them with +5 volts and ground   
(don't forget capacitors C1/2) and measure the output - they should be   
*approx* the figures given.

Next:- add a 14 pin socket (absolutely *vital*) to the board and run the   
reference voltages to the correct pins according to the schematic, then   
+5 volts and ground - now measure the voltages *at the socket* to ensure   
they're present.

Next:- add R7-R9 to the board at the pins specified and link the other 3   
ends *together*.

Next:- Build the following battery failure simulator on *another* small   
board then jumper the output to the *Vbat* line where R7-R9 are joined   
together;

[Note: - I had to do this because I don't have two years available to   
wait for batteries to fail!!!]




 +5v              .--------------------->Vbat sim. to R7-R9
  ^               |
  |      R13      |      P1
  '-----[1k0]-----+---[10k lin]---.
                       |       ^       |
                   |       |       |
                       '-------'       |
                        (wiper)        -
                                      Gnd


Next:- trim the 10k linear pot and observe voltage changes at 339/5,7 and   
9.

Next:- add the 330 ohm LED current limiting resistors R10-R12 followed by   
the LED's to the board (or mount them on small flyleads for fitting to   
the box cover). At pins 1, 2 and 14 of the socket you should get around   
3.7 volts.

Last but not least - add the LM or CA339 quad comparator and power up.   
You should have the green LED on (exception, battery >4.21v) - now rotate   
the 10k pot and the LED's should light in sequence - green, amber then   
flashing red. If they do not then power down and CHECK YOUR CONNECTIONS.

If the circuit works correctly then removed the Vbat sim. and add the 3   
flyleads to allow connection to the MPU board of your game. I suggest you   
use a red wire for +5 volts, a black wire for ground and another wire of   
you choice for the Vbat line.

Add all the bits into a little box and mount the box onto the backbox   
wall. I suggest that you actually drill holes in the cover for the LED's   
to protrude through, or, connect them to the board with small flyleads   
and glue them into the box cover.

Solder the flyleads to the MPU board with the **POWER OFF**. Allow the   
board 2 minutes before soldering in the leads as the onboard capacitors   
may still hold a charge.

USE COMMON SENSE! - don't tap the +5 volts for the circuit from a chip   
leg - find a free pad on the board that you can tap from. Wire the   
battery power from the pack were it enters the board and return to a   
suitable earth point.

KEEP IT NEAT! - Take pride in you work - make the flyleads tidy - use   
tye-wraps and lay the leads out nicely in the wiring loom, even better,   
use an in-line connector so that the remote battery indictor circuit can   
be disconnected from the board without having to desolder.

**Parts Listing**


All resistors are 1/4W 5%, all capactors are 50 volt.



R1,R3,R5,R5,R8,R9,R13,R14 - 1K ohm resistor
R2     - 1K8 ohm resistor
R4     - 3K0 ohm resistor
R6     - 5K6 ohm resistor
R10,R11,R12    - 330 ohm resistor
IC1     - LM339 or CA339 Quad Comparator
LD1     - Green LED
LD2     - Amber LED
LD3     - Red flashing LED (suggested).
P1     - 10K ohm linear potentiometer (or a 20k lin)
?     - Polypropolene box
?     - 14 pin DIL socket
C1,C2     - O.1u Farad capacitor (mica)
?     - Optional 4 pin line connector
?     - vero-board or square-pad board


If your good with electronics you could add a small piezo electric buzzer   
for an audible alarm.


That's it chaps - have fun!


BTW, I haven't received any e-mail for the last 48 hours, so, I'm   
assuming there are problems with our mail servers again <sigh> -   
appologies if my e-mail is bouncing - keep trying as the e-mail does   
eventually work it's way through. I'll be moving to net access at home   
shortly and these problems should be a thing of the past!


Clive
English Lord and Squire of property.....<c.jones@sni.co.uk> - okay yar?


   







 






