Powermon Guide Rev1 0

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 12

Powermon Guide Rev. 1.0 03/10/2019
Table of Contents
1 Description............................................................................................................................................1
2 Usage.....................................................................................................................................................2
2.1 Scenarios.......................................................................................................................................2
2.2 Run Menu......................................................................................................................................3
2.2.1 Fields:....................................................................................................................................4
2.2.2 Status:....................................................................................................................................5
2.2.3 SNAPSHOT:..........................................................................................................................5
2.2.4 CLEAR:.................................................................................................................................5
2.2.5 START:..................................................................................................................................5
2.3 Other Menus..................................................................................................................................6
2.3.1 Setup:.....................................................................................................................................7
2.3.2 Limits:....................................................................................................................................8
2.3.3 Calibration:............................................................................................................................9
3 Source and data files.............................................................................................................................9
4 Installation...........................................................................................................................................10
1 Description
Powermon is a device built around the Texas Instruments INA219 chip, that can simultaneously
measure DC voltage and current and therefore calculate power. Powermon also measures run time and
which allows it to calculate capacity (mAh) and energy (mWh) for testing batteries. The accuracy of
voltage and current measurements is 0.5%. The current accuracy depends of course on the tolerance of
the shunt resistor. It uses an internal 0.1 Ohm 1% shunt but external shunts can be connected to extend
the current range. Powermon allows voltage and current measurements to be calibrated to get better
than 0.5% if a suitable reference is available and stores the calibration values for different shunts.
The voltage range is limited to 0..26V DC maximum (without protection diodes). With protection
diodes shown in the schematic, the voltage is limited to 0..20V. The voltage must never get negative
or exceed the maximum voltage or you will damage the INA219 chip.
Specs:
Table 1: Basic specs
Voltage 0..20VDC in 10 mV resolution Voltage is internally measured and
TheHWcave 1 of 12
Powermon Guide Rev. 1.0 03/10/2019
recorded in 4mV resolution but displayed
in 10 mV resolution
Current 0..±400mA in 12.5uA resolution
0..±800mA in 25uA resolution
0..±1.6A in 50uA resolution
0..±3.2A in 100uA resolution
(0.1 Ohm shunt)
Burden voltage: 100 mV/A
Powermon calculates the following parameters which can be selected for displayed
Table 2: Parameters that are measured (or calculated) and displayed or recorded
Measurement Display Snapshot recording Recording
Voltage (bus or load,
selectable)
Always: upper left Yes Yes
Current Always: upper right Yes Yes
Power Selectable field Yes Yes
Capacity Selectable field Yes Yes
Energy Selectable field Yes Yes
Run time Selectable field Yes Yes
Highest voltage Selectable field Yes -
Average voltage Selectable field Yes -
Lowest voltage Selectable field Yes -
Highest current Selectable field Yes -
Average current Selectable field Yes -
Lowest current Selectable field Yes -
Highest power Selectable field Yes -
Average power Selectable field Yes -
Lowest power Selectable field Yes -
INA219 shunt voltage Selectable field Yes -
INA219 bus voltage - Yes -
INA219 power - Yes
Sample count - - Yes
TheHWcave 2 of 12
Powermon Guide Rev. 1.0 03/10/2019
2 Usage
2.1 Scenarios
Figure 1 shows the basic wiring to measure the
charge flowing into a battery. The charge begins
when the relay is (manually) activated. The
LIMITS function allows the charge to be
terminated when one of the thresholds is
exceeded, for example run time.
To measure the voltage of the battery (and not the
charger), SETUP-VOLTS must be set to V =
LOAD
Figure 2 shows the basic setup to measure the
capacity of a battery by discharging it into a load.
The discharge begins when the relay is activated
and can be automatically terminated when one of
the LIMITS thresholds is reached, for example a
minimum voltage. To measure the voltage of the
battery (and not the load), SETUP-VOLTS must
be set to V = SUPP.
Figure 3 shows how to connect an external shunt
resistor to extend the current range. The wire
bridge between the two red terminals must be
removed for this. The value of the external shunt
must be selected in the SETUP-SHUNT menu and
Powermon should have been calibrated before,
using this external shunt.
Note that the max. current for the relay is 10A.
For higher currents, the internal relay must be
bypassed by connecting the load to the yellow
terminal instead.
TheHWcave 3 of 12
Charger + -
battery
Powermon
Figure 1: Measuring charge into a battery
+ -
battery
Powermon
Figure 2: Measuring battery capacity
+ -
battery
Powermon
shunt
Figure 3: Using an external shunt
Powermon Guide Rev. 1.0 03/10/2019
2.2 Run Menu
The standard display while doing measurements is the Run Menu. It also comes up automatically after
power-up. While in the run menu, the display looks like Figure 4 below
The button assignments in the run menu are shown in Table 3
Table 3: Button assignments in the Run Menu
PREV SEL NEXT BACK
Short
press
cycle through field options
for the LEFT field
SNAPSHOT cycle through field options
for the RIGHT field
Return to main menu
Long
press
In manual range:
decrements range
Toggles between auto and
manual range mode
In manual range:
increments range
in auto range: CLEAR
START
2.2.1 Fields:
Using short presses on the PREV or the NEXT buttons cycles the left or right fields through one of 16
options for display. These are:
(1) empty (nothing is shown)
(2) capacity (mAh)
TheHWcave 4 of 12
Voltage Current
LEFT
FIELD
RIGHT
FIELD
Auto or Manual range
and range values
shunt volt range:
Auto Man
40 mV: A a
80 mV: B b
160mV: C c
320mV: D d
Figure 4: Run Menu display
Powermon Guide Rev. 1.0 03/10/2019
(3) energy (mWh)
(4) power (W)
(5) Run time (hh:mm:ss)
(6) Highest voltage (V)
(7) Average voltage (V)
(8) Lowest voltage (V)
(9) Highest current (A)
(10) Average current (A)
(11) Lowest current (A)
(12) Highest power (W)
(13) Average power (W)
(14) Lowest power (W)
(15) Shunt voltage (mV)
(16) Status
2.2.2 Status:
An example of the status display selected in the left field is shown below:
TheHWcave 5 of 12
Powermon Guide Rev. 1.0 03/10/2019
2.2.3 SNAPSHOT:
When pressed, Powermon takes a snapshot of most of the parameters that are currently measured or
calculated and adds them as a new line to the SNAPSHOT.TXT file. If the file does not exist, it is
automatically created. Each line in the SNAPSHOT file starts with a unique date+time stamp. The file
format is CSV, so it is possible to import the file into a spreadsheet.
2.2.4 CLEAR:
When pressed, CLEAR resets all calculated statistics values back to zero and restarts the run time
counter.
2.2.5 START:
When pressed, START does three functions in one go:
(1) perform a CLEAR
(2) start Recording (if automatic recording is enabled)
(3) activate the relay
START is ideal to conduct measurements that perform recording such as discharge or charge of
batteries
TheHWcave 6 of 12
R : Recording ON
- : Recording OFF
L : Volt = load side
S : Volt = supply side
: no limit set
: hi limit set
: lo limit set
: hi+lo limits set
Blink = limit reached
High (max) Energy limit
High (max) Capacity limit
High (max) Time limit
High / Low Current limits
High / Low Voltage limits
Figure 5: Run Menu display with status
Powermon Guide Rev. 1.0 03/10/2019
2.3 Other Menus
There are just two menu levels, the main menu and everything else. The normal way of operating is to
select a sub menu from the main menu and when finished, a short press of the BACK button returns to
the main menu. There is no way to go from one sub menu directly to another, so to go from LIMITS to
SETUP you must first return to MAIN. The one exception to that rule is that a long press of the BACK
button in each sub menu goes directly to the RUN menu.
Figure 7 shows a detailed map of all sub menus and their options.
TheHWcave 7 of 12
Figure 6: Menu levels
Main
Run Setup Limits Calibration
(shortcut to RUN menu by long-press of BACK button)
Powermon Guide Rev. 1.0 03/10/2019
2.3.1 Setup:
All changes in setup are automatically saved in SETUP.TXT and restored when the program starts
Show: shows the current setup values without allowing any changes to be made.
Default: resets the setup to default values
Volts: selects which voltage is displayed (and recorded), the supply side (red terminals) or the load side
(yellow or white terminals). The two voltages differ by the voltage drop across the shunt resistor.
RecOpt: Allows a choice of recording options. They are
RecChg: records only changes of more than 10mV in voltage or 1mA in currently
RecFast: records every measurement and thus produces very large files very quickly.
Rec 1s ...Rec5min: records at regular time intervals from one every second to on every 5
minutes.
TheHWcave 8 of 12
Figure 7: Menu structure
Run Limits Relay Record Setup Off
Show Clear Load Save HiVolt LoVolt HiAmps LoAmps Time[s] C [mAh] E[mWh]
Show Default Volts Shunts
Main:
Limits:
Setup:
on/off
select
on/off
select
on/off
select
run
menu
on/off
select
shunt
select
show
menu
(to
Setup)
(to
Limits)
(back to main)
show
menu
edit
menu
edit
menu
edit
menu
edit
menu
edit
menu
edit
menu
edit
menu
RecOpt
option
select
Cal
(to
Calibration)
Sampls
sample
select
ARec
on/off
select
Show Volts Cur A
show
menu
cal
menu
cal
menu
Cur B
cal
menu
Cur C
cal
menu
Cur D
cal
menu
Calibration:
Powermon Guide Rev. 1.0 03/10/2019
Arec: Automatic recording (on / off). When selected on the START button in the RUN menu will also
start recording
Sampls: Selects the number of samples taken and averaged by the INA219 chip. Higher sample rates,
reduce noise but also slow down the measurements
Shunt: selects a different shunt resistor (and its calibration data)
2.3.2 Limits:
Limits can be saved and loaded from LIMITS.TXT but this is not done automatically. By default there
are no limits set.
Show: shows the current limit values without allowing any changes to be made.
Clear: deletes all limits in memory (not in LIMITS.TXT)
Load: loads all limits from LIMITS.TXT
Save: saves the current limits to LIMITS.TXT, overwriting any previously saved values.
HiVolts: allows setting of a high voltage limit. A long press of SEL activates or deactivates the
checking for this limit. If HiVolts is set and active, the relay is deactivated if the voltage exceeds the
limit. Note: HiVolts must be greater than LoVolts
LoVolts: allows setting of a low voltage limit. A long press of SEL activates or deactivates the
checking for this limit. If LoVolts is set and active, the relay is deactivated if the voltage falls below the
limit. Note: HiVolts must be greater than LoVolts
HiAmps: allows setting of a high current limit. A long press of SEL activates or deactivates the
checking for this limit. If HiAmps is set and active, the relay is deactivated if the current exceeds the
limit. Note: HiAmps must be greater than LoAmps
LoAmps allows setting of a low current limit. A long press of SEL activates or deactivates the
checking for this limit. If LoAmps is set and active, the relay is deactivated if the current falls below
the limit. Note: HiAmps must be greater than LoAmps
Time: allows setting of a time limit. A long press of SEL activates or deactivates the checking for this
limit. If Time is set and active, the relay is deactivated if the run time exceeds the limit.
C[mAh]: allows setting of a capacity limit. A long press of SEL activates or deactivates the checking
for this limit. If C[mAh] is set and active, the relay is deactivated if the capacity exceeds the limit.
TheHWcave 9 of 12
Powermon Guide Rev. 1.0 03/10/2019
E[mWh]: allows setting of an energy limit. A long press of SEL activates or deactivates the checking
for this limit. If E[mWh] is set and active, the relay is deactivated if the energy exceeds the limit.
2.3.3 Calibration:
Calibration values are saved in the CALDATA.TXT file. Voltage calibration is independent of the shunt
resistor but current calibration works only on the selected shunt (SETUP-SHUNT)
Show: shows the current calibration values without allowing any changes to be made. These values
sometimes but not always very small. To be able to show anything meaningful in the limited space, the
program uses a notation that employs m (milli), u micro), and n(nano) notation if necessary.
Volts: allows the calibration of the voltage range. Calibration uses 2 steps, a low target and a high
target. For each step a reference instrument must be used to ensure that the applied voltage matches the
target value. Once that is confirmed using the SEL button, Powermon calculates the required
calibration values, applies them and stores them in CALDATA.TXT.
CurA .. CurD: allows the calibration of the 4 current ranges. It uses the same 2 step process as
described above except that now target currents are use.
3 Source and data files
Table 4: Source and data files
Name Content Expected location
Buttons.py Handling of buttons (keypad) ~/INA
Cal.py Calibration dialog ~/INA
CALDATA.TXT Stores shunts and calibration data ~/INA
CommonDefs.py Common definitions across all Powermon
modules
~/INA
Display.py Run menu and display conversions ~/INA
Edit.py Dialog allowing editing of numbers ~/INA
INA219.py Handles the INA219 chip ~/INA
LCDpanel.py Handles the LCD panel ~/INA
LIMITS.TXT Saved limits ~/INA
TheHWcave 10 of 12
Powermon Guide Rev. 1.0 03/10/2019
Name Content Expected location
Measure.py Calculates statistics and loads and saves files
(SETUP.TXT, CALDATA.TXT)
~/INA
Menu.py Dialog for selecting options from a list ~/INA
Powermon.py Main program and all menus except run menu ~/INA
Recording.py Handles recording in CSV format ~/INA
Relay.py Handles the relay output ~/INA
SETUP.TXT Stores the setup data ~/INA
Show.py Dialog to show values but not to edit them. ~/INA
SNAPSHOT.TXT Snapshot data (automatically created) ~/INA/Rec
REC_yyyymmddhhmmss.csv Recording file (automatically created).
“yyyymmdd” is year, month,day, “hhmmss” is
hour, minute, sec
~/INA/Rec
powermon.service Service description to automatically start
powermon at boot
/lib/systemd/system/
4 Installation
On Raspberry Pi, as user Pi,
create directory INA, i.e. /home/pi/INA and
subdirectory Rec i.e. /home/pi/INA/Rec
In Raspberry Pi configuration menu:
enable SSH and I2C (and VNC if you want to use it)
setup networking (Wifi) to be able to remote login and get your recording files.
Install Adafruit GPIO library
Install Adarfruit-Blinka
Install Adafruit-CircuitPython-CharLCD
Copy all python files and text files to /home/pi/INA
copy file powermon.service to /lib/systemd/system/
TheHWcave 11 of 12
Powermon Guide Rev. 1.0 03/10/2019
change permissions:
sudo chmod 644 /lib/systemd/system/powermon.service
configure systemd:
sudo systemctl daemon-reload
sudo systemctl enable powermon.service
sudo reboot
TheHWcave 12 of 12
Page 1 of 12 - Powermon Guide Rev1 0
Page 2 of 12 - Powermon Guide Rev1 0
Page 3 of 12 - Powermon Guide Rev1 0
Page 4 of 12 - Powermon Guide Rev1 0
Page 5 of 12 - Powermon Guide Rev1 0
Page 6 of 12 - Powermon Guide Rev1 0
Page 7 of 12 - Powermon Guide Rev1 0
Page 8 of 12 - Powermon Guide Rev1 0
Page 9 of 12 - Powermon Guide Rev1 0
Page 10 of 12 - Powermon Guide Rev1 0
Page 11 of 12 - Powermon Guide Rev1 0
Page 12 of 12 - Powermon Guide Rev1 0

Navigation menu