File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 31
31
bus_voltage = ina219 .bus_voltage # voltage on V- (load side)
32
32
shunt_voltage = ina219 .shunt_voltage # voltage between V+ and V- across the shunt
33
33
current = ina219 .current # current in mA
34
+ power = ina219 .power # power in watts
34
35
35
36
# INA219 measure bus voltage on the load side. So PSU voltage = bus_voltage + shunt_voltage
36
- print ("PSU Voltage: {:6.3f} V" .format (bus_voltage + shunt_voltage ))
37
- print ("Shunt Voltage: {:9.6f} V" .format (shunt_voltage ))
38
- print ("Load Voltage: {:6.3f} V" .format (bus_voltage ))
39
- print ("Current: {:9.6f} A" .format (current / 1000 ))
37
+ print ("Voltage (VIN+) : {:6.3f} V" .format (bus_voltage + shunt_voltage ))
38
+ print ("Voltage (VIN-) : {:6.3f} V" .format (bus_voltage ))
39
+ print ("Shunt Voltage : {:8.5f} V" .format (shunt_voltage ))
40
+ print ("Shunt Current : {:7.4f} A" .format (current / 1000 ))
41
+ print ("Power Calc. : {:8.5f} W" .format (bus_voltage * (current / 1000 )))
42
+ print ("Power Register : {:6.3f} W" .format (power ))
40
43
print ("" )
41
44
45
+ # Check internal calculations haven't overflowed (doesn't detect ADC overflows)
46
+ if ina219 .overflow :
47
+ print ("Internal Math Overflow Detected!" )
48
+ print ("" )
49
+
42
50
time .sleep (2 )
You can’t perform that action at this time.
0 commit comments