Make your own Power Meter/Logger

Creating a Power Meter Using an I n a 219 Bi-Directional Current Power Monitor with Arduino

The power meter is one of the most important tools in electronics and electrical engineering. It measures the amount of electrical energy being used by a device or system, allowing us to monitor our energy consumption and optimize our usage. In this article, we will create a simple power meter using an I n a 219 bi-directional current power monitor and Arduino.

The first step is to understand how the I n a 219 works. This device is a low-value resistor that needs to be placed in series with our loads in order to create a voltage drop proportional to the flowing current. This voltage drop can then be amplified and fed into a microcontroller, such as Arduino, to calculate the current value.

To make life easier for us, let's use the I n a 219 bi-directional current power monitor that comes with an embedded PCB year for only $2 from eBay. The device also includes a zero-point 1 ohm current shunt and a screw terminal due to the maximum current shunt input voltage of 320 millivolts. We can measure a maximum current of 3.2 amps and a maximum voltage of 26 volts.

To hook up the IC to the Arduino, we follow the same procedure as with any other I squared C device. The serial data connector is connected to pins A4 and C, and clock connects pin A5. At this point, we could use the wire library of the Arduino to write our own ICE query codes in order to communicate with the IC, but we can also just download the I n a 219 library from Adafruit included and write fewer lines of code.

To measure anything useful, we first need to connect the V+ pin to the positive terminal of the supply voltage, the ME- pin to the positive terminal of the loads, and the ground of the loads to the ground of the measuring system. The serial output levels are pretty accurate values, which means we can continue by using three more variables and the `moolies` function in order to make the measurement repeat every 100 milliseconds.

This way, we can not only add a power measurement output by multiplying the current and load voltage but also an energy counter that adds the power value multiplied by 100 milliseconds converted into hours to the previous energy value. Since the serial monitor now presents all the values we care about correctly, it was time to add a display to the circuits in this case a 0.9" inch OLED LCD which I got from eBay for $4.

The wire ring was exactly the same as before since the LCD also uses the I squared C communication protocol after downloading and including the library for it from Adafruit it was simply a job of using the print light function and figuring out where to position the text on the LCD in order to make it look decent. For many people, this setup should already fulfill the demands for power meter but not for me that is why I got myself a commonly available SD card PCB which can be found for $2.

And also includes the LVC 125 level shift. This I see is important because the SPI pins of the Arduino 11 to 14 to which the SD cards needs to get connected to have a high voltage level of 5 folds but the SD card can only handle 3.3 volts and don't worry if you miss the step during the wiring of those components because I utilized the EZ EDA free circuit design software to create an appropriate schematic before hands.

You can find a link to it along with other project information as always in the video description. After formatting the SD card and plugging it in, we could use the SD library which is always included in the Arduino IDE in order to write to it but I have to say that had quite a few problems with its while trying to open the files. Rather recommend the SD fat library which uses the same commands but does function without a problem with its the SD card.

Create three text files which contain time, voltage and current values by simply importing them into a program like Excel you can then create decent-looking graphs and of course also calculate the power and energy values last but not least I remove the used components from the breadboard replace the Nano with an ultra no pro mini which are programmed within FTDI break ouch added a lipo battery both protection / charging circuit to the system so load everything onto a piece of perf boards.

And connected the components to one another of course you can create a beautifully crafted enclosure for your power meter but mine doesn't really need one for what I have in mind for it and with that being said this project is completes and works like a charm. I hope you liked this video as always don't forget to Like share and subscribe stay creative and I will see you next time.