diff --git a/examples/ina219_simpletest.py b/examples/ina219_simpletest.py index 4212449..ae5c0d2 100644 --- a/examples/ina219_simpletest.py +++ b/examples/ina219_simpletest.py @@ -31,12 +31,20 @@ bus_voltage = ina219.bus_voltage # voltage on V- (load side) shunt_voltage = ina219.shunt_voltage # voltage between V+ and V- across the shunt current = ina219.current # current in mA + power = ina219.power # power in watts # INA219 measure bus voltage on the load side. So PSU voltage = bus_voltage + shunt_voltage - print("PSU Voltage: {:6.3f} V".format(bus_voltage + shunt_voltage)) - print("Shunt Voltage: {:9.6f} V".format(shunt_voltage)) - print("Load Voltage: {:6.3f} V".format(bus_voltage)) - print("Current: {:9.6f} A".format(current / 1000)) + print("Voltage (VIN+) : {:6.3f} V".format(bus_voltage + shunt_voltage)) + print("Voltage (VIN-) : {:6.3f} V".format(bus_voltage)) + print("Shunt Voltage : {:8.5f} V".format(shunt_voltage)) + print("Shunt Current : {:7.4f} A".format(current / 1000)) + print("Power Calc. : {:8.5f} W".format(bus_voltage * (current / 1000))) + print("Power Register : {:6.3f} W".format(power)) print("") + # Check internal calculations haven't overflowed (doesn't detect ADC overflows) + if ina219.overflow: + print("Internal Math Overflow Detected!") + print("") + time.sleep(2)