How Too Peripherals Python Tutorials

Measure Current/Voltage with INA219 Current Sensor

Post Reply
raspberrypi / howtoo     Views: 4398Prev .. Next
Measure Current/Voltage with INA219 Current SensorPosted: Saturday, February 11, 2017 [19:25:51] - 1
rootPosted by:rootMember Since:
June 16 2010
Posts: 357
Wiring INA219 I2C current sensor to Raspberry Pi:

Post 86859151 Image 1

Configuring I2C:
https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c

Python Port for INA219/I2C library:
https://github.com/scottjw/subfact_pi_ina219

A quick example to query INA219 module:
View Codefrom ina219 import INA219
import time

SHUNT_OHMS = 0.1
MAX_EXPECTED_AMPS = 2
ina = INA219(SHUNT_OHMS, MAX_EXPECTED_AMPS)
ina.configure(ina.RANGE_16V)

bvolt = "%.3f" % ina.voltage()
shvol = "%.3f" % ina.shunt_voltage()
curr = "%.3f" % ina.current()
pwr = "%.3f" % ina.power()
tvolt = "%.3f" % ( ina.voltage() + ina.shunt_voltage() / 1000 )
print ("\tBus voltage: " + str(bvolt) + "V\n\tShunt voltage: " + str(shvol) + \
"mV\n\tCurrent: " + str(curr) + "mA\n\tPower: " + str(pwr) + "mW\n\tVoltage: " + str(tvolt) + "V\n")
time.sleep(1)


Great resource for Solar/battery/load power logging with Raspberry Pi and INA219:
https://binaryfury.wann.net/2014/04/solarbatteryload-power-logging-with-raspberry-pi-and-ina219

Fairly easy to setup.There's no place like ~
RE: Measure Current/Voltage with INA219 Current SensorPosted: Thursday, May 19, 2022 [14:06:56] - 2
Posted by:SamPosts: 3
Do you have a diagram for YHDC current sensors?
raspberrypi / howtooPrev .. Next
 
Post Reply
Home - Raspberrypi: How Too Peripherals Python Tutorials
Our Telegram Group