10 Minute Arduino Project - INA219 Current Sensor

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
good morning all today I'm going to play with the INAT 1/9 current sensor well it's a voltage and current sensor and it can even report power I believe so I've got two INAT one nine boards here this one's kind of modeled on the original Adafruit board this one's been slightly altered it's a bit smaller but it uses a larger terminal block and the interface is I squared C so VCC ground SCL and SDA and all I'm going to do today is get one of these or perhaps both of them hooked up to an Arduino I'm going to use this uno nano it's a nano with an you know bootloader so it behaves as and you know I've got a piece of wire here with a battery connector and a little bulb in one of these connector blocks so I'm going to use that just to put a small current through the sensor and see if we can get some readings coming out on arduino x' serial monitor so the first thing i need to do is solder the six pin header on here that's four pins for I squared C and 2 which are duplicates of V in minus and V in Plus which are the large connectors for the current to flow through so while the soldering iron is warming up let's take a quick look at this datasheet this one is Texas Instruments I'm not sure whether there are other manufacturers making this chip it's but it's the INAT one nine zero drift bi-directional current power monitor with I squared C interface it can also sense bus voltages from zero to twenty six volts now I don't know whether you have to link ground on the current sense part of the chip to ground on the digital side not sure we can check that out so it also reports current voltage and power I think there's an on-chip multiplier to calculate power or you've got different I squared C addresses high-accuracy filtering options and so on now I've also found this Adafruit I na to 1/9 current sensor breakout instruction booklet I suppose which is this ball very similar to one of the ones I've gotten in here there's just lots of useful information to guide us through this process so just so during the six pin header to the blue board and then I'll put the terminal blocks in and then do the same again with that purple board might as well check that they're both working right now I need to connect this board to the uno I need VCC ground SCL and SDA now they don't quite line up in the same sequence so I have to swap a few of these wires around on this four pin DuPont cable yes this one goes ground VCC SDA SEL this one goes VCC ground SEL SDA so that's two swaps I think so now I've cut a break in the positive side of my power supply and load which is that bulb and I'm going to put both those positive leads through the sense resistor I'm going to put the power supply the battery on the plus and the load on V minus and then we should get positive current numbers coming out of the Arduino but for the moment I'm not going to reference the negative side of my well high current you could call it circuit to ground on the Arduino because I'm just interested to see what happens if there's no connection is there a connection internally in the chip or do I need to put an external connection from this ground or this negative side to ground on the Arduino we'll find out so in Arduino I want to go to file examples come all the way down and there we've got Adafruit i na two one nine and there's only one example it's get current so let's open that maximize that and what it should work pretty much as is I think I think the default I squared C address is is hexadecimal 40 and I haven't changed the linking on the board so that should all work so let's just have a quick look in here we've got wire for the I squared C we've got Adafruit I na 2 1 9 those are included here's our constructor call to create an object called I na 2 1 9 serial begin at 115 200 so I'm going to remember it's the fast board rate a few welcome messages and then in the loop it pulls out the shunt voltage the bus voltage the current and the load voltage and then just prints them all back down the serial monitor let's compile that install it and see if it works right that's compiled it seems to be ok so let's open the serial monitor bring that up here now we need baud rate 115 200 and at the moment nothing's coming up why is that then yeah I think that was just me I think actually I just did a compile I didn't actually do it uploads so let's do an actual compile and upload this time and see what we get and yes we're getting serial data now coming back the current is showing as either minus 0.2 milliamps zero milliamps or positive a tiny amount of milliamps let me just connect that battery to the bowl and see whether the current values change yes ok so the bulbs on and we're now getting 86 milliamps is that about right yes I think that's right because this bulb is marked as 0.1 amps at 100 milliamps at 12 volts now I'm running it at a bit less than that 9 volts or maybe even a bit less than that so yeah 86 milliamps would be about right now when what we're not getting here is the bus voltage or at least it's showing up as 1.04 volts the load voltage is also showing as about a volt I think the shunt voltage is probably right 8 point 4 or 8 point 5 millivolts and then that's converted into a current looks like it's just multiplied by 10 to get milliamps now we're not going to get this bus voltage unless I think unless we ground the minus side of the high current circuit to ground on the Arduino so I'll do that next right so I've slightly rearranged this and I put a little wire in here so I can poke on one of these DuPont connectors and then I think this has to go to ground on the Arduino but I'm just gonna check this on a de fruits little information booklet yes this appears to be what it is you've got the Arduino connected to the I squared C pins on the current sensor and then the V n + + v + - going to your circuit through which current flows and then they've got this black wire this ground line going from - in the circuit to ground on the Arduino and of course on the sensor so yeah I think that's right so these black connectors here are all ground so I can connect this to any one of those so now the Arduino is measuring the voltage well I'll certainly on the battery and also the voltage on the other side with respect to this ground line let's see what difference that makes to the reported data and yes we're getting a bus voltage of 8.9 volts a load voltage of 8.9 volts now there is going to be a difference between those two entities the shunt voltage but that's only eight point eight million volts so it's not really enough to see a major difference between these two the low-voltage should actually be lower than the bus voltage I think I think it should be that way around yeah current is being reported as 88 milliamps and we've now got something akin to 9 volts being reported on voltage now I don't quite know how you get the power reading out of this sensor yeah I don't think the Adafruit library supports pulling the multiplied value for power out of this sensor but I mean it's a relatively easy thing to just multiply the reported voltage by the reported current and generate your own power data right well that's all I wanted to do today next time I'm going to add in this little OLED it's a 128 by 32 OLED so that we can have the current that's being drawn through this sensor actually displayed on here and I just want to say a big thanks to Jeremy who gave me these little connectors when I visited Malta and this was about a year ago a very very hospitable chat extremely generous took us to lunch and all that sort of stuff so massive thanks to Jeremy these connectors are extremely useful with the little spring-loaded connectors it was Jeremy also that gave me the flux pen and a load of other stuff besides so thanks so much to Jeremy now the eventual aim of this project is of course to measure the current flowing in and out of 18 650 cells so they'll sit in this cell holder and then what I'll do is assemble the current sensor with an Arduino Pro Mini sandwiched with the OLED somehow managed to stack all those boards together and have one of these per cell so we can watch the current on all of these cells flowing in flowing out and flowing between cells as well but that's at the moment some more videos up here to entertain you and if you want to subscribe to this channel that's down here cheerio
Info
Channel: Julian Ilett
Views: 109,441
Rating: undefined out of 5
Keywords: electronics, Uno, Nano, voltage, current, power, battery, bulb, I2C, IIC
Id: PZ7imiIIf_k
Channel Id: undefined
Length: 10min 41sec (641 seconds)
Published: Wed Mar 01 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.