10 Minute Arduino Project - INA219 Current Sensor
ฝัง
- เผยแพร่เมื่อ 3 ธ.ค. 2024
- A ten minute look at the INA219 current sensor, hooked up to an Arduino Uno, measuring the current flow from a battery to a bulb. Part of my 18650 current monitoring project.
www.ti.com/lit/...
cdn-learn.adaf...
It's great how your video from 5 years ago can demonstrate just what I needed to see today. I really appreciate this!
You don't need a pro-mini per cell. The INA219 is addressible - you just need to adjust some of those fiddly little SMD resistors on the breakout board to set the address, then one arduino can easily query multiple INA219 chips.
Is true, I have three running on same bus
The adafruit design allows for four. If you want to mess with jumper wires, I think it supports up to 16 per bus.
By using 2 little wires, you can get 16 address from these (see data sheet)
Dont connect the address points, connect a wire to the resistor side and connect the other end of the wire to the header pins.
there is no need to solder any resistor on any other position, just connect the to "adress" pads with a blob of solder
Love this chip. Have had a play on a 12v battery system. Change of shunt and calibration in the registers and some noise filtering are next. Looking forward to your normal elegant description of the complex bits. I don't read data sheets as easily as you always seem to!
I'm addicted!
Prolific this week Julian! - Excellent!
I've been working with these for the last few weeks. Nice approach and I still learned a lot. Missed the multiplier part.
I really like your idea about using these with 18650's and how you plan to piggyback them together.
I always look forward to your videos, but now I'm really looking forward to them. Would you mind also discussing the INA169. This is slightly different and just reports a voltage to an analogue pin. No voltages, no I2c. I've been using this for a 24v solar experiment and assumed it would be like the INA219.
I'm back to using the INA219 and using on for each lead acid battery. So we are on similar paths.
Well done Julian👍 good job
After you tied the ground to the Arduino, your video went back to the Adafruit page rather than the Load Voltage display in the serial window ;-) Still very interesting, I'm working on a similar thing myself.
Tell me about it! (oh you did ;) - yeah, my bad, OBS was set to the wrong source. I suppose I should have re-captured that scene, but I only noticed after I'd packed all the electronics away. I think the verbal commentary says it all. These days, you can't use annotations and end cards in the same video otherwise I would annotate it.
I've used a poll as an annotation - let's see how that works out!
Not bad - I'd have preferred to see the output though.
Me too - my apologies again. I don't often annotate, unlike some youtubers who annotate every mistake, so you have to pause the video to read all the annotations. But to err is human I guess :)
You can use subtitles as well.
nice to see you dont film the screen anymore . very good implementation.
Was just struggling with the connection on one of these. Glan I found your video on the subject. TYVM! 👍
What is the advantage of using the INA219 module instead of a simple voltage divider, current shunt resistor, and the AVR's onboard ADC?
Why do you connect the the negative to the arduino ground? Minute 8:12..thank you
I can't seem to get rid of the 1.04V Bus Voltage (6:01) for the no load (open circuit) condition, even after tying the minus side of the battery to ground (7:43). Has anyone else run into this problem? Cheers.
Do you ever plan on using an stm32 arduino compatible board? They are as cheap as an ordinary arduino nano but have far more processing power. Can be a follow up on your "How fast is Arduino" video.
Cheers
Nicolás Rodriguez I would also like to see something with an stm32
stm32
More power if you can use it - some of the STMs are not covered in the standard library yet and hence i2c slave doesn't work. The cheaper ones are the ones not covered... so the Nano - at £1.50 from China if that, remains my choice for general use now.
i really like the ic but im trying to get a better current range by replacing the resistor with a higher wattage one
Just as a note but the load voltage is calculated in the loop and it just summed shunt voltage and bus voltage. So if the shunt voltage is positive the load voltage will be the higher one.
Which doesn't seem right - surely the load voltage should be slightly less than the supply voltage.
Julian Ilett To be honest I don't really know but it sounds sensible.
If the current is shown as negative when you swap the two wires, the load voltage is just the voltage on Vin+.
I used an INA219 in my first solar charge controller. Worked nicely for months - then failed during a storm. Rather badly, because it failed in a way that gave false readings, alternating at random between 0V and full-scale voltage. Which my solar charge controller interpreted as meaning 'cram in power until the battery boils.'
My guess is that during the storm the solar panels picked up some high voltage from the atmosphere that the INA219 didn't like. I've built a controller now, without INA219. Just good old shunts and op-amps.
Hi Julian I am trying to find a video, I think you were using a rotary encoder and was attached to a binary counter and it was incrementing 8 LED's? I have been looking through videos trying to find this, any ideas?
Was it 9Xm05_2AD8E ?
possibly, ill have a look in a while. thanks for the reply
if you connect a relay you Will have the same results using the same GND?
That's this clay @2:23 like thing is called that you used to hold the board?
Looks like it could be useful for a battery level indicator :) Monitor voltage and current. You could even plot charge/discharge curves.
Ummmm...this chip has polarity...In other words we need to check if you are charging a battery... can it displays the negative current properly?....It certainly measure the discharge part...or the positive current!!
@@tonymac96 Do you know any chip that can show both charge and discharge?
Welllll...guess what?..the Ina219 does that...if the current goes through the ina219 to say a resistor for discharge, the current will be positive, however if the current goes into the battery the ina219 will show the current with a negative sign. I have used the ina219 in a setup for charging discharging a home made battery of appro. 1.5 volts and 600 mWh. It works perfect!!!
@@tonymac96Thanks, I will look into them. With so many different types of ICs, it's overwhelming to pick the right one.
Yep...the ina219 works perfect...for low current measurements such no more than 3 A....it definitely measure tiny current such as 5 mA...with no problem. It is bidirectional.
i sometimes use plasticine to hold boards while soldering, i didnt know others did something similar, though you seem to use some sort of gray mastic. plasticine tends to dirty the board but not too much
I did a project very similar to this last month. I used 3 INA219s and additional ADC to monitor power of a small solar led lamp project I've been working on. There's an INA219 on the battery, one on the solar input, and one on the output. I added the ADC module later with a precision 0.1ohm resistor for sense as an extra amp measurement because I found that the INA219 is really noisy at small measurements. As seen in this video, it can't reliably sense no current. From that I've seen, the only means to mitigate this is to use some kind of RMS averaging of many readings from the INA219 (like around 1000 per desired sample period).
I used all 3 INA219s and a single larger oled on one arduino nano. I can fit volts, power and watthours for all 3 and an extra line for the ADC on the single oled. Using a nano and oled per INA219 would be overkill. Just solder different address jumpers on the other 2 and setup 3 ina219 objects for each in your sketch.
If there is interest, I can polish up mine power monitor code a push it to github.
Hi can i see your project.. because it quite same with my project.. however im having a problem..mind if you give me the connection. For your project?
@@zamriimran72257 years ago... If I had any idea where any of the project files were now or could remember much about it, I would. xD
@@tad2021 is there any other way i can contact you..i have some issue ,maybe you can help me
@@zamriimran7225 I haven't worked on anything like this in half a decade. Adafruit has documentation and code for the INA219. If I remember right, I based mine off theirs from the time but with averaging I likely ported from some other current monitoring code I found.
Julian, you showed us the PDF when you were talking about the correct bus voltage :o!
Excellent! I'm trying to measure the current using an INA 219, but I'm using a PWM board, as I need to dim an LED strip, but I'm not having success, even connecting the GND of my NANO to the PWM board's power input (-). Any tips?
Hi Julian,
a few months I am trying to build 3 phase 50 + 50+ 50 amps MPPT.
It is BUCK topology 200 V IN / 100 V OUT / 12 - 24 - 36 - 48 - 72 V / batt
but I have serious problems to monitor precisely
50 amps current per phase, I made BUCK with
AMPLOC 100 A, then ACS758BI 50 A,
but measurement with some filtering is not precise,
with precision, that I need to calculate P @ O and INCREMENTAL COND. algos.
Do you think, that som INA219, INA228, INA229 would be better ?
Or there be similar problem with noise / from FETs switching /.
Julian at 8:22 we can't see the serial monitor :(
Apologies - I've annotated it :)
HW1099 so agree, impossible to read serial monitor. Is this compliant with requirements of the dda (disability discrimination act)?
Can it measure reverse or negative direction current ? Connected in series with battery, battery charging should show + and discharging shows - ve.
Julian, why do you never make the programs for interfacing with these devices? It's half the fun!
You should try the Allegro ACS7 series devices instead of using a current shunt, the use a hall sensor which gives a proportional voltage to the current through the pins on the chip. There is no series loss as they don’t use a current shunt.
Interesting work!!! ...Julian, if instead of draining the battery, you decide to charge the battery, will the current be displayed with a negative value ? ...There is indication in the literature that the GY-219 INA219 is bidirectional. I'm not sure if the INA219 is the same. At the beginning of your video I saw negative current prior the connection of the light bulb...maybe is bidirectional. Let me know. Thanks.
Yes, I'm pretty sure the INA219 is bi-directional. Yes, data sheet confirms this (right at the top) www.ti.com/lit/ds/symlink/ina219.pdf
Hi! It will work if instead of a battery I will use a microgenerator with an output voltage varying between 0 -15 volts?
so, the current sensor could be useful to protect by overloading a blocked motor ?
It would help if you included in your video which ports on the arduino uno are scl, sda.
A DIY bench DMM project would be really interesting. :D
What is that blue stuff you are using to hold module during soldering? Nice one :)
Found this old video and watched it (again). And as I was I wondered if you’d ever considered any videos on “home automation” ?
I can easily see some combination of PIC or Arduino with various sensors and motors etc
One idea was to automate your 30w garden solar LED and fix it to a base that could rotate to follow the sun. Both turning around and changing the 30 degree pitch. I’m sure there’s some web resource out there with an API where your postcode could look up to provide details of the location of the sun for a given hour of the day and day of the year.
Just a thought. Graham
Dumb question: would there be a way to modify this module to go up to 50V and 70A with an external shunt resistor? I think the external shunt resistor could take care of the amps, but the elevated voltage? Maybe if you never used the onboard voltage measurement by connecting the ground?
Great video Julian. I was wondering, have you ever considered doing a bigger arduino project, similar to the vocoder project in scale, such as a quad copter or a keyboard? Also have you ever designed your own PCBs?
Awesome video!
I am trying to make an ammeter to monitor battery voltage draw on my motorcycle. Would this set up work for that? How would you go about making one on oled?
Hello Sir. Is the module applicable also to detect current at low side of the voltage? So that it can be applicable over 500V?
What if my load is the Arduino itself? I need to measure the arduino's current with a bmp180 barometer when is being fed by a 9v battery.
Thanks!
What's that blue putty-like stuff you hold the board with when you solder?
Be careful with them quick connects - I bought some off eBay that look similar to the ones you've got, and they were rated for 5 amps... I put 1.5 amps through them and it got that hot, the white plastic melted.
I wanted to hook something like this into a rpi but there was limited tutorials at the time
what is means by bus voltage actually?. in the formula for the measuring Is for ina169.. we need a Vout and the Vout is connected with RL load.. what Vout is indicated for actually?and how do we know the value of Vout?.Please reply me.. thank you.
Great video...what's that he use as a pcb holder?
I'm happy this video was shorter. I haven't been watching your long videos (too long!) and, when I do, I speed up to even until 1.5x. It's the only way. (Also using a lot the "L" key of my keyboard).
It would be nice if you could summarize more your content.
I leave this comment as a suggestion, because this used to be one of my favorite YT channels to learn things, when videos were shorter and direct to the subject.
Thank you for reading! Have a good day :)
Telmo Monteiro ....really, you have that short attention span? ILove the long videos, something to get ones teeth into. one should be greatful that Julian gives his time and knowledge to us all for free and one have humility not to critizise the prof.
Private Use You seem offended. No reason for that. It's just that it looks that I don't have as much free time as you do, and I'm not like you. Is that OK right?
You don't need to judge me like that. Calm down strange person. Longer videos give him also more money trough TH-cam, so I also can see why he would prefer that. But maybe he could lose more than he gets if there's more people like me. And that's the base of my comment. Maybe he is not aware that some people look at the length of the video and say "no, not gonna see it...".
Have a good day.
Julian, what's the benefit of flashing the nano with the Uno bootloader? or was it just you testing if you could?
1.5k of extra memory and faster upload times :)
What happens if power supply(more 5A) connect to the Ina219?
I have tested on battery 9v without bulb and the load voltage is 0.9v. it is suppose to get 9v?
Whats the difference between a Nano and a Nano with Uno bootloader? Isn't it all the same 326P?
Klonkiller361 I think the onky difference is the size of the bootloader.
the size of the arduino uno bootloader is indeed smaller and it also uploads quicker.
What is the minimum current it can reliably detect? What is the % accuracy? Does it match the datasheet?
Nice, Thanks.
I use the INA219.h library by John De Cristofaro 2012 and it supports a function busPower() to get watts.
Would you tell me where can i use it for something else
I use it before for sense curent fire detector and make alarm
Forgive my ignorance - is there a benefit to running the uno bootloader on a nano? video?
Julian's Ardutorials: Turn an Arduino Nano into an Uno th-cam.com/video/bpXUvRr2ywA/w-d-xo.html
thanks!
what is the minimum value of current can measure using INA219
Thanks for the trick with the Bluetack, ta!
Does anyone know how I can use the INA to measure the voltage of a charging capacitor? I have a very simple RC circuit that consists of power going to a 2.2mF capacitor then to a 10k resistor going to ground. It doesn't matter how I arrange the circuit or where I place the voltage probe, it either displays the Vcc or the gnd voltage, so I can't see the capacitor charge being detected. Is there anything I should add or something I need to add to the code?
hi, @Julian Ilett awesome tutorial, can i use it to measure ac current/voltage?
I also put the Arduino Uno bootloader in my arduino nano but I can't get the old bootloader back in to it. Do you know a way to do that without buying an USPtinyISP or another Nano?
You do need a programmer to change the bootloader
I heard that you can make a USBtinyISP from an ATtiny85, can you do a tutorial on that?
try using another arduino as programmer. you may search google for connection details.
iceberg789 the other arduino wil have its bootloader in it thats not the nano's one so i'm guessing it won't work
the other arduino working as bootlead programmer, does not load it's own bootleader into the target chip. you may choose to load another boot leader. you may choose to load optiboot in it, which is more space saving.
you may also want to make your own usb asp using an atmega8. anyways, whatever you do, you will need to study the process a bit.
How to calibrate the INA219 sensor?
Can't see the results after connecting gnds as the pdf is on screen.
What is that PCB holder gum (Silver mass) real name is I may to ask?! ;)
Blu Tack
What is the red board that you are connected to?
Just an FYI, Adafruit also has code for the module and an OLED github.com/adafruit/Pro_Trinket_Power_Meter/blob/master/Pro_Trinket_Power_Meter/Pro_Trinket_Power_Meter.ino
That one doesn't do anything to mitigate the jittery noise of the INA219.
Don't think about the screen capture thing. I trust ya so I'll take your word for it. No worries. 😉
The measure you are talking about is missing in the video!
Annotation added
Dear Julian ! You should not use a pencil to point to things on a pcb, as Graphene on a pcb produces conductive shorts, which are almost impossible to find.
Hi Julian,
Thanks for all the great videos!
I have a question
about the R100 precision sense resistor, I believe it's the "big one".
SMD terminology for resistance leads me to believe that R100 is 0.1 ohm
and R010 would be the 0.01 ohm that Adafruit alludes to for a 32 amp
range. If this is correct than it's size would indicate that it has a 1
watt power rating (a 2512 package.) If both are correct I'll order
some resistors.
These are great units but the u8g2 blows my old socks off!!! You and Olie make me smile!!!
Thanks again!
Nick
8:14 Screencapture fail :D
Lol, we have similar taste, ordered one of these a while back!
I think it'll look awesome when current is displayed on that little OLED :)
Yes, something about those small Displays make them attractive. :-) I'm using one for a current Display that i'm working on too right now. When i have my Project finished maybe you could present it. I'm sure that every Viewer here would like to have it could use it.
Blu-Tack.
Why have I never thought of this?!
Hi Julian please make a video with Arduino uno + current sensor + ethernet shield and data from sensor upload to internet.
He also has an Arduino Yún that has ethernet and wifi capability integrated i think.
I've got some ideas similar to that ;)
Julian Ilett If you intend to upload data to the internet, I suggest you use esp8266 instead of ethernet shield or Yun.
And throw some MQTT in for good measure! In fact, why not use a load of NRF tranceivers to broadcast to a central node which then manages the MQTT message sending........
Mine let out the magic smoke! :(
Not sure what went wrong, but it got very hot and the little chip desoldered itself. :(
e2e.ti.com/support/amplifiers/f/14/p/405749/1437908
Board: I2C / TWI pins
Uno, Ethernet A4 (SDA), A5 (SCL)
Mega2560 20 (SDA), 21 (SCL)
Leonardo 2 (SDA), 3 (SCL)
Due 20 (SDA), 21 (SCL), SDA1, SCL1
I would have thought Kirchoff's current law would make 3 current sensors on 3 batteries connected in series unnecessary.. Of course using just the voltage readings makes 3 sensors worth it, unless you use resistive divider networks to have the arduino do the voltage readings itself..
Sorry, I should have explained that these cells will be connected in parallel :)
Darth Vader Dammit, I was about to post saying it was either God or Ampère who decreed that! You beat me and got the attribution right to boot. Looks like Julian is still paying more attention to charge balancing than most major manufacturers bother to do. Bravo!
Oh Lord
Just got one INA219 from eBay today. Is this coincidence or am I investing tonight's 10 minutes on this project.
oooooh! This video has a blue sponge with a lightning bolt!
Jullian looks in hurry today. he din't mention the cleaning sponge he used for the soldering iron. :/
he also did the wrong screen capture :(
OBS slip up - my bad. I hope the verbal commentary is sufficient for that shot.
GREAT VIDEO PLEAS KEEP IT UP!! NEWBIE!!! Will subscribe thanks! I Rembrandt Mr novack! Smart guy!!
screen capture looks better
Also i use 2 ina219 parallel without any pull up resistor
For i2c port🤭
Might I suggest another playlist ? MEASUREMENT TESTERS AND SENSORS or something like that. Could have any video with any little Chinese meter, the dso scope, current stuff like this, lots of possibilities, even the little part tester circuits from china, there are two of them I think that you've spoken of..
What's the thing about the sponges? I dont get it
Sure "just audio commentary" we need to see the correct readings else it never happened - admit it, you killed your uno/nano and let the magic smoke out didn't you? :)
Why are you spending your time answering the same comment repeatedly? Go back to work ;)