|Piclog - PicAxe Logger Controller.
||Page 1 | 2 | 3 | 4 | 5
Back to page 1
PicLog. Ver 1.2
This new version uses a much more accurate
method of current measurement. The previous version
used the PicAxe as a difference amp, and not a very
good one at that. Current resolution was limited to
about 50 steps, so if you wanted to read in 0.1 amp
steps, you could only read from -2.5 to +2.5 amps.
By moving the shunt resistor to the
-ve side of the battery, we increase our resolution
t0 over 150 steps, depending on what shunt resistance
you use. The PicAxe ADC is sensitive to 0.004 volts,
so if you want to measure in 0.1 amp steps, you would
need a 0.04 ohm shunt. Using ohms law....
R = V * I
R = 0.004 * 0 .1
R = 0.04 ohms
If you have a 0.1 ohm shunt....
I = V / R
I = 0.004 / 0.1
I = 0.04 amps resolution
The disadvantage of using a shunt resistor
on the battery -ve is we can no longer easily read -ve
amps ( or load ). Since the PicLog was designed to record
windmill performance, and not battery load, so we dont
need to record -ve amps. But if you do want to record
-ve current, there is another solution, keep reading.
Originally the PicLog circuits -ve or
ground connection was connected to the battery -ve.
We now need to put the shunt resistor between the source
-ve ( our windmill generator ) and the battery -ve terminal.
Our PicLog circuit now uses the sources -ve as its ground
terminal. This means the PicLog's -ve/ground is slightly
below battery -ve/gound terminal. In industrial electronics
this is a bit of a no-no, we loose "true ground"
at the PicLog, but for a simple windmill logger its
perfectly acceptable. We also change the current sense
input lead on the picaxe to the battery -ve terminal,
and remove one resistor on the circuit board. Below
( and included in the download ) is the updated circuit
There is a slight change to the PC software.
Version 1.1 worked out amps by looking at the difference
in the two ADC values from the PicAxe.
V1 = Battery Voltage
V2 = Shunt Voltage
VoltOffset = zero point
AmpDivider = Constant used to convert the PicAxe ADC
output to true amps, part of the calibration process.
BattAmps = Round((V1 - V2 + VoltOffset)
/ AmpDivider, 2)
The new version, 1.2, now just reads
the V2 directly as a amp value, it no longer needs to
compare it to the battery voltage.
BattAmps = Round((V2 - VoltOffset)
/ AmpDivider, 2)
The calibration screen has been changed.
I left the VoltOffset variable there so we could still
use the software to record + and - amps. There are some
hall sensor current sensors available that give us a
voltage depending on amps. 0 amps = 2.5 volts, so a
change in current up or down ( + or - ) gives us a voltage
from the hall sensor that goes up or down from 2.5 volts.
So the PC software will work with either a shunt resistor
or a hall sensor. If you want to use a hall sensor,
just omit the shunt resistor and connect the PicLog
-ve to the battery -ve
A couple of good hall sensors worth
looking into are...
http://www.allegromicro.com/sf/0750/ this is the ideal sensor to use.
http://www.dse.com.au/cgi-bin/dse.storefront/450357770e5bf3a42740c0a87f9c06f6/Product/View/Z2620 Not very linear, but cheap and easy to get in Australia
at most Dick Smith stores
I've also added a Watt Hours reading
to the main screen. This is set to zero on program start
or at midnight, so it shows the total watt hours for
If you built the Ver 1.1
PicLog circuit board its a simple task to modify the
circuit to suit the latest version, you only need to
remove the pots and add a couple of jumpers and 1k resistor.
For the latest version I designed a circuit board in
Express PCB. Express PCB is a free PCB design program
available from http://www.expresspcb.com/
You can download everything by clicking here ( Ver 1.2 ). The zip file contains the circuit
diagram in GIF and PDF format, the PicAxe code, the
PicLog application and source code, and mscomm32.ocx
and scrrun.dll( see below ), the HTML directory and
template file, and a few sample log files.
Update: Few bug fixes. Wont crash on incorrect com port or corrupt serial data. Updated Version Ver 1.3.
Another Update: There is a new PicLog version coming out soon. Its has a few bug fixes and adds remote logging. Watch this space!
- If there are bugs in the software,
or if you have a suggestion, please let me know .
But dont ask for help with modifying the source code
or explaining how it works, it comes as is.
- If you get the error "Component
mscomm32.ocx or one of its dependencies not correctly
registered..." then you need to copy the mscomm32.ocx
file ( comes in the Zip file ) into your c:/windows/system
directory. You may also need to copy the scrrun.dll
file as well. These are Microsoft run time file that
may not be on your computer.
- The program isn't perfect, and may/will
crash from time to time. I'll improve it as time allows.
- Feel free to reuse the PicLog software
and design for your own projects, but credit where
credit due, dont forget to mention where you got it
- I changed the serial data stream
to use <I> instead of <A> for the current
measurement about half way through developement, big
mistake as there are now two different versions of
the PicAxe and PC code. Download the latest version
to fix this problem.
Next Page, Vasi's conversion to PIC12F675.