Using INA219 (GY-219) with the Raspberry Pi

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:

https://www.rototron.info/raspberry-pi-ina219-tutorial/
https://www.rototron.info/raspberry-pi-ina219-tutorial/

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:

OSError: [Errno 121] Remote I/O error

Run the following command:

i2cdetect -y 1

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.)


Posted

in

, , , ,

by

Comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

%d bloggers like this: