arduino energymeter_bb.png

I belong to a village of Odisha, India where frequent power cut is very common. It hampers the life of every one. During my childhood days continuing studies after dusk was a real challenge. Due to this problem I designed a solar system for my home on a experimental basis. I used a solar panel of 10 Watt ,6V for lighting few bright LEDs. After facing lot of hardships the project was successful. Then I decided to monitor the voltage, current, power & energy involved in the system. This brought the idea of designing an ENERGY METER.I used ARDUINO as the heart of this project because it is very easy to write code in its IDE and there are huge numbers of open source library available in the internet which can be used according to the requirement.I have experimented the project for very small rated (10Watt) solar system but this can be easily modified to use for higher rating system.

Energy monitoring by
1.LCD display
2. via internet (Xively upload)
3. Data logging in a SD card

You can see my new instructable ARDUINO MPPT SOLAR CHARGE CONTROLLER ( Version-3.0)

You can also see my other instructables on



Remove these adsRemove these ads by Signing Up

Step 1: Parts Required :

Picture of Parts Required :

1. ARDUINO UNO (Rev-3)

4. RESISTORS (10k ,330ohm)

Step 2: Power and Energy

Power :
Power is product of voltage (volt) and current (Amp)
Unit of power is Watt or KW

Energy is product of power (watt) and time (Hour)
E= Pxt
Unit of Energy is Watt Hour or Kilowatt Hour (kWh)

From the above formula it is clear that to measure Energy we need three parameters
1. Voltage
2. Current
3. Time

1-40 of 81Next »
JerryA24 hours ago

I seem to not understand how to include libraries and get the code to run right. I need to build this without the data logging. I have tried to copy and paste the code and compile it but it just errors.

sketch_may28a:56: error: 'voltage' was not declared in this scope

sketch_may28a:59: error: 'energy' was not declared in this scope

sketch_may28a:61: error: 'amps' was not declared in this scope

can anybody help me by putting together just the code to display to lcd...

Slacsteve18 days ago

For your voltage measurement you use the USBs "5" volts as the reference voltage but that varies from one PC to the next. There is a 1.1 reference voltage on the Arduino which can be used to truly calibrate the this meter. Have you considered that? I use a backup PC for development and and another in the field so I need to see the same performance on both systems.

deba168 (author)  Slacsteve7 days ago

You are right.It is the best option.Thanks for suggestion.

HriddhiD1 month ago

3.4 V is equivalent to 696

since 0 to 5 in analog is scaled to 0 1023 in digital

3.25 V should be --> 1024*5/3.25 = 665.6 --> 666

woodsphysics2 months ago

If I use a voltage divider so that I can monitor a 100 W system, I think I will generate too much heat. Do you have a energy meter for a larger system?

dutuc.nicolae3 months ago

Monitor the energy production of a wind turbine with GREEN POWER METER :

Hi Deba, I have similar project to do. But I have to work with 230v ac supply voltage. have you done with 230v supply voltage? please let me know and share you work kindly, it will be helpful. my email {}..
SyedA23 months ago

thanks a lot !!

SyedA23 months ago

hi deba,

can you please provide me the arduino sketch.

deba168 (author)  SyedA23 months ago

Hello :)

The arduino sketch is in step-9.It is a text file attached bellow.

ngpha4 months ago

hi Deba,

I have problem with energy consume. Due to the watt fluctuate, so when calculate energy consume = watt x time (since start) it is not correct. )

as you can see the watt output from energy meter. I compare it with an AC power meter. It is wrong result. I know that my inverter effiency is only 80-90%.

so I use the formula as below, but the result still wrong

watt =voltage*amps; // power=voltage*current
wattttg= watttg+ sqrt (watt*watt);//
wattcc= (wattttg)/time ; average watt hour
energy=wattcc*time /(1000*3600); //total energy in milli second

cong suat.bmp
ngpha made it!4 months ago

hi, Deba. due to short circuit the positive source touch to the arduino, so all of my equiment blow-up -die. I have to build myself a new type. Now i upload it to thingspeak as

here is my new prototype. I make a plastic case for it.

deba168 (author)  ngpha4 months ago

Hey it looks really very nice.Thingspeak graphs are more eye catching than Xively. Thank you for sharing.

Oh sad thing.I will advice before giving power to the circuit, checkrepeatedly.Though it happened to me also.

Hi Deba.

Great Project. It helps me a lot. I just wanna ask about the LCD display. Did u use the serial or parallel LCD??

Thank you.

deba168 (author)  Noor ShahirahS4 months ago

Hi Deba.

Great Project. It helps me a lot. I just wanna ask about the LCD display. Did u use the serial or parallel LCD??

Thank you.

BelialD4 months ago

Whould anyone know if the ACS712 is capable of accurate calculations of 0-20mA at 1-30V? I want to make something very similar to this project but calculate the total mA passing through over time.

deba168 (author)  BelialD4 months ago

I think it will work,but you will not get the exact reading.May get some error.

BelialD deba1684 months ago
Any approximation of the error? Do you think it will it be lower than 4%?
deba168 (author)  BelialD4 months ago

You refer the following links for more details on ACS712 current sensor.

jaykentchriss4 months ago

Hi deba. What if a solar tracker is added to your project? Is it possible to combine your codes with the solar tracker code in one arduino sketch? Is it possible to run your project with solar tracker in a single arduino simultaneously? Just like multi-threading?

deba168 (author)  jaykentchriss4 months ago

I have not tried yet.I think it works.Have a try at your own risk.

sabs.2814 months ago

Hello Sir. How did you get the 696?

thank you.

ngpha sabs.2814 months ago

696 get by the line command


this is the value which the pin 3 in Uno read

sabs.2814 months ago

Hello. I have seen your images attached. Can you please tell me the code to obtain sample1 value which was 927.18?

thank you very much

npitz8 months ago

Hi Deba, I have similar project to do. But I have to work with 53V 20Ah lithium-ion battery
supply voltage and ACS712 30A. would you explain? please let me
know and share you work kindly, it will be helpful. my email

deba168 (author)  npitz4 months ago

Sorry friend.I don't know much about the Li Ion Battery Charging.

IzyanA8 months ago

hai deba! i have a similar project to do. but i cant do with the parts xively. how was it? hmm

deba168 (author)  IzyanA4 months ago

Tell me the exact problem you are facing.I will help you.

ngpha made it!5 months ago

I ask my friend do it for me. Now I can't upload it to I want to upload my data on can someone help me the code. Thanks

deba168 (author)  ngpha4 months ago

Hey it looks great.

jaykentchriss4 months ago

Good day!.. Your project is great.... What if a 12 volts battery will be used?... Do we need to use the same 10 kilo ohms resistances of the voltage divider? or do we need to change it to a higher value in order the ardiuno will not damage?.. Sorry my english :) ...

deba168 (author)  jaykentchriss4 months ago
miragempro4 months ago

Thanks for the tutorial, I was looking for one of those. but I would like to know how to make a program that displayed the value in US dollars spent, for example: I want a dimmer to shower, and want to know how much I spent in real (Brazil's currency) or US dollars, the time that I was in the shower, an example would be 10 10-minute bath what it would cost in US dollars? that would be displayed on the LCD and stored. And put a password, limiting shower time my son in 10 minutes and when the time is up, the water cools, the doubt is how to code. a hug

GiovanniQ6 months ago

Could you post the complete code for current reading please? I need it for a project. Thanks!

deba168 (author)  GiovanniQ6 months ago

You can refer the following link.It explains details on how the hole effect current sensor works.It also include a sample code for current measurement.

auva.pearl9 months ago

Hi Deba, I have similar project to do. But I have to work with 230v ac supply voltage. have you done with 230v supply voltage? please let me know and share you work kindly, it will be helpful. my email

deba168 (author)  auva.pearl9 months ago

I have not tried.You can go through the following link

gaurav masiwal10 months ago

Hey I had one problem in Arduino code for current measurement. Why did you multiplied actual value to 10 in order to get amp value?

deba168 (author)  gaurav masiwal10 months ago

As per data sheet of ACS 712 , analog output = 100mV/A

But I get the output in Volt.


1-40 of 81Next »