Skip navigation.

Designing the PC Power Monitor - Part II

In Part One of this project I developed a test circuit that proved that it would all work. In Part II, I actually redesign the bread boarded prototype into the final product.

I had thought to integrate the Motor battery V/A and the PC battery V/A onto the General Purpose PICAXE-40X board. However, I was struggling to come to terms with bringing the power cables into the PC housing. I thought it would be best to locate a sub-board close to the motor battery, and route the serial output back to the GP PICAXE-40X board. Also, this small board can be used right now in my GPS exploring walks etc.

Whilst the first circuit did work, it relied on the PC to monitor the Battery Voltage and Current being used. It would be nice if I could display the actual values - live, and have a buzzer that would alert me when the battery falls below a set voltage. This required me to upgrade to a PICAXE-18X chip. I also took the opportunity to redo the ACS712 SOIC-8 layout within my Eagle library.

After a few iterations at designing, building, prototyping on the breadboard, and then writing up the schematic diagram and board lay out etc, I ended up with this layout:

 

I enjoy doing board layouts. Nothing quite like playing around in a good maze of copper! At each stage I have uploaded a copy of the files to my Subversion repository. Incidentally, there are about 328MB of files in this section of the repository. The project has now been running for over 2 years.

And here is the board layout (as it stands today):

You can find a copy of the Eagle files at the bottom of this page.

The PICAXE program didn't have to change all that much, and is still quite small:

<code>

' this will monitor and report the 12V Battery and Current being used out to a serial port
' at 4800 bd. This is to be used with the SWASC Power Monitor - Computer circuit.
' This uses a PICAXE-18x so the current and voltage can be displayed onto a 2 x 16 line LCD
'
' Paul Hamilton - 20070916
'

' Local Variables
SYMBOL LOOPDELAY=500

' clear the LCD screen
serout 7,N2400, (254,1)
pause 30

MAIN:
' Blink a debug LED - one reading per blink/loop
high 1 ' set the LED on port 1 ON
pause LOOPDELAY
low 1 ' set LED off
pause LOOPDELAY
' lets read what the voltage is on the resistance ladder junction
READADC 1,b1
w2=b1*10/16 ' convert the reading from units to voltage * 10, ie. 119 = 11.9 Volts
' lets read what the current is being reported by the ACS712
READADC 0,b2
b3=b2-121
' because I am using a ACS712, Need to watch out for readings below 0 (ie 255)
' I really should be using a ACS713, then I wouldn't have this problem.
if b3<253 then SKIP
b3=0
SKIP:
sertxd ("V: ", #b1,", A: ", #b3,13,10) ' send data to PC
serout 7, N2400, (254,128,"V: ",#w2," ") ' display the Voltage. Need to mentally divide by 10
serout 7, N2400, (254,192,"A: ",#b3," ") ' display the current. Need to mentally divide by 10.
if b1>197 then MAIN
sound 6,(110,20,80,30) ' plays a Voltage Low warning sound
goto MAIN

</code>

The PICAXE AXE-033 LCD displays the battery voltage x 10, ie. 'V: 124' where you have to mentally divide by 10, so that it should read 12.4V Same with the current. The smallest current level it can sense is 100mA. If I included a LN321 op-amp, I could get it down to read 30mA per unit. But for now, 100mA is ok. Also, I don't have any of those op-amps, but I do have quite a few of it's larger cousin, the LM324. Since I don't have any of the LM321 chips and that none of my usual vendors don't carry it, I skipped it all together.

Lastly here is a shot of the bread board testing setup:

I am loading down the 12V 5A/Hr battery with a 5 ohm resister (near the top right hand corner - yellow alligator clip). I am drawing 2.1 Amps and the battery is reading 11.15 Volts. I also have a cable running to my PC. All good fun!

AttachmentSize
Eagle Library of the Allegro ACS712 - SOIC-82.04 KB
Power Monitor LCD PICAXE-18x program file1.35 KB
Power Monitor Schematic - 18x241.93 KB
Power Monitor Board layout - 18x22.22 KB