Hi everyone,
I’ve just setup an INA219B Voltage/Current sensor on my RaspberryPi. Just thought I’d link the tutorials and libraries I used – there’s a lot of really useful info out there.
Install the following library via git: https://github.com/chrisb2/pi_ina219
sudo pip3 install pi-ina219
Follow this tutorial: https://www.rototron.info/raspberry-pi-ina219-tutorial/
Misc Notes
- Common ground is required
- Vin – and Vin+ are attached to +, neither goes to ground
Custom Sensor Address
na = INA219(SHUNT_OHMS, MAX_EXPECTED_AMPS, address=0x41)
Can be configured via the following:
Enable Low Power Between Reads
ina.configure(ina.RANGE_16V)
while True:
print "Voltage : %.3f V" % ina.voltage()
ina.sleep()
time.sleep(60)
ina.wake()
If you’re getting the following error:
Run the following command:
And check to ensure that your device is showing up on 40. If it’s a different number you’ll just need to update the address in your code e.g. (0x40, 0x41, etc.)
Leave a Reply