chrisb2 / pi_ina219

This Python library supports the INA219 voltage, current and power monitor from Texas Instruments with a Raspberry Pi using the I2C bus. The intent of the library is to make it easy to use the quite complex functionality of this sensor.
MIT License
114 stars 34 forks source link

Guide until get data of voltage and current ina219 using raspberrypi #10

Closed abeng94 closed 6 years ago

abeng94 commented 6 years ago

okay this LED in DIM condition (10% of brightness) -voltage - below 1 V Led in full brightness (100% of brightness) -voltage - above 5V

I measure using multimeter.

can u guide me until I get this value using ina219. I follow all video and this instruction . but get some error.

that error say the python cant find that lib.

thank you

abeng94 commented 6 years ago

this my wiring circuit ff

chrisb2 commented 6 years ago

It sounds like you executed your Python script and got an error like: Traceback (most recent call last): File "tmp.py", line 2, in <module> from ina219 import INA219 ImportError: No module named ina219 If so it seems like you have not installed the ina219 library using Python pip.

If you are using Python 2 to execute your script (python command), then you should install with: sudo pip install pi-ina219 you can check if its already installed with: pip list | grep ina219

If you are using Python 3 to execute your script (python3 command), then you should install with: sudo pip3 install pi-ina219 you can check if its already installed with: pip3 list | grep ina219

regards, Chris

chrisb2 commented 6 years ago

Closing for the moment, if you have further questions, please re-open.

langalibalele commented 2 years ago

I have re-installed your library several times. No matter which way I call it, I get ModuleNotFoundError: No module named 'INA219'

OK, so I found out what the problem was. I named my file ina219.py. The I renamed my file to voltage_ina219.py and it stopped throwing this error. But then I got this error: ImportError: bad magic number in 'ina219': b'\x03\xf3\r\n' I solved it using: https://stackoverflow.com/questions/52477683/importerror-bad-magic-number-in-time-b-x03-xf3-r-n-in-django

2022-06-02-222428_1920x1080_scrot

chrisb2 commented 2 years ago

Strange I agree. A couple of questions.

What Raspberry Pi is this? What version of Raspbian is this? If you execute the following what version do you see?

python3 -V

Chris

On Fri, Jun 3, 2022 at 8:33 AM langalibalele @.***> wrote:

I have re-installed your library several times. No matter which way I call it, I get ModuleNotFoundError: No module named 'INA219'

So frustrating! [image: 2022-06-02-222428_1920x1080_scrot] https://user-images.githubusercontent.com/13710760/171733109-e8a8e15a-c8b2-4a78-968d-77aa6ac467ed.png

— Reply to this email directly, view it on GitHub https://github.com/chrisb2/pi_ina219/issues/10#issuecomment-1145314684, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXR2V75RYX6X2J5TUBQUKTVNELDLANCNFSM4FAC7EMA . You are receiving this because you modified the open/close state.Message ID: @.***>

langalibalele commented 2 years ago

Hallo Chris,

Raspbian is up to date. I have a Raspberry 4 model B. I am using python v3. The problem was I named my python file ina219.py. I only figured this out after reading many forum posts ☹.

Thanks for answering.

Regards, Dirk

Von: Chris Borrill @.> Gesendet: Samstag, 4. Juni 2022 07:03 An: chrisb2/pi_ina219 @.> Cc: Neethling, Dirk Johan Dr. HOCHTIEF @.>; Comment @.> Betreff: Re: [chrisb2/pi_ina219] Guide until get data of voltage and current ina219 using raspberrypi (#10)

[EXTERNAL EMAIL] DO NOT CLICK links or attachments unless you recognize the sender and know the content is safe. Strange I agree. A couple of questions.

What Raspberry Pi is this? What version of Raspbian is this? If you execute the following what version do you see?

python3 -V

Chris

On Fri, Jun 3, 2022 at 8:33 AM langalibalele @.<mailto:@.>> wrote:

I have re-installed your library several times. No matter which way I call it, I get ModuleNotFoundError: No module named 'INA219'

So frustrating! [image: 2022-06-02-222428_1920x1080_scrot] https://user-images.githubusercontent.com/13710760/171733109-e8a8e15a-c8b2-4a78-968d-77aa6ac467ed.png

— Reply to this email directly, view it on GitHub https://github.com/chrisb2/pi_ina219/issues/10#issuecomment-1145314684, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXR2V75RYX6X2J5TUBQUKTVNELDLANCNFSM4FAC7EMA . You are receiving this because you modified the open/close state.Message ID: @.<mailto:@.>>

— Reply to this email directly, view it on GitHubhttps://github.com/chrisb2/pi_ina219/issues/10#issuecomment-1146536447, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADITLKEHISXWQYF4JM3KOODVNLPQRANCNFSM4FAC7EMA. You are receiving this because you commented.Message ID: @.**@.>>

Please consider the environment before printing this email.

HOCHTIEF Engineering GmbH, Sitz der Gesellschaft: Essen, Registergericht: Essen HRB 25025, USt-IdNR. DE 292 492 308, StNr. 112/5710/2018 Geschäftsführer: Dr. Hansgeorg Balthaus

HOCHTIEF Engineering zum Thema Datenschutz: www.hochtief-engineering.de/datenschutzerklaerung/