Make Your Own Power Meter/Logger

83,387

492

52

About: Awesome Electronics Tutorials, Projects and How To´s

In this project I will show you how I combined an Arduino, an INA219 power monitor IC, an OLED LCD and a Micro SD Card PCB in order to create a power meter/logger that has more functions than the popular USB Power Meter. Let's get started!

Step 1: Watch the Video!

The video gives you a good overview on how to create your own power meter. In the next steps though I will present you some additional information to make this project even simpler.

Step 2: Order Your Parts!

Here you can find a parts list with example seller for the portable version of this project.

Amazon.com:

1x LiPo Battery: http://amzn.to/2gz4yvd

1x TP4056 Board: http://amzn.to/2gzdIb4

1x Arduino Pro Mini: http://amzn.to/2gvfXuQ

1x INA219 Board: http://amzn.to/2gvflW7

1x OLED LCD: http://amzn.to/2fobopO

1x SD Card PCB: http://amzn.to/2fodhmu

1x Switch: http://amzn.to/2gz9ZtW

Ebay:
1x TP4056 Board: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x Arduino Pro Mini: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x INA219 Board: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x OLED LCD: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x SD Card PCB: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x Switch: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

Amazon.de:

1x LiPo Battery: http://amzn.to/2gM2vXB

1x TP4056 Board: http://amzn.to/2eUvMNO

1x Arduino Pro Mini: http://amzn.to/2g6Ujjr

1x INA219 Board: http://amzn.to/2gM5M9v

1x OLED LCD: http://amzn.to/2g6Q3Rd

1x SD Card PCB: http://amzn.to/2gM9Zdf

Step 3: Create the Circuit!

Here you can find the schematic for the Arduino Nano version and the portable version of this project. You can also find those schematic on the EasyEDA website:

https://easyeda.com/GreatScott/PowerMeter-b6051723...

https://easyeda.com/GreatScott/PortablePowerMeter-...

You can also use the pictures of my finished board as a reference for your own.

Step 4: Upload the Code!

Now that your circuit is complete, it is time to upload the code. You can download it here. But don't forget to download and include the following libraries before uploading:

https://github.com/adafruit/Adafruit_INA219

https://github.com/adafruit/Adafruit_SSD1306

https://github.com/greiman/SdFat

Step 5: Success!

You did it! You just created your own Power Meter/Logger


Feel free to check out my YouTube channel for more awesome projects:

http://www.youtube.com/user/greatscottlab

You can also follow me on Facebook, Twitter and Google+ for news about upcoming projects and behind the scenes information:

https://twitter.com/GreatScottLab

https://www.facebook.com/greatscottlab

5 People Made This Project!

Recommendations

  • Colors of the Rainbow Contest

    Colors of the Rainbow Contest
  • Fandom Contest

    Fandom Contest
  • Frozen Treats Challenge

    Frozen Treats Challenge

52 Discussions

0
None
AlrickH

Question 1 year ago

hi, congrats and thanks for a great video. I want to make a similar project but i need to monitor more current like upto 24 volts and 21 Apms.......what you suggest i do, or replace in the your given circuit? Hope to get a quick reply.

1 answer
0
None
DerekB103AlrickH

Answer 21 days ago

You can modify the INA219 to measure current greater than 3.2 amps. You need to change the sense resistor value. You can Google 'change current measurement of INA219'.

0
None
mlhanes

Question 2 months ago on Introduction

How can this project be adjusted to monitor higher wattage useage like with appliance? I would like to build this to monitor copier power useage and perhaps spikes.

1 answer
0
None
DerekB103mlhanes

Answer 21 days ago

I don't know if it can.

I do know you can modify the INA219 to measure current greater than 3.2 amps but you still will probably be limited to 26V ... if the device you are measuring runs off 110V you might need to look at something other than the INA219.

If however, your device has a power adapter which converts the 110V to something less than 26V then you can probably use the INA219 ... Google for ways to 'measure more current with INA219' ... essentially it involves changing the sense resistor value on the board.

0
None
DerekA46

Question 9 months ago

So I know this have been here a while but I have a few questions,

1. How to do you modify the code so it only records an input measurement every 10min? [Figured this out... a few coding changes and it works like a champ. I had to seperate out the unsigned long interval for the reading measurements and unsigned long interval for the display readings.

for future reference if you want to change the time between reading measurements saved to the SD card the code should read like this:


updated code:

unsigned long previousMillis = 1799910; // this number is set to take a reading when program starts
unsigned long interval = 1800000; // interval time between data recording Set in milliseconds.
unsigned long previousMillisDisp = 0;
unsigned long intervalDisp = 100; // interval time between LCD refresh Set in milliseconds.

const int chipSelect = 10;
float shuntvoltage = 0;
float busvoltage = 0;
float current_mA = 0;
float loadvoltage = 0;
float energy = 0;
File TimeFile;
File VoltFile;
File CurFile;


void setup() {
SD.begin(chipSelect);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
ina219.begin();
}

void loop() {
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval)
{
previousMillis = currentMillis;
ina219values();

TimeFile = SD.open("TIME.txt", FILE_WRITE);
if (TimeFile) {
TimeFile.println(currentMillis);
TimeFile.close();
}

VoltFile = SD.open("VOLT.txt", FILE_WRITE);
if (VoltFile) {
VoltFile.println(loadvoltage);
VoltFile.close();
}

CurFile = SD.open("CUR.txt", FILE_WRITE);
if (CurFile) {
CurFile.println(current_mA);
CurFile.close();
}
displaydata();
}

if (currentMillis - previousMillisDisp >= intervalDisp)
{
previousMillisDisp = currentMillis;
ina219values();
displaydata();
}
}

***Everything else within the code should remain the same.***

2. I am trying to measure the voltage and current drop of a battery operated LED light string... I can get the correct current to be displayed but no matter what I do the circuit will only display 1V. What am I doing wrong?

Thanks again for your help and this is a great setup!

4 answers
0
None
Chiranjiv_sc30DerekA46

Answer 2 months ago

Hey can I get a copy of the entire code?.I would like to compare it with mine for rectifications.??

0
None
DerekB103Chiranjiv_sc30

Reply 21 days ago

The origianl code is above ... there is a dowload link for a .ino file.

0
None
DerekB103DerekA46

Answer 3 months ago

HI DerekA46,

Did you ever work out the 1V issue? I have just created the power meter in last day or two and have exactly the same issue. If I manage to work it out (with my limited coding and electronics ability) before I hear back from you, I'll post a reply here.

Else, if you already have the answer, I'd appreciate knowing!

Thanks.

0
None
DerekB103DerekB103

Reply 3 months ago

So, with a little bit of thought and watching the video again, I was able to work out the 1V issue ... and it really makes simple sense.

In the video, when he mentions when connecting the testing load and source, that you connect the positive lead of the source to the Vin+ of the INA219, you connect the Vin- to the positive terminal of the load, and then you connect the negative terminal of the load to the GND of the measuring device (the Arduino). Obviously, I had to connect something to the negative end of the source or the load wouldn't draw any current(there would be no complete circuit), so I thought that's what he meant ... connect the negative terminal of the load to the negative end of the source.

What he actually means is, connect the negative terminal of the load to the negative end of the source AND the GND of the measuring device. You have to connect it to BOTH. Without a connection to the GND of the Arduino as well as the negative of the source, you cannot measure a true Voltage drop and so, the display only ever shows 1V.

That fixed my 1V issue rioght away!

0
None
oidjw

Question 7 weeks ago

Hi,

Can somebody confirm how to connect the panel to the terminals?

What is the need for the resistors?

Thank You

1 answer
0
None
DerekB103oidjw

Answer 21 days ago

What panels and what resistors? There are no resistor in the schematic I think?

The schematic as shown should have an input and an output terminal.

Connect a solar panel (I assume this is what you mean?) to the input and connect a load (a battery to store the solar power?) to the output side and you can then measure and log the power coming from a solar panel.

Understand though, that there is a current limitation of the power logger as it's currently made of 3.2 amps. This probably limits you to something less than a 100w solar panel.

0
None
mlhanes

Question 3 months ago on Introduction

Can this project be used to monitor a larger piece of equipment like for instance a copier?

0
None
DerekB103JabinS1

Answer 3 months ago

Yes, it can.

The "load" will be whatever you are connecting to your panels, whether a battery to store your energy or some device you are powering. The "source" will be your panels. All you need to do is, more or less, connect this device between your panel and your device/battery.

0
None
EthanB98

Question 4 months ago

How do i use this to measure 9V 3W solar panels?

1 answer
0
None
DerekB103EthanB98

Answer 3 months ago

All you need to do is, more or less, connect this device between your panel and your device/battery.

The "load" will be whatever you are connecting to your panels, whether a battery to store your energy or some device you are powering. The "source" will be your panels.

0
None
sagiro

Question 9 months ago

Hello,

I wanted to know if there is a way to turn it into a solar panel tester to know how much energy I can get from the cell in various places around my house and find the best place to position the panel.
Can this do what I'm asking?

1 answer
0
None
DerekB103sagiro

Answer 3 months ago

Yes, it can.

The "load" will be whatever you are connecting to your panels, whether a battery to store your energy or some device you are powering. The "source" will be your panels. All you need to do is, more or less, connect this device between your panel and your device/battery.

0
None
smooth_jamie

2 years ago

Hi there, nice project. I'm curious as to what the lowest measured current is possible on this project and what the accuracy is?

1 reply