Hi mike, thank you for helping. Just another question, I had bought a new ina219 and it worked. As I am new to both raspberry pi and ina219, what steps should I take in order to read the current and voltage?adafruit_support_mike wrote:I just looked back at the photos and saw the Adafruit logo on the board in your photo.. I'm guessing you got it from one of our resellers?
If so, how long have you had it? Our return/replacement period is 30 days, and I think most of our resellers offer the same terms.
INA219 python library
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Anna553
- Posts: 11
- Joined: Thu May 28, 2015 10:47 pm
Re: INA219 python library
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: INA219 python library
We don't have a RasPi library for the INA219, but the first couple of pages in this thread have links to a version which a member of the community ported: https://github.com/scottjw/subfact_pi_ina219
It has an example script that will show you how to work with the library and the INA219. I think there are also code listings in some of the previous postings in this thread.
It has an example script that will show you how to work with the library and the INA219. I think there are also code listings in some of the previous postings in this thread.
- Anna553
- Posts: 11
- Joined: Thu May 28, 2015 10:47 pm
Re: INA219 python library
Hi mike, I had tried the code in https://github.com/scottjw/subfact_pi_ina219 and run without changing anything. However, syntax error was shown in ina219_example.py and I couldn't find the error. Do I have to modified anything in any of the file before I run??adafruit_support_mike wrote:We don't have a RasPi library for the INA219, but the first couple of pages in this thread have links to a version which a member of the community ported: https://github.com/scottjw/subfact_pi_ina219
It has an example script that will show you how to work with the library and the INA219. I think there are also code listings in some of the previous postings in this thread.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: INA219 python library
What was the error message?
- Anna553
- Posts: 11
- Joined: Thu May 28, 2015 10:47 pm
Re: INA219 python library
Here is the error.adafruit_support_mike wrote:What was the error message?
- Attachments
-
- ERROR.JPG (565.44 KiB) Viewed 871 times
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: INA219 python library
The error is saying that Python doesn't like a character in the file.
Did you download the files from Github as a zipfile, or did you copy/paste the text?
Did you download the files from Github as a zipfile, or did you copy/paste the text?
- Anna553
- Posts: 11
- Joined: Thu May 28, 2015 10:47 pm
Re: INA219 python library
I copy and paste it from Github.adafruit_support_mike wrote:The error is saying that Python doesn't like a character in the file.
Did you download the files from Github as a zipfile, or did you copy/paste the text?
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: INA219 python library
In that case, you probably got some unexpected characters along the way.
Download the zipfile and extract it to get clean/accurate copies of all the files.
Download the zipfile and extract it to get clean/accurate copies of all the files.
- Anna553
- Posts: 11
- Joined: Thu May 28, 2015 10:47 pm
Re: INA219 python library
Thanks mike!!! Now I can read it. I had tried measured it with and without a 1.5V AA battery. However, the result turn up less than 1V. Also, the bus voltage did not change at all. Is this the result I should get or is there some error in the coding??adafruit_support_mike wrote:In that case, you probably got some unexpected characters along the way.
Download the zipfile and extract it to get clean/accurate copies of all the files.
- Attachments
-
- rsz_img_0815.jpg (390.38 KiB) Viewed 822 times
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: INA219 python library
The code could be using an incorrect scale factor, but check the battery voltage with a multimeter while it's connected to the INA219 to make sure the value is different.
- Anna553
- Posts: 11
- Joined: Thu May 28, 2015 10:47 pm
Re: INA219 python library
The values i measured for the bus voltage remains the same. So is it because of the incorrect scale factor? If so, how do i identify the error?adafruit_support_mike wrote:The code could be using an incorrect scale factor, but check the battery voltage with a multimeter while it's connected to the INA219 to make sure the value is different.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: INA219 python library
If the multimeter reading is the same as the one coming from the INA219, we can assume that both are reasonably accurate.
- Anna553
- Posts: 11
- Joined: Thu May 28, 2015 10:47 pm
Re: INA219 python library
Yea, but my multimeter read differently from the ina219. Also. the bus voltage display is incorrectly as the bus voltage remain the same whether it is connected or not connected with a battery.adafruit_support_mike wrote:If the multimeter reading is the same as the one coming from the INA219, we can assume that both are reasonably accurate.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: INA219 python library
What value do you get from the multimeter?
- marks3
- Posts: 52
- Joined: Fri Oct 12, 2012 1:07 pm
Re: INA219 python library
This python library works very reliably on my Pi B (Revision 0003). But I get spurious Voltage (bus and shunt) results on a Pi 2 (Revision: China).
However the current results are very accurate and stable. I am measuring the supply to the Pi and Pi 2 in both cases and running the example code from the GitHub link.
I see current draw of about 330 mA on both units.
Has anyone seen problems on the Pi 2. It seems easy to reproduce but I don't have the talent to debug.
However the current results are very accurate and stable. I am measuring the supply to the Pi and Pi 2 in both cases and running the example code from the GitHub link.
I see current draw of about 330 mA on both units.
Has anyone seen problems on the Pi 2. It seems easy to reproduce but I don't have the talent to debug.
Please be positive and constructive with your questions and comments.