BORA Lite SOM/BELK-L/Pheripherals/Power meter

From DAVE Developer's Wiki
< BORA Lite SOM‎ | BELK-L
Revision as of 17:43, 25 January 2021 by U0007 (talk | contribs) (Created page with "{{#lst:Physical_devices_mapping_(BELK/BXELK)| Power meter}}")

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Power consumption[edit | edit source]

Power consumption measure can be performed accessing the INA226 device connected to the I2C bus in the BoraEVB (U3). The following commands can be saved as a shell script (e.g. read_power_values) and run to collect the measurements data:

root@bora:~# cat read_power_values.sh
#!/bin/sh

path_dev=/sys/class/hwmon/hwmon0

IN1=`cat $path_dev/in1_input`
IN0=`cat $path_dev/in0_input`
VOLTAGE=`awk "BEGIN {print ($IN1-$IN0)/1000}"`
CURRENT=`cat $path_dev/curr1_input`
CURRENT=`awk "BEGIN {print ($CURRENT)/1000}"`
POWER=`cat $path_dev/power1_input`
POWER=`awk "BEGIN {print ($POWER)/1000000}"`
echo "Voltage: ${VOLTAGE}, Current: ${CURRENT}, Power:${POWER}"
root@bora:~# ./read_power_values.sh
Voltage: 3.308, Current: 0.64, Power:2.175
root@bora:~#