Raspberry Pi INA219 Power Measurement Tutorial

  Переглядів 87,415

rdagger68

rdagger68

7 років тому

This tutorial demonstrates how to measure DC power consumption with a Raspberry Pi and an INA219 breakout board. The I2C board is combined with a 16x2 LCD display to track voltage, amps and watts.
All code, schematics, notes, updates and more are available on my website: www.rototron.info/raspberry-pi...

КОМЕНТАРІ: 251
@Impatient_Ape
@Impatient_Ape 4 роки тому
EXCELLENT!!!! Great editing!! Thank you for spending the time to take your raw video and turn it into an efficient tutorial/how-to.
@NavyPanther54
@NavyPanther54 2 роки тому
Extremely detailed, but not too much for someone still new. Also very clear voice, and IMO talking was at a perfect speed, not too slow and not too fast. Well done!
@Maxlr2005
@Maxlr2005 3 роки тому
I'm not doing any raspby project now, but daaaaamn.... best tutorial vid so far!!!!
@terryboyle
@terryboyle Рік тому
Can't thank you enough for such a clear and detailed video. Subscribed!
@laddaren11
@laddaren11 2 роки тому
Excellent tutorial Mr. Ryan Howard
@RaspberryRockOffGridCabin
@RaspberryRockOffGridCabin 5 років тому
Do you know of a device that will measure voltage up to 60V? Thanks in advance.
@rdagger
@rdagger 5 років тому
I don't have any first hand experience but there are probably many options. TI makes the INA169 and LM5056. Linear makes the LTC2945. I'd speak with TI and/or Linear tech support and ask for recommendations.
@jacqueschouteau606
@jacqueschouteau606 5 років тому
Thank you so much. Very good video, explain well. Good quality for the sound, it's nice
@isayprod
@isayprod 7 років тому
I need you to do a lot more videos on raspberry pi ! I am kind of on a project and I have absolutely no idea of how raspberry pi works. Also, I don't have a lot of money (^^) and your video about reuse a dc motor from a hardrive was so helpful ! So your videos help me a lot ! If you can make a tutorial about how we can handle step-motors, it will be perfect ! Also, if you have nothing to do (xD), you could make a tutorial about "emg" and signal processing !! This will be an big pleasure for me to learn that with you ! Thanks for all, love from Belgium !!
@rdagger
@rdagger 7 років тому
Thanks for the positive feedback and the great suggestions!
@replicante1214
@replicante1214 2 роки тому
Hi, does INA219 provide RMS values for both Voltage and Intensity or the instantaneous values?
@dilipkalyan7176
@dilipkalyan7176 4 роки тому
If we r working with picam and raspberry pi, can we still use ina219 to know different values of current and voltage for different images captured by picam? Will there be any difference in current and voltage values for different images captured by picam?
@alipiocarvalho1857
@alipiocarvalho1857 4 роки тому
Very Nice. Is it possible to measure resistances by ohms law calculating?
@jasonkeen7108
@jasonkeen7108 2 роки тому
Want to mod out a ina219 to give stats via i2c to a .96 oled have a zero2goomini with the capability of 28 volt max however cant figure out shunt resistor change for a 7s3p pack of cells that r 3.7 to 4.2v nominal margin each at 2200mA each... can anyone help me with the right shunt resistor by replying with a link ...ty bc I'm gonna use the ina219 to display what the battery pack is at current , voltage and watts. Zero2goomini has 3 inputs capable of 28v max and are common ground on each input was gonna take and bridge that to a 3 way switch and solder one positive from each pad to the remaining 3 legs of switch.
@amoghdabholkar9342
@amoghdabholkar9342 6 років тому
Hey, great video! Can I use this INA 219 to calculate and display [on an LCD screen] the remaining battery of any device?
@rdagger
@rdagger 6 років тому
All batteries have a discharge curve. This non-linear graph shows voltage as a function of capacity. Generally speaking, rechargeable batteries tend to have a consistent curve over their lifespans. Therefore, by monitoring voltage you can get an estimate of battery capacity. You can also track current consumption and generate a running total to calculate an amp-hours value. By combining the two you can get a better estimate. If you are working with LiPo batteries, you can use a low cost MAX17043 I²C battery fuel gauge module.
@zikermu
@zikermu 4 роки тому
Great . It was a pleasure to watch this video with clear explanations .Thanks a lot .
@ryangarethstevens
@ryangarethstevens 5 років тому
Hi @rdagger68 I am trying to measure the voltage and current a small solar cell produces when laying out in the sun using an Arduino and a INA219. The solar cell is not connected to a load as I do not want to measure the current drawn from the load but rather the current that a solar cell produces throughout the day when exposed to various irradiances. How would you go about connecting the INA219? Would I be able to connect the positive and negative of the solar cell directly to the two terminals of the INA219 sensor with no load or is that not recommended?
@rdagger
@rdagger 5 років тому
Generally speaking, you cannot measure current unless there is a load because current is a flow of electrical charge carriers (usually electrons). Connecting an INA219 across the solar panel output as you described would create a short circuit. This is usually undesirable and can damage equipment. However, there is an exception with respect to some solar panels. I recommend you check with your solar vendor before attempting to measure short-circuit current (Isc). So to answer your question, it might be OK to measure Isc which could give you relevant data assuming the Isc and the light-generated current have similar values. Again you would need to verify with the vendor and I would also inquire regarding the impact of long duration tests. I don’t think you would be able to simultaneously measure current and voltage because when you short the solar panel leads you should have zero potential (0V). You also have to be careful when measuring Isc that you don’t exceed the 3.2A maximum of the INA219 breakout board.
@joepublic2454
@joepublic2454 4 роки тому
Love your tutorials, I want to use the INA219 to measure current between 0 and 20ma for a pressure transducer/transmitter running of 12 volts, how accurate is the device at lower currents ?
@rdagger
@rdagger 4 роки тому
According to the first page of the datasheet it is 0.5% accurate over temperature.
@vmdcortes
@vmdcortes 3 роки тому
Great video, thank you so much!!
@leblancexplores
@leblancexplores 8 місяців тому
Can you measure voltage drop with a raspberry pi?
@hafidel740
@hafidel740 7 років тому
thank you very helpful tutorial, it will be great if you make a video with how to controle a stepper motor.
@rdagger
@rdagger 7 років тому
Great suggestion!
@rdagger
@rdagger 7 років тому
I made a stepper motor tutorial: ukposts.info/have/v-deo/hIWTnIaCeYKQqok.html
@hafidel740
@hafidel740 7 років тому
Oh thank you very much, I have to check this!
@ASKeSolutions
@ASKeSolutions 5 років тому
I am working with Raspberry Pi and wanted to check power measurement 1. when only a power switch is on and 2. power measurement when any Line or machine STARTS running? Please guide about what sensor we can use for Heavy Industrial Machines / conveyor lines. Remember we are using Raspberry Pi. Please share your email / mobile to better understanding.
@bouttejean-baptiste762
@bouttejean-baptiste762 2 роки тому
So nice ! Many thanks about this tuts ! Just one thing. You are mentionned the ACS712 for higher current measurement. but it seems to be a little bit different to plug it to the pi. Obviousely it need to be connected thru something like MPC3008 converter. Can you give us more detail how about using it ? Best !
@rdagger
@rdagger 2 роки тому
I haven’t used the ACS712 in a project but you’re right that you would need an ADC like the MCP3008. I have a video on ADC’s: ukposts.info/have/v-deo/r3qYramxhomgsok.html You might also want to ask Allegro Micro and Texas Instruments tech support for recommendations because there are many new current sensors with I2C interfaces: www.allegromicro.com & www.ti.com
@f2uiv1w4
@f2uiv1w4 Рік тому
hi thanks for the video, do u know any piece that can take about 10A 24V for measurement? Thanks
@rdagger
@rdagger Рік тому
You might also want to ask Allegro Micro and Texas Instruments tech support for recommendations because there are many new current sensors with I2C interfaces: www.allegromicro.com & www.ti.com
@sallen135
@sallen135 6 років тому
I have this set up with an LED, using an 18650 as my power supply. I have followed the schematic exactly, and can measure 1.7 Volts across the Shunt Resistor. When I run the code I am getting a voltage of 2.58 (battery is at 4.06V) and an overflow error. Any idea what is going wrong?
@rdagger
@rdagger 6 років тому
Do you have a common ground between the 18650 and the Pi?
@sallen135
@sallen135 6 років тому
Yes a Pi ground, the LED negative, and the 18650 negative are all on the same bread board rail. The positive of the 18650 is in Vin+ on the INA and the positive of the LED is in Vin-. The VCC, GND, SDA and SCL on the INA are all straight to GPIO pins. Is your power supply current regulated in any way?
@rdagger
@rdagger 6 років тому
The wiring sounds good. I was not regulating the current. The voltage drop on the resistor isn't right. That would be a 17A load assuming a 0.1Ω shunt. Did you mean 1.7mV? Approximately, how many mA is your LED? I'd inspect all the solder connections on the board carefully with a magnifying glass.
@goczy2
@goczy2 5 років тому
Very nice video! I'm trying to measure the output of a solar panel so I made the same circuit what you did and replaced the power source with a solar panel. The measurement of the sensor seems to be ok for the voltage but for some reason the current is always zero. Do you have any idea why could this happen?
@rdagger
@rdagger 5 років тому
If the INA219’s shunt is in series with the panel’s positive lead then you would only be able to measure current if there was a load. Many solar charge controllers have serial ports that log real-time data. I have a tutorial on reading data from charge controllers: ukposts.info/have/v-deo/aYaphGlvj6KHpoU.html
@error8641
@error8641 2 роки тому
i am getting around 1 supplyvolt when nothing is connected to the load. can you please explain why?
@TheNikolaschoulakis
@TheNikolaschoulakis 4 роки тому
This is brilliant very well explained but can you please make a similar tutorial for the new version of this board INA260? It would help me a lot as I want to install it on my portable retropie build so I can read the battery voltage level.
@rdagger
@rdagger 4 роки тому
Looks like a great chip with a substantial range improvement. The set up for the INA260 would be very similar to the INA219. The main difference would be software. Instead of the ChrisB2 library, you would probably want to use Adafruit CircuitPython which will run on the Raspberry Pi if you use their Blinka library. I have a tutorial that discusses Blinka and CircuitPython: www.rototron.info/circuitpython-nrf52840-pi-tutorial/
@TheNikolaschoulakis
@TheNikolaschoulakis 4 роки тому
rdagger68 hi but this is precisely my problem the Adafruit INA260 installation guide is very vague when it comes to the first part of installing circuit python. learn.adafruit.com/adafruit-ina260-current-voltage-power-sensor-breakout/python-circuitpython it’s talking about installing circuit python and takes u to another guide then it asks you to install some files at some place at the pi etc... it’s extremely confusing. So a video step by step guide would be great.
@rdagger
@rdagger 4 роки тому
Sorry, it would probably be a long time before I could make your request. Installing CircuitPython is very easy and I do demonstrate the installation process in the link above at 8:37 in the video: ukposts.info/have/v-deo/mqOWpq5sa5B7sYE.html I think the Adafruit tutorial is confusing because it is primarily targeting their boards and not the Raspberry Pi. If you follow the instruction in my video to install Blinka, then theoretically the only other install step should be to pip install the INA260 driver: sudo pip3 install adafruit-circuitpython-ina260
@santiagotesta9720
@santiagotesta9720 2 роки тому
Very clear! Thank you
@shankar.w
@shankar.w 5 років тому
Thanks for such great video. Can we make prototype of smart grid meter with INA219?
@rdagger
@rdagger 5 років тому
The INA219 can only measure up to +26VDC.
@rsyoung01
@rsyoung01 5 років тому
Best on web!
@shrekogreface7411
@shrekogreface7411 3 роки тому
He mentioned daisy chaining INA219s together in the video, is it really as simple as connecting them all to the same GPIO ports via the breadboard or would I need a multiplexer? Could they all use the same power supply from the 3.3V pin? I'm trying to measure and record 4 different circuits at once. Any help would be really appreciated!
@rdagger
@rdagger 3 роки тому
It should be easy connecting 4 INA219 boards. You just need to set the I2C slave address on each board so it's unique. You can have up to 16 boards because there are 16 possible slave addresses. The boards do not require much power so the 3.3V supply pin should be OK.
@shrekogreface7411
@shrekogreface7411 3 роки тому
@@rdagger Thank you so much! I was not expecting such a quick response! Do you have a patreon?
@rdagger
@rdagger 3 роки тому
@@shrekogreface7411 I don't have a patreon. Thanks for inquiring.
@medhammami8850
@medhammami8850 4 роки тому
very good video , is there any other circuits other then the INA219 that can measure high voltage ?
@rdagger
@rdagger 4 роки тому
I don't have any first hand experience but there are probably many options. TI makes the INA169 and LM5056. Linear makes the LTC2945. I'd speak with TI and/or Linear tech support and ask for recommendations. You can also try Allegro MicroSystems: www.allegromicro.com and the Open Energy Monitor forum: community.openenergymonitor.org
@paulwiltjer7515
@paulwiltjer7515 5 років тому
Nice tutorial! I have one problem, get amps reading but not voltage (stays 0,0V). Double checked cabling (ground), but cannot find a problem. Any ideas what it can be? Thanks
@rdagger
@rdagger 5 років тому
Please make sure there is a common ground between the Pi and the source being measured.
@nathanieladams3176
@nathanieladams3176 5 років тому
I’m quite unfamiliar with the ina219. Could you use multiple ina219 boards to measure voltage on individual cells in series in a battery pack?
@rdagger
@rdagger 5 років тому
In theory it would work but you would have to wire the INA219 in series.
@nathanieladams3176
@nathanieladams3176 5 років тому
Thanks for the prompt reply! I guess that would limit me to 26v?
@rdagger
@rdagger 5 років тому
Yes. Furthremore, I don't think this would give you the desired results since the voltage would be cumulative. I'd ask around the RC forums.
@pareshchauhan6127
@pareshchauhan6127 2 роки тому
very good tutorial. I have a question: Hello i am new and doing a project with INA219 sensor with raspberry pi. I have configured and measured the current voltage and power with single sensor. My doubt is that if i want to measure the voltage and current at different points in circuit so should i connect the new sensor at that point or the previous one would work fine. i need help regarding this.
@rdagger
@rdagger 2 роки тому
You can only read 1 spot at a time with a single sensor.
@samhull8028
@samhull8028 4 роки тому
Very clear simple and helpful, thank you, I would like to send the readings to a file to record, would like some help on the additional code. many thanks
@rdagger
@rdagger 4 роки тому
You can use Python logging although that could have adverse effects on your SSD card depending on frequency. I usually log to a Syslog server running on my home NAS or use an online service such as Adafruit IO.
@darrensmiith2560
@darrensmiith2560 4 роки тому
Great videos. Have you thought about doing a video on Time of Flight detectors so that you can measure the distance between devices. DecaWave DWM1001-dev ?
@rdagger
@rdagger 4 роки тому
Thanks. No plans for TOF. I think Andreas Spiess made a few videos.
@janiculmann7546
@janiculmann7546 6 років тому
Hi, you import in the file: ina219.py Adafruit_GPIO.I2C as I2C. Where di you get this library from? I can't find this library and without it, it doesn't work.
@rdagger
@rdagger 6 років тому
When you pip install the ina219 library, the dependencies should also be installed. Did you following the instructions on my website? Are you using the latest version of Raspbian Jessie?
@janiculmann7546
@janiculmann7546 6 років тому
I now what the Problem is. In the LXTerminal it works perfeclty but It doesn't work with Phython3. The error message cames only when I would open it with Python3. I wanted to creat a window to show the current and voltage.
@rdagger
@rdagger 6 років тому
You need to use pip3 to target Python3.
@drjonbear7517
@drjonbear7517 5 років тому
Hey, great vid thanks. I have a question about the resistors used. I don't have those sizes, and wanted to check what would be acceptible as I'm a bit of a noob :-) In place of the 4.7K, would 5.1K be suitable, similarly, I don't have 51 ohm, would Ibe better with 10K or 100K? Thanks.
@rdagger
@rdagger 5 років тому
The resistors used for the LCD display are only to control contrast and brightness. Changing the values will change these levels which should be OK. 4.7K and 5.1K are very close. However, 51 ohm and 10K are not close. 10K stands for 10,000 ohm which is around 200 times larger than 51 ohm. Ideally, you should use potentiometers instead of resistors. This will allow you to fine tune the contrast and brightness. There is an example of using pots with an LCD display in my weather clock tutorial: www.rototron.info/raspberry-pi-international-weather-clock/
@jayeshambulkar9079
@jayeshambulkar9079 3 роки тому
can you tell how to measure the solar radiation using INA219
@colins2005
@colins2005 6 років тому
Great tutorial but I can't get it to work. I am running the example code.With no bus voltage connected and load I get a bus voltage = 1.036 Bus current = 1409.207ma supply voltage = 1.77 shunt voltage 141.210mv power 1452.439 mw . I have had to increase the MAX_EXPECTED_AMPS from 0.2 to 2.0 to get this result or I get a current out of range error. Any help would be great I'm a Pi newbie.
@rdagger
@rdagger 6 років тому
Does the power source being measured share a common ground with the Pi?
@williamscally3984
@williamscally3984 4 роки тому
Great Video. I am trying to measure .050 to .005 mV range. Is this board capable or do you have any suggestions?
@rdagger
@rdagger 4 роки тому
No, the resolution is only 12 bit over 0-26V. I don't know of any hobbyist sensors that will meet your accuracy requirements. I recommend you ask Texas Instruments tech support. They make a lot of other voltage/current sensors.
@williamscally3984
@williamscally3984 4 роки тому
@@rdagger thank you, a friend of mine mentioned that I might be able to use a mosfet do you have any experience working with these?
@rdagger
@rdagger 4 роки тому
DIY high accuracy, stability and linearity can be challenging due to the influences of noise, EMF, temperature, etc. It may also require expensive equipment to calibrate. There are many new high resolution ADC chips available. I recommend you post your question to a metrology forum: www.eevblog.com/forum/metrology/ Be sure to provide a detailed outline of your requirements such as accuracy, sensitivity, resolution, range, are you measuring voltage only or voltage & current, are you measuring DC only or DC & AC and a summary of your project.
@kuban6141
@kuban6141 4 роки тому
Hello, very nice video, thank you! I have a noob question. I want to measure voltage and amps of my 10W solar panel. Could I connect my solar panel directly to INA219? I see you connected the lamp between INA219 and power supply but it is just for test purposes and to test the "power" of your light on specific input voltage, right?
@rdagger
@rdagger 4 роки тому
Not sure what you mean by directly, but you can measure current and voltage of a solar panel assuming you have a load.
@kuban6141
@kuban6141 4 роки тому
@@rdagger that was exactly what I mean, thank you. So I need to find some light bulb and place it between INA219 and solar panel
@rdagger
@rdagger 4 роки тому
@@kuban6141 Place the INA219 between the solar panel positive lead and the bulb positive lead. A better way to monitor solar power is to interface with a charge controller. I have a tutorial on the subject: www.rototron.info/raspberry-pi-solar-serial-rest-api-tutorial/
@kuban6141
@kuban6141 4 роки тому
@@rdagger Thank you very much!
@suranjandey3992
@suranjandey3992 6 років тому
can i measure active and reactive power drawing by heavy load by supplying 220 v??
@rdagger
@rdagger 6 років тому
The INA219 can only measure DC voltage up to 26V.
@suranjandey3992
@suranjandey3992 6 років тому
whta can i use for that?? for a.c
@rdagger
@rdagger 6 років тому
Please consult with an electrical engineer before experimenting with lethal AC voltages. Sorry I’m not aware of any safe hobbyist solutions. You could try the Open Energy Monitor forum: community.openenergymonitor.org/
@sonersoner2074
@sonersoner2074 2 роки тому
Hi everybody. Can I use this circuit with node red ?
@hadirizvi2670
@hadirizvi2670 3 роки тому
Excellent way of teaching? It is possible to show this watt meter informations via hdmi to output monitor?
@rdagger
@rdagger 3 роки тому
Yes, you could use a Python interface such as Tkinter.
@syedyousuf4818
@syedyousuf4818 6 років тому
Hello,its a very good explanation. I have one request that how can we save that voltage readings in sql database.
@rdagger
@rdagger 6 років тому
Database integration is a very involved topic. Generally speaking running a database on the Pi is problematic because of the high number of write cycles to the SD card which has a limited lifespan. Nonetheless, many people have had good luck using SQLite: www.sqlite.org/ It has python bindings and is not as write intensive as MySQL or Redis. Another option is to use an online database. In my RocketChat tutorial I use MLab for database storage from the Pi: ukposts.info/have/v-deo/epWnl6yJg6mSmo0.html MLab offer a free sandbox plan that provides .5GB of data storage: mlab.com/
@syedyousuf4818
@syedyousuf4818 6 років тому
Sir only particular voltage saving in database apart from every repeated voltage,can this be possible,if possible can you please describe the procedure.
@rdagger
@rdagger 6 років тому
It is a complex topic, but basically you would need to do the following: Create a database, create a table with a numeric field to store the voltage readings, in your program you would need to establish a database connection, create a query or cursor object on the connection and then execute an Insert statement to append the voltage data to the table. Here is an example for SQLite: www.sqlitetutorial.net/sqlite-python/insert/
@syedyousuf4818
@syedyousuf4818 6 років тому
Its very helpfull,thank you
@giovanninieddu4885
@giovanninieddu4885 2 роки тому
Good morning, there is also the possibility to create a current generator in the range 4-20ma? I need to control a proportional electrovalve in current with raspberry
@rdagger
@rdagger 2 роки тому
I haven’t tried but you could probably build a voltage controlled current source circuit using an opamp and a MOSFET and then control it using PWM. There are probably many adjustable current source chips that could be controlled using PWM or a digital pot. I recommend you search electronics.stackexchange.com for “adjustable current source mA”.
@TheGogo121212
@TheGogo121212 5 років тому
I was wondering if I could use one of the pictures (The one which shows how to connect the ina to the pi) in this video in a GitHub project that uses the ina219, I found it very informative and simple, would you mind that? I will be sure to give credits and give the source link.
@rdagger
@rdagger 5 років тому
Yes, you can use the photo.
@TheGogo121212
@TheGogo121212 5 років тому
Thanks alot, your content was very helpful btw. @@rdagger
@AJB2K3
@AJB2K3 6 років тому
how could I use these to monitor 6 and 8 AH nicads and would it be possible to add an auto detect and configure for multiple INA's?
@rdagger
@rdagger 6 років тому
You could place an INA219 breakout board inline with a battery to measure the voltage and current draw as long as you are not pulling more the 3.2A. I don't understand what you mean by auto detect. You can have up to 16 INA219 boards connected to a Pi. Each would need a unique I2C address.
@AJB2K3
@AJB2K3 6 років тому
At the moment you have to manually tell the software the address of the device after using i2c to detect the address. How about adding a function that auto-scans address and configures each device. 3.2A? Getting close to the limits of some circuits (one draws 2.8a @3.6v!)
@rdagger
@rdagger 6 років тому
It's possible but you would have to ask ChrisB2 (the creator of the INA219 library): github.com/chrisb2/pi_ina219
@stefanocosentino9481
@stefanocosentino9481 3 роки тому
what about a voltage sensor?
@user-ry8ty2xt9j
@user-ry8ty2xt9j 3 роки тому
hey, thanks for the great guide!! i trying to do this project but icouldn't compile the program on my python ide can you help me please?
@rdagger
@rdagger 3 роки тому
The video is old. See my website for updates. If you're using Python 3 then you may need to use pip3 install instead of pip install. If that doesn't work, please post the error message.
@ScinnerNo1
@ScinnerNo1 4 роки тому
Hi and thx for the video! I have a couple of questions. 1. Do I have to messaure the current to get this to work or can I use it as a pure Volt meter? 2. You said that you can daisy chain them, could I messaure four different voltage sources with four of these? 3. Is it possible to skip the lcd and have the voltage shown on screen in Raspian? Thank you very much!
@rdagger
@rdagger 4 роки тому
1. Yes, you can measure only voltage. 2. Yes. Each board needs a unique I2C address. This breakout board has jumpers for 4 different addresses (0x40, 0x41, 0x44 and 0x45) 3. Yes. The LCD is only for demonstration purposes.
@ScinnerNo1
@ScinnerNo1 4 роки тому
Thx!!!!
@javierpallalorden
@javierpallalorden 4 роки тому
You could use the ina226, it can measure up to 36V and is very accurate.
@synergytech474
@synergytech474 4 роки тому
​@@rdagger Hi and thx for the video! on your response on the point 3, how have the voltage shown in raspbian instead of the LCD screen? please and thank you
@rdagger
@rdagger 4 роки тому
You can use the python print command.
@kyuchumimo
@kyuchumimo 3 роки тому
What would happen if I also connect the LCD via I2C? How would your connection be?
@rdagger
@rdagger 3 роки тому
I have a video on I2C displays: ukposts.info/have/v-deo/oWVyaXeqe4iD2IU.html
@Unknown-rm3ot
@Unknown-rm3ot 5 років тому
Hello, can i use instead relay channel and measure the electric appliance connected to the outlet and outlet to the relay channel? thanks
@rdagger
@rdagger 5 років тому
I don't understand the question, but if you want to measure household appliances then you would need a different solution because the ina219 can only measure up to 26V DC. Try openenergymonitor.org/
@danielsmith7105
@danielsmith7105 6 років тому
great video, thanks
@sigityulianto3599
@sigityulianto3599 5 років тому
How to send a message?
@soyguikai
@soyguikai 3 роки тому
it is possible to use more ina219 with one raspberry to measure different things at the same time?
@rdagger
@rdagger 3 роки тому
You can have up to16 INA219 sensors on an I2C bus. Each INA219 must have a unique address which is set using jumpers A0 and A1. See table 1 of the datasheet for more info.
@justinrussell9734
@justinrussell9734 3 роки тому
Why is it that the load for which amperage is being measured must share the ground with the LCD display and PI? Would it be possible to have the LCD display and PI share a ground, but have that ground be separate of the circuit for which amperage is being measured?
@rdagger
@rdagger 3 роки тому
A common ground is mandatory to measure voltage because it is a relative value. If you only want to measure current you might be able to use an INA219 without a common ground but there could be some accuracy issues.
@mehmetcennetkusu8129
@mehmetcennetkusu8129 5 років тому
could you please. Can you share your first engine circuit diagram?
@rdagger
@rdagger 5 років тому
Sorry I never created a schematic. The drill had a proprietary motor driver IC with no info available. I just removed the trigger slide and replaced it with a potentiometer.
@XenoContact
@XenoContact 5 років тому
Hey I have looked everywhere I can't find a solution, my problem is I want the raspberry pi 3 to be able to measure the voltage going through an externally powered LED, I only have access to the LED's legs, none of the circuit behind it is accessible. Can this be done?
@rdagger
@rdagger 5 років тому
You could measure the voltage at the LED anode. You would connect Vin+ to the anode and leave Vin- disconnected. If you had a second INA219 you could also measure the voltage at the cathode and then you would be able to determine forward voltage drop. There would need to be a common ground between the INA219 and your circuit.
@XenoContact
@XenoContact 5 років тому
Is there absolutely no way to do it just through the LED's legs without connecting its circuit's ground to the INA219/raspberry pi 3 ?
@rdagger
@rdagger 5 років тому
The LED cathode might be at ground. If that's the case you have your ground. However, the cathode could instead be in series with a resistor. The case of the device in question might also be at ground. Generally speaking, you can't measure voltage of a circuit without a ground reference because the definition of voltage is a potential difference. Why do you want to measure the voltage?
@XenoContact
@XenoContact 5 років тому
I have a device which measures power across home appliances and based on the measured values it would turn on some LEDs as to indicate how much I am consuming. I am trying to detect when some of those LEDs are ON/OFF and sending that to a raspberry pi which would in turn send me an email/sms warning. The measuring device is very tightly locked and I prefer not to touch its internal circuits which is why I am left with only the LED legs. I hope there is some way I can achieve this ? Thank you for being helpful !
@XenoContact
@XenoContact 5 років тому
Any idea Please ? I can't find anymore help on this
@kenstovall5091
@kenstovall5091 5 років тому
Will this work for monitoring ac current? Thanks!
@rdagger
@rdagger 5 років тому
No. You can use a hall effect-based sensor such as the Allegro ACS712. Please be careful if working with potentially lethal mains electricity.
@kenstovall5091
@kenstovall5091 5 років тому
Not a problem working with electricity.....im also a lic electrician. :-) Thanks for your help!!
@atharvasaney3897
@atharvasaney3897 4 роки тому
so which device should i use to measure power upto 100 watts and around 30 volts ??
@rdagger
@rdagger 4 роки тому
I have not tried it but Adafruit has an INA169.
@nickddd3953
@nickddd3953 2 роки тому
Is the power rating Watt hours? So that lamp consumes 2watts per hour?
@rdagger
@rdagger 2 роки тому
No. Watts is a measure of power as opposed to watt-hours which is a measure of energy. A 2-watt light bulb will consume electricity at a rate of 2 watts. If you run a 2-watt bulb for one hour, you've used 2 watt-hours.
@mustaphaejjayah520
@mustaphaejjayah520 4 роки тому
is there Tutorial for Raspberry Pi Pycom wipy Power Measurement Tutorial ?
@rdagger
@rdagger 4 роки тому
The author of the pi_ina219 library used in the video also has a MicroPython version: github.com/chrisb2/pyb_ina219 Chris's library is well documented and has sample code.
@happymatekenya394
@happymatekenya394 8 місяців тому
Can I run the same code on a pico?
@rdagger
@rdagger 8 місяців тому
Take a look at my vegetable garden automation video. I connect an ina219 to an esp32: ukposts.info/have/v-deo/sGJibYhsqbCD1Yk.htmlsi=tXsOLa8lNoLr3zWx
@sallen135
@sallen135 6 років тому
How would the wiring go to the INA to measure battery voltage alone with no load?
@rdagger
@rdagger 6 років тому
Connect the positive of your battery to Vin+ on the INA219. Connect the negative of your battery to the INA219 ground.
@sallen135
@sallen135 6 років тому
rdagger68 great, thank you! Also, you said you can daisy chain multiple ina’s. If you wire them all to 3.3 and ground, and all to the same 2 i2c pins, will they all be given different hexadecimal values? If so, how many different ID’s can be used?
@rdagger
@rdagger 6 років тому
You need to set a unique address for each INA219 using pins A0 and/or A1. Table 1 in the datasheet lists the 16 possible combinations. Many of the breakout boards have AO and A1 pads that can easily be jumped with solder to VS+ which gives you 4 easy to set addresses 0x40, 0x41, 0x044 and 0x45.
@sallen135
@sallen135 6 років тому
I have set up this no load configuration with an 18650 battery around 4.09V. I am using the code without an LCD display from www.rototron.info/raspberry-pi-ina219-tutorial/ and am getting the following results: Bus Voltage: 2.57V Current out of range (overflow), for gain 0.32V, device limit reached Do you have any suggestions about what to do next? I am simply trying to get a Pi output with the correct battery voltage.
@ZephodBeeblebrox
@ZephodBeeblebrox Рік тому
I just tried the non LCD code with the Pi Pico and... >>> %Run -c $EDITOR_CONTENT Traceback (most recent call last): File "", line 1, in File "/lib/ina219.py", line 5, in ImportError: no module named 'logging' It seems there's no logging module in Micro Python. I'm still at the moment hunting for a solution.
@rdagger
@rdagger Рік тому
The logging library is part of MicroPython Lib: github.com/micropython/micropython-lib/tree/master/python-stdlib/logging
@yugeshkc9026
@yugeshkc9026 4 роки тому
Can we connect two INA 219 with a Raspberry PI ?
@rdagger
@rdagger 4 роки тому
Yes, see my site for details.
@yugeshkc9026
@yugeshkc9026 4 роки тому
@@rdagger thanks
@bagusrinaldi7596
@bagusrinaldi7596 5 років тому
how about batrey capacity ? did u ever try it ?
@rdagger
@rdagger 5 років тому
I don’t have any tutorials on measuring battery life. You could use an INA219 to determine average current consumption which could be used to derive run-time: Battery capacity (mAh) / Average current consumption (mA) = Hours of expected run-time
@omkarjoshi6252
@omkarjoshi6252 5 років тому
I have one question What if we want to charge battery from the solar panels and measure the power of the solar panels. It would work ?
@rdagger
@rdagger 5 років тому
You can measure the voltage and current coming from a solar panel as long as you do not exceed 26V and 3.2A. However, most solar charge controllers already provide this data. Please check out my solar tutorial: ukposts.info/have/v-deo/aYaphGlvj6KHpoU.html
@omkarjoshi6252
@omkarjoshi6252 5 років тому
@@rdagger I saw your video but my panel output is around 21 volt and 2.5 A max. Actually I am doing college project so I just want to calculate power generation by panel and power consumption by pi. So can I use this method ?
@rdagger
@rdagger 5 років тому
You should be able to use an INA219 to track the voltage and current of a panel. A 2nd INA219 should be able to track the Pi's voltage and current consumption.
@omkarjoshi6252
@omkarjoshi6252 5 років тому
@@rdaggermeans this set will work ?
@rdagger
@rdagger 5 років тому
It depends on your components and the desired goals. A good charge controller would probably provide more meaningful results on its data bus. An INA219 inline with the solar panel should give you accurate voltage levels during the day and show how much current the charge controller is drawing. An INA219 inline with the Pi will show you the Pi's voltage and how much current it is drawing.
@antisocialboy818
@antisocialboy818 3 роки тому
Hi, can I use this to measure a 12V 50AH battery?
@rdagger
@rdagger 3 роки тому
Yes as long as the load doesn’t exceed 3.2 amps.
@antisocialboy818
@antisocialboy818 3 роки тому
Hi, I'm really sorry to bother you but I'm actually tryna measure the amps, volts, and power of a charging 24 volt battery with a RPI that's being charged by a solar panel (I'm building a portable solar charger for my school project). So, if I need to measure amps that's more than 3.2 amps I need to get a lower value resistor for the INA board? Also, you mentioned that another alegro board is suitable for higher amps, If I get that, will the steps in this tutorial be the same? I'm struggling with this and I really need to pull my grades up :( I hope you can help me. Thank you and have a great day
@rdagger
@rdagger 3 роки тому
@@antisocialboy818 The Allegro is just and AC or DC current sensor. It doesn't measure voltage and it produces an analog output as opposed to digital. There are many other sensors that would probably be a better fit such as the INA260: www.adafruit.com/product/4226 You should ask Texas Instruments tech support for a recommendation.
@antisocialboy818
@antisocialboy818 3 роки тому
@@rdagger will do, thank you :)
@colins2005
@colins2005 6 років тому
Yes the GND is connected from the load supply to the Pi. What readings are expected with no connection to the bus terminals?
@rdagger
@rdagger 6 років тому
I don't think it will work if you have the Vin+ and Vin- terminals floating. I'm guessing the voltage readings could be arbitrary. Try connecting a load such as a bulb or an LED and see if the readings are accurate.
@rdagger
@rdagger 6 років тому
There is a post on the Adafruit forum that addresses floating inputs on the INA219: forums.adafruit.com/viewtopic.php?f=19&t=38745&start=15#p192276
@colins2005
@colins2005 6 років тому
Ok so if the load is not connected I could get strange readings. As suggested I have used an LED with 120 ohm resistor supplied from a 3.7 v cell. I get current out of range error when the code runs. I have the max current set to 2A the load is only drawing a few mA.
@rdagger
@rdagger 6 років тому
I just performed a similar test with an LED and it worked. Here's the code I used: from ina219 import INA219, DeviceRangeError from time import sleep SHUNT_OHMS = 0.1 MAX_EXPECTED_AMPS = 2.0 ina = INA219(SHUNT_OHMS, MAX_EXPECTED_AMPS) ina.configure(ina.RANGE_16V) def read_ina219(): try: print('Bus Voltage: {0:0.2f}V'.format(ina.voltage())) print('Bus Current: {0:0.2f}mA'.format(ina.current())) print('Power: {0:0.2f}mW'.format(ina.power())) print('Shunt Voltage: {0:0.2f}mV '.format(ina.shunt_voltage())) except DeviceRangeError as e: # Current out of device range with specified shunt resister print(e) while 1: read_ina219() sleep(1)
@colins2005
@colins2005 6 років тому
Thanks for all your info. Unfortunately I am getting the same problem using your code, current out of range (overflow) for gain 0.32V device limit reached. Also the bus voltage is incorrect measured 3.7v printed value 2.96v.
@ademsaglam814
@ademsaglam814 3 роки тому
How can we transfer this data to the mysql database?
@rdagger
@rdagger 3 роки тому
I have not tried, but you take a look at: github.com/PyMySQL/mysqlclient
@IUMadBroI
@IUMadBroI 7 років тому
Is it possible to use more than one INA219 for the python script?
@rdagger
@rdagger 7 років тому
Yes. Each one needs a unique address. See table 1 in the datasheet for the address pin settings.
@IUMadBroI
@IUMadBroI 7 років тому
@rdagger68 Ah ok thanks! Will the library also work for INA226?
@rdagger
@rdagger 7 років тому
I haven’t tried, but I would guess no. You could submit a feature request to chrisb2. It looks like he has made updates to the library since the video came out.
@DanielDuhon
@DanielDuhon 5 років тому
Is there a way to measure this without buying a separate chip?
@rdagger
@rdagger 5 років тому
You could time the charging of a capacitor with a couple of resistors but it would not be nearly as accurate or reliable.
@hamzamahmood5232
@hamzamahmood5232 5 років тому
Can i use it to measure current in micro amps....
@rdagger
@rdagger 5 років тому
I don't think it would be a good choice because the input bias is probably too high. I'd check with Texas Instruments support. They can recommend an optimal device for your needs.
@hamzamahmood5232
@hamzamahmood5232 5 років тому
@@rdagger can you name
@hamzamahmood5232
@hamzamahmood5232 5 років тому
@@rdagger actually i m working on wood moisture meter and i have to measure serial current though wood. which i consider will be in micro
@rdagger
@rdagger 5 років тому
Dave Jones makes a precision current adapter: www.eevblog.com/projects/ucurrent/
@dillibabu5432
@dillibabu5432 5 років тому
I need to measure three appliance's energy consumption at same time but how, can you please help me with this
@rdagger
@rdagger 5 років тому
Generally speaking, household appliances around the world run on mains electricity which is usually AC between 100V and 240V. The INA219 is DC and only rated for +26V. Therefore, it would not work. Please be careful because mains electricity can be very dangerous.
@dillibabu5432
@dillibabu5432 5 років тому
@@rdagger then how can I measure ac devices sir
@rdagger
@rdagger 5 років тому
Please consult with an electrical engineer before experimenting with lethal AC voltages. Sorry I’m not aware of any safe hobbyist solutions. You could try the Open Energy Monitor forum: community.openenergymonitor.org/
@adamdenton4751
@adamdenton4751 4 роки тому
Any way I could read up to 52ish V?
@rdagger
@rdagger 4 роки тому
I don't have any first hand experience but there are probably many options. TI makes the INA169 and LM5056. Linear makes the LTC2945. I'd speak with TI and/or Linear tech support and ask for recommendations. You can also try Allegro MicroSystems: www.allegromicro.com and the Open Energy Monitor forum: community.openenergymonitor.org
@georgelza
@georgelza 5 років тому
what can i do to measure up to 150V and 40Amp?
@rdagger
@rdagger 5 років тому
Please consult with an electrical engineer or electrician before experimenting with lethal voltages. You could try the Open Energy Monitor forum: community.openenergymonitor.org/
@georgelza
@georgelza 5 років тому
@@rdagger know that, be careful, and also know how dangerous 150V / 100 Amp is... now that the disclaimer is out of the way, anyone help, and no OEM can't at this stage as all their stuff is AC based.
@rdagger
@rdagger 5 років тому
You can try Allegro MicroSystems: www.allegromicro.com/
@mohamadhelmiakmalkamarular2527
@mohamadhelmiakmalkamarular2527 6 років тому
hi. I follow all instruction in ur video and ur page. but I have some problem. some error. can u guide until I get the reading
@rdagger
@rdagger 6 років тому
What is the error message?
@mohamadhelmiakmalkamarular2527
@mohamadhelmiakmalkamarular2527 6 років тому
======================== RESTART: /home/pi/ina219.py ======================== Traceback (most recent call last): File "/home/pi/ina219.py", line 1, in from ina219 import INA219, DeviceRangeError File "/home/pi/ina219.py", line 1, in from ina219 import INA219, DeviceRangeError ImportError: cannot import name INA219 >>> ======================== RESTART: /home/pi/ina219.py ======================== Traceback (most recent call last): File "/home/pi/ina219.py", line 2, in from ina219 import INA219 File "/home/pi/ina219.py", line 2, in from ina219 import INA219 ImportError: cannot import name INA219 >>>
@mohamadhelmiakmalkamarular2527
@mohamadhelmiakmalkamarular2527 6 років тому
this error . can u help me
@rdagger
@rdagger 6 років тому
Are you using auto gain? What voltage and current are you trying to measure?
@mohamadhelmiakmalkamarular2527
@mohamadhelmiakmalkamarular2527 6 років тому
the led . I want measure voltage and current this led. . auto gain ? can u give email to me. I sent pic. help me pls
@SukhadAavrtti
@SukhadAavrtti 7 днів тому
Can we use the same for any different processors with Android os in it ?
@rdagger
@rdagger 7 днів тому
Any board that supports I2C should be compatible assuming you can get a driver for it.
@SukhadAavrtti
@SukhadAavrtti 7 днів тому
@@rdagger ya so I got the driver as well as my pcb supports ina219 but the thing is I am not able get the data from it. Would be great if you could guide me 🙏🏻
@rdagger
@rdagger 6 днів тому
@@SukhadAavrtti What board are you using? What driver are you using? What error message are you getting?
@SukhadAavrtti
@SukhadAavrtti 6 днів тому
@@rdagger custom pcb with cm3566 som
@rdagger
@rdagger 6 днів тому
@@SukhadAavrtti Sorry I don’t have any experience with the CM3566. Generally speaking, I would do the following: 1. Verify your wiring is correct and try to keep the lengths as short as possible. 2. Check with the manufacturer and see if external pull-up resistors are required. 3. Find an Android I2C test utility and see if the address of the INA219 shows up. 4. Find a forum that specializes in Embedded Android Development or Android IOT Development.
@SaeedAhmed-ix8nm
@SaeedAhmed-ix8nm 6 років тому
I want to use a solar panels with output of 90 V. Can you please tell me how I can achieve this?
@rdagger
@rdagger 6 років тому
What do you want to measure?
@SaeedAhmed-ix8nm
@SaeedAhmed-ix8nm 6 років тому
rdagger68 I want to measure the current, and voltage produced by the solar panels.
@rdagger
@rdagger 6 років тому
First when dealing with lethal voltages I strongly recommend that you confer with a qualified electrician. Since you are working with solar, the most efficient approach would be to use a 96V MPPT charge controller with an RS232 or RS485 data output which could easily be polled by a microcontroller or computer such as the Raspberry Pi to provide detailed energy usage. I have a tutorial on the subject: ukposts.info/have/v-deo/aYaphGlvj6KHpoU.html Another option is the Open Energy Monitor project which provides comprehensive open source solutions for monitoring solar power and other energy use: openenergymonitor.org/
@GiovanniAzpeitia17
@GiovanniAzpeitia17 6 років тому
rdagger68 is there a way to measure the voltage produced by the solar panel with the method showed in this video? Instead of measuring the power consumed by the lamp, maybe I can do the same for the panel..
@GiovanniAzpeitia17
@GiovanniAzpeitia17 6 років тому
rdagger68 thank You! Very good tutorial
@mintiwave6956
@mintiwave6956 6 років тому
How to make foot stepper current
@rdagger
@rdagger 6 років тому
I don't understand what you mean by foot stepper. Are you trying to convert mechanical energy to electrical energy and measure the current? Or are you referring to stepper motors?
@omkarjoshi6252
@omkarjoshi6252 6 років тому
It is not working in python 3 versions what should I do ??
@rdagger
@rdagger 6 років тому
What error message are you getting? Did you use pip3 to target python 3?
@dirkschelfhout6460
@dirkschelfhout6460 2 роки тому
my sensor won't read, I tried 2 and I tried to make another bus beside the standard pin's. going nuts. will have to buy from a different supplier. 1 sensor showed it's address 1 time. I found another guy who saw the same, but he didn't get replies or posted a solution.
@rdagger
@rdagger 2 роки тому
Buying from Adafruit is your safest bet.
@dirkschelfhout6460
@dirkschelfhout6460 2 роки тому
@@rdagger I looked and its the same board. the simple version with no extra connectors on the side. I bought 5 on amazon.de think it comes from china as its 2 week delivery. Tested a second on bus at other pins. same result , it sees it 1 time then dies. I toyed with adding 3k3 pull ups and changing the pull up to none etc on the pins. ( not the standard ones ). Nothing wrong with the power or gnd ( 3v3 ). Only thing is that I have nothing connected to measure as I just wanted to check the connection and software. maybe it's a bad batch. I will order some more from a different supplier in germany.
@dirkschelfhout6460
@dirkschelfhout6460 2 роки тому
after testing with some diff pull up's I decided to do a test again on i2c bus 1. Got it working with 10k pull up added to sensor. Will try again later with 5k on bus 2. but happy to get it working.
@hamzamahmood5232
@hamzamahmood5232 5 років тому
ina.current is giving fluctuating values.... i m using DC power supply
@hamzamahmood5232
@hamzamahmood5232 5 років тому
kindly help
@rdagger
@rdagger 5 років тому
Make sure you have the correct voltage and gain settings for your circuit. You can use multiple sampling and 12 bit resolution to improve accuracy. Please check out the Github site for more info: github.com/chrisb2/pi_ina219
@jasonkeen7108
@jasonkeen7108 2 роки тому
Btw it's for a raspberry pi 4
@bactivickarazi6209
@bactivickarazi6209 6 років тому
Hi,I've installed 2017-07-05-raspbian-jessie and trying to update it using apt-get update and apt-get upgrade. The problem is I keep getting the bellow error. I tried all solutions found on google but non worked so I appreciate any helppi@raspberrypi:~ $ sudo apt-get upgradeReading package lists... DoneBuilding dependency treeReading state information... DoneCalculating upgrade... DoneThe following packages will be upgraded:libgcrypt20 libtiff52 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.Need to get 0 B/536 kB of archives.After this operation, 5,120 B of additional diskspace will be used.Do you want to continue? [Y/n]
@rdagger
@rdagger 6 років тому
Maybe I'm too tired but I do not see an error message. I see a prompt to continue.
@bactivickarazi6209
@bactivickarazi6209 6 років тому
rdagger68 Why when I update sudo can not just any posts need additional memory y / n
@bactivickarazi6209
@bactivickarazi6209 6 років тому
Can you speak Indonesian?
@rdagger
@rdagger 6 років тому
Sorry no.
@rdagger
@rdagger 6 років тому
I don't understand. Maybe you have a bad sd card. Did you expand the SD card?
@leblancexplores
@leblancexplores 8 місяців тому
Hall sensors are not reliable!
@addohm
@addohm 2 роки тому
I dont recommend trying to measure 32 amps on that board. Its not built for it at all.
Inductive current measuring using Raspberry Pi
12:54
Matthias random stuff
Переглядів 51 тис.
Raspberry Pi Battery Power
20:34
ExplainingComputers
Переглядів 334 тис.
BMW просто издевается над нами! Силы на исходе…
1:34:41
ИЛЬДАР АВТО-ПОДБОР
Переглядів 3,6 млн
Этого От Него Никто Не Ожидал 😂
00:19
Глеб Рандалайнен
Переглядів 9 млн
How to Run Linux on an ESP32
18:53
element14 presents
Переглядів 143 тис.
INA219 - And Why Libraries And Examples Can Be Confusing
11:36
Simple Electronics
Переглядів 5 тис.
Raspberry Pi Analog Water Sensors ADC Tutorial
19:24
rdagger68
Переглядів 106 тис.
Engineer Explains: Raspberry Pi is FINALLY Dead, Here's Why
11:47
Data Slayer
Переглядів 170 тис.
Raspberry Pi GPIO - Getting Started with gpiozero
48:40
DroneBot Workshop
Переглядів 428 тис.
I Can Save You Money! - Raspberry Pi Alternatives
15:04
Linus Tech Tips
Переглядів 3,2 млн
DIY Home Energy Monitor & CT sensors explained
6:54
Simply Explained
Переглядів 139 тис.
Extracting Firmware from Embedded Devices (SPI NOR Flash) ⚡
18:41
Flashback Team
Переглядів 491 тис.
Home Automation Raspberry Pi Distribution Board DIY | IOT Project 2023
17:59
wyłącznik
0:50
Panele Fotowoltaiczne
Переглядів 853 тис.
Как установить Windows 10/11?
0:56
Construct PC
Переглядів 1,8 млн
Vortex Cannon vs Drone
20:44
Mark Rober
Переглядів 13 млн
Добавления ключа в домофон ДомРу
0:18