Adafruit INA260 Arduino Tutorial with LCD | Precision Voltage & Current Measurement up to 15Amps

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so today's video is going to be a step-by-step tutorial on how to use the Ina 260 DC power and current monitor from Ada fruit with an Arduino and an LCD display this video will provide you with everything you need to know on how to use this from installing the libraries to modifying the code to meet your specific needs to how to measure a load and finally to top it all off how to Output the data to an LCD display so the Ina 260 is a Precision DC current and power monitor and to a certain extent it's also a voltmeter which can measure up to 36 volts and 15 amps continuous and as if that wasn't crazy enough it can do all of that with an insane level of precision making this perfect for high power projects that require power monitoring or even when building something as simple as a watt meter getting started with the Ina 260 is so easy because everything is already calibrated and all of the communications are done over i2c so you don't even need that many wires to get it started and this is honestly one of the most useful devices I have gotten for Arduino because you have no idea how much time I would spend trying to get these stupid voltage sensors to work with their analog reads and their resistor dividers little did I know how easy it was to take measurements using these new devices so let me show you how to set it up fast so all you need to get started are six jumper cables one Ina 260 board an ardino UNO Mega or Nano and of course a breadboard and if you're going to be measuring things over 2 amps it helps to have a little flathead screwdriver so that you can undo the little headers here and put in the wires so that you're not sending all of that current through your breadboard and lastly if this is going to be used with a battery it's highly suggested to have some sort of fuse in place now this has a maximum current rating of 15 amps and 15 amp fuses are the only ones I have on hand right now but I would personally go with maybe like 10 12 amp fuses because the ion 8260 this specific one from Adafruit is anywhere from $15 to $20 per piece so you really don't want to ruin that thing so before getting into the wiring first we need to install the library so this Library should be compatible with most ardino boards like the mega Nano and the Uno in this case I'm using the Uno R3 so with one side of the programming cable plugged into a USB port plugging in the board so that we can upload the sketch before getting to wiring the ina260 so to install the library it is quite easy opening up the uino IDE and simply going on the books icon for Library manager and just typing in in n260 the first result should be the Adafruit ina260 Library so just hitting install on that and saying install all for the dependencies it should install in just a few seconds however just to make things easier for later in the video you might as well want to install the Liquid Crystal i2c Library as well so to install that one all you want to do is type in liquid Crystal space i2c and this very first result that comes up is the one that you want so clicking install everything is now set up for the Ina 260 and the i2c LCD display I always prefer to upload a sketch before wiring up the module so to open up the ina260 sketch for the examples you want to go into the file examples all the way to the right at the top the Ada fruit ina260 library and then clicking on ina260 test this will open up a new tab with a relatively small program so now it's time to plug in the ardino board so we can upload this code so with the board now plugged into a USB port the only step is to make sure that the correct board is selected so in my case the Arduino Uno board is already selected and lastly making sure that the port is also the correct port for the board so in this case it is also correct so simply clicking on this drop down and clicking arino Uno so with all of that in place just hitting upload and just like any other program it's going to compile and upload to the board with the program now uploaded it is now time to wire up the module so with the sketch now uploaded to the board just unplugging it from the power so the breadboard I am using here already has something on it but that's not going to be a problem I just don't want to ruin what's already on here so I will be using this entire blank area on this side so the pins that we're going to be wiring ing up are going to be VCC ground SDA we're going to skip the alert pin and VN plus and V and minus are also the same ones the same connections on the header pins here so in this case I will be connecting to the header pins and not using the VN minus VN plus pins that go into the breadboard so just simply inserting the board in a free space and the breadboard so with the device now inserted into the breadboard it's time to get an overhead view and start wiring up the connections so the way the pins are labeled they alternate up and down so VCC ground SCA alert vbus VN plus VN minus so to make this easier to follow I will put the text on screen to make it easier to follow so pin one is VCC pin two is ground pin three is pin four is SDA pin five alert pin six vbus pin 7 VN plus and pin 8 VN minus so wiring up this board is very straightforward pin one VCC is going to go to 5 volts on the ardino next the second pin pin two ground is going to go to ground on the Arduino as well and pin three and four and SDA are going to go into the corresponding and SDA pins on the Arduino so pin number three is and this will go into the corresponding pin on the Arduino the pin right beside that PIN number four is SDA which like the one before it is also going to go on SDA on the Arduino like that so pin five and six alert and vbus are going to be skipped and VN plus and VN minus while you can connect to them here on the actual breadboard you can also connect to them via these header pins which will give you full access to the 15 amp continuous current sensing ability of this board so for that reason I will not install it on the breadboard and I will instead use a small screwdriver to insert the breadboard wires into the header pins so looking at the board from the top the one on the left is VN minus and the one on the right is VN plus so I will be inserting a yellow lead into the VN Plus Port and then gently tightening it over the pin next doing the same for V and minus with a green wire so with the VN plus and VN minus cables connected it's now time to plug in the Arduino and see what we get so simply just reinserting the programming cable from before and now let's take a look at the serial monitor so going back into the Arduino IDE here and then opening up the serial monitor now you'll notice random characters coming up that's because you need to switch the B rate to I think it was 115200 and now it should start giving some readings and after doing that you will then notice that it's giving basically blank readings because there is nothing going through the system so these little negative numbers here are completely normal and the zero bust voltage zero power that is expected so now that we know it works I will now demonstrate how to properly connect a load to the Ina 260 to get a proper measurement out of this so to test it out I'll be using this Bluetooth module it's a Bluetooth audio receiver with this small 300 Mah lithium ion battery I have this tiny battery holder that can fit inside of the breadboard so I will Begin by inserting the battery holder into the breadboard next just for safety placing a 5 amp resettable PTC fuse on one of the battery terminals so here is how to properly wire up a load to this Ina 260 so for this example I am using a low power Bluetooth audio receiver module and it has a positive and negative input here and remembering from before the VN plus was the yellow wire and VN minus was the green wire so the first connection is going to be VN plus and that is going to go to the positive of the power supply or in this case the battery so the positive is connected to the PTC resetable fuse here next I will take the load which in this case is the Bluetooth audio receiver and then connect the positive input of that to the VN minus so the positive from the battery is going into VN plus coming out of VN minus after being measured by the device and then going to feed the load so putting the positive of the load into the positive rail of the breadboard and then taking that VN minus the green wire and also putting that into the positive rail of the breadboard now in this case there is nothing else connected in the positive rail because just like in an a meter you do not want to connect this directly to a power source you always want to power it through the load so now with the negative of the load of the Bluetooth audio module we can either put that in the negative of the Arduino the ground or to make it simpler because the battery also has a negative we're going to put it in the negative rail of the breadboard because even if the voltage of the power source or the power supply is higher than 5 volts you still want it to have a common ground with the ardino so with this brown wire connected to the negative pin of this battery holder I'm going to also put that in the negative rail of the breadboard again keeping in mind these are completely unoccupied rails and now for the final connection putting a wire into the negative rail of the bread board and putting that into the ground pin of the Arduino so connecting the negative of both the power source so in this case the battery and the negative of the load to the ground pin of the ardino so as everything wired up it's time to insert the battery and take a look at the serial monitor so we can see the Bluetooth module is turning on so let's go and take a look at the serial monitor so we turning to the ardino IDE and taking a look at that same serial monitor we can see the readings are now coming through so the current is being provided in milliamp units the bust voltage in Mill volts and Power in mowatt so the bust voltage I want to make that in volts not in Mill volts because it's a lithium ion battery and that's 3.66 Vols here so let's change that in the code here so going right over to the ina260 read bust voltage because 1 m M volt is 1 1,000th of a volt we can just go right after this command here after the serial print reust voltage and just do a divided by 1,000 now we can re-upload that and it should be giving it in volts I should have changed this also to just the letter V so let's do that real quick you can see it's giving 3.66 but it should be saying V for volt not MV for molt so reuploading and it should be in volts now 3.66 volts so let's compare this with the multimeter now and see how close it is so with the multimeter in volt mode and two jumper cables connected to the alligator clips let's connect it and see how it compares to the output of the serial monitor so connecting the positive of the multimeter to the positive Rail and the negative to the negative rail making sure to keep the two leads separated and 3672 let's see how that compares to the readout on the serial monitor so the multimeter was reading out 3672 volts and over here it is reading out 3.66 volts now I want to increase that to three decimal points instead of two for a little bit more accuracy so just going right after this 1,00 here and putting a comma three and reuploading now it should give three decimal places for the voltage so 3.66 1 volts and the multimeter off screen is still reading 3672 Vols so in this case it is difficult to tell which one is correct so I will just assume that the Ina 260 is more correct so with the readout here reading about 3.66 2 and the multimeter reading 3.67 2 it is almost exactly a 10 molt difference between the multimeter and the readout on the serial Monitor and the fluctuations that are happening in the milliamps here are simply from the Bluetooth module searching for a Bluetooth connection this has nothing to do with the actual module itself so now that the essentials of how this board works and how to work with it have been covered I will finish the video by connecting an LCD display with code that I have modified from the code here to read out to the LCD display and I will include that in the description of the video as well as switching from this tiny little 5 milliamp load to a 65 watt heating element and just opening a new tab in the ardino IDE I will now copy and paste the code that I modified so what this does is basically not only does it read out to the LCD display but it also has like selective units so for example if the amount of current is below 1 amp of current it will present it in milliamp units but if it's above 1 amp of current then it's going to present it in amp units and then for the voltage if the bus voltage is below 99 molts it will present it in Mill volts however if it is above or equal to 100 molts then it's going to present it in volt units and then finally for the power in the mows and Watts if it is below 1 watt so 999 M it will present it in millatt units however if it is equal to or above one watt of power so over here it will divide by and presents the units in watt units and of course all of this is also being relayed over to the LCD display which will be connected very shortly so with the battery removed and the uino unplugged it's time to hook up this LCD display it is an i2c LCD so it only has four pins which will make the connection very very fast and to speed up the process even more I taped together these four wires here so that getting all four pins connected is one step so just making sure to align the blue cable with the ground pin and all four are now installed so connecting the LCD is just as easy as connecting the Ina 260 because they are both using the i2c bus and I will show how the two are differentiated in the code in terms of their addresses later so simply connecting the blue wire ground to the ground on the ordino and the purple wire which was 5 volts or VCC goes to the 5vt of the Ina 260 so finally the green wire is SDA and the gray wire is and on the ardino pins A4 and A5 also function as secondary SDA pins so that is what I'm going to plug these into with A4 being SDA and then the gray pin going into A5 analog pin 5 and just like that the LCD and the Ina 260 are connected so because the program is already uploaded onto here the serial monitor is no longer needed to see the information we can see it all on the LCD here so again the battery is not inserted so it's just going to give blank readings but plugging in the ardrum again we can see the same readings that we're seeing in the serial monitor before plugging in the battery so now inserting the battery so just like in the serial monitor with the new program that I very briefly mentioned because the current is under 1 amp it's being presented in milliamp units um the voltage is in three decimal places it's always in volts unless it's under 0.1 volts and because it's under one watt of power draw it's being presented in Ms so to demonstrate how this changes when I put something more powerful on the load I will now swap out this very very weak little Bluetooth audio receiver module as well as the battery and replace it with a 65 or 75 watt it's somewhere in between the two PTC hot plate and this is where those external headers are going to become very useful because that thing is pulling a lot of current I think it's about 8 amps at its peak so that is way too much for a RedBoard so before turning on the power supply taking note of the units on the screen where it's in molts milliamps and mwatts and as soon as I turn on the 12 volts we now have wattage that's climbing it's in volts now and the amperage is in amps this makes it very convenient because you no longer need to look at the serial moniter so right before getting to the end of of the video I'm just going to show on the IDE how I interfaced both the LCD and the Ina 260 in terms of their i2c addresses so here's the little code that I modified to work with the LCD display and also have that uh alternating units so at the very top the way that I address the two different i2c things is by addressing the Liquid Crystal i2c it's uh by default it's 0 x27 as the address and then this is the part that took me for ever to find out how to do to address the ina260 um for its i2c address you need to say hashtag or pound Define ina260 all caps uncore i2c addr uncore default space 0x4 which is the default i2c address for this device and why did the dictionary open up so that is basically how I did it and here you can see all all of the attempts that I made based on what I was copying from what I had done with the Ina 219 I thought I could carry it over but I couldn't so this is the end of the video on how to use the Ina 260 current and power sensor for the Arduino as well as how to connect an LCD display to it so thank you for watching and if this was interesting or helpful in any way please do consider leaving a like or subscribing to the channel for more of this type of stuff and I will see you in the next one
Info
Channel: Keon's Lab
Views: 2,300
Rating: undefined out of 5
Keywords: INA260, adafruit ina260, INA260 Arduino, ina260 arduino, ina260, Arduino INA260, ina260 adafruit, ina260 tutorial, ina260 LCD, ina219, how to use INA260, Arduino Current Sensor, Arduino Voltage Sensor, Arduino Precision, Arduino Precise, Adafruit, INA219 tutorial, INA219 arduino, adafruit ina219, arduino ina219
Id: ym5ioJFsh4M
Channel Id: undefined
Length: 20min 37sec (1237 seconds)
Published: Fri Mar 08 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.