Introduction: 3D Printed Arduino OLED Watt Meter

Picture of 3D Printed Arduino OLED Watt Meter

Have you ever wanted to know how many watts or how much current an item uses or even its operating voltage? This simple and easy project can provide you with that crucial information while keeping costs under $7. I primarily designed this to be used in conjunction with common solar charge controllers, that don't have any indication of load power draw. Since making it, I realized it would also be useful on my homemade bench power supply. The fact that you can program a small bitmap image into it is just a bonus and makes you feel great every time you look at it.

Step 1: Gather Your Parts

Picture of Gather Your Parts
  1. Arduino Nano $2.5 on Ebay (or any arduino with 2 anolog inputs and I2C capability)
  2. ACS 712 30amp current sensor module $1 on Ebay
  3. I2C OLED Display 5volt $3 on Ebay
  4. 10k and 100k resistors $.02 (pick up a resistor kit on Ebay if needed)
  5. Arduino Code provided in this instructable
  6. 3d printed case Stl provided in this instructable (optional)

Things that you probably have laying around the house include.

  1. loose wire
  2. soldering iron or way of soldering
  3. some kind of enclosure
  4. usb mini cable for programming
  5. computer with arduino software
  6. bread board for testing electronic circuits
  7. test supply voltage of 7-15
  8. test load
  9. multi meter for testing

Step 2: Prototype It on a Bread Board

Picture of Prototype It on a Bread Board

I have provided a simple easy to follow diagram showing how all the connections are made. I recommend using a bread board, take your time and make sure your connections are correct before powering up. Take special care in making sure the resistor voltage divider is setup correctly. Measure the voltage at the middle of it before connecting it to the ardunino it should be 1/10 the voltage at the input.

Step 3: Code and Calibrate

This code is far from perfect but rather rushed and just a proof of concept. Currently is set to cycle through 4 pages updating the information displayed each time. Use your multi meter to measure the source voltage then modify R1 and R2 in the code respectively to calibrate the voltage on the display. Next using the same voltage and source measure the current of a load using the multi meter. Then reference that reading with the current sensor and modify the number 511 either up or down to calibrate. Keep in mind it is not accurate when measuring small currents, I recommend using a load of around 1 amp while calibrating. If your readings are showing in negative swap the sense wires on the current sensor to easily correct that. Also feel free to change the bitmap image in the code with one of your own, to really customize the final look of the meter.

Step 4: 3D Print a Case

Picture of 3D Print a Case

You can enclose your project in many different ways, however if you have a 3d printer why not print an enclosure. I have included the stl files for the 2 part enclosure that I designed that snaps together with a friction fit. It also has 2 mounting holes for screws and a unique stacked layout.

Step 5: Solder and Assemble

Picture of Solder and Assemble

Solder wires to the boards keeping them as short as possible, referencing how they fit in the back of the printed case. The boards and Display have a really nice friction fit, everything is held nice and tight. The final step is to press the front over the whole thing and your done.


HippieC (author)2017-03-05

Awesome, will actually try to make this. However will it work on higher voltages then "7-15V"? like 24-48V?

Khaleel123 (author)HippieC2017-03-05

The voltage limit is determined by the onboard voltage regulator on the nano and the voltage divider resistor values. I used an online voltage divider calculator to determine the values for the resistors in the voltage divider. Keep in mind that the range of voltage going into the analog read pin is 0-5 volts. Use a meter to measure and confirm this before connecting it to the Arduino. As for powering the arduino use a dc to dc regulator that can step down the voltage to within the max of the nano's on board regulator.

alejoh90 (author)2017-01-24

Love this! Very quick and easy to assemble, great instructable!

Khaleel123 (author)alejoh902017-01-28

Thank You

gevans13 (author)2017-01-15

It would help a lot if you could include HOW to change the bitmap you have included, maybe link it to how the display works and how to get stuff to show on it.

Khaleel123 (author)gevans132017-01-15

I used Microsoft paint to make a bitmap image the size of the display resolution. Then used image to code software to generate the picture code. There is a tutorial showing all of this, I don't remember where it was. The arduino library wiki is also helpful. Google search should pop it up.

gevans13 made it! (author)2017-01-15

Nice little blend of some bargain modules. Took me a while to re-learn the idiosyncrancies of Arduino but I got there in the end. Voltage calibration as-is a good match to my power supply. Just need to work out my own logo now :-)

bernie000 (author)2016-12-12

Very nice project, been looking for something like this for a long time now. I have the 5 amp and 20 amp sensor and need to change your code amps=((511-amp)*75.75/1023); . Could you tell me please how the part 75.75 / 1023 is build up so I can change it to (5 amp=185mV/amp or 20 amp=100mV/amp) thanks for searing your project.

Khaleel123 (author)bernie0002016-12-12

The number 511 is used to bring the read value from the sensor to 0 from its typical resting midpoint value of around 511. Next you determine the number to put in place of 75.75 by dividing 5 by the scale factor for the version you are using. Example for a 30amp sensor the scale factor is 66mv so divide 5 by .066 to get 75.75. For 100mv it would be 50 and for 185mv it's 27.02.

smooth_jamie (author)2016-11-23

Nice project! I assume it only measures DC power since you made it for a solar application?

SamuelL68 (author)smooth_jamie2016-11-24

the ACS module can sense AC current quite nicely as well. I'm currently using it in a project where the two input leads are simply connected in series with the live wire from a wall outlet.

EldarM1 (author)SamuelL682016-11-24

Can you please share how do you calculate the AC amp value?

SamuelL68 (author)EldarM12016-11-25

the same way you would calculate the DC just end up getting a sinusoid on the output of the ACS rather than a DC signal. you might have to add some DC bias to the signal so as to make sure you are not feeding negative voltage into the ADC pins of your MCU, though.

EldarM1 (author)SamuelL682016-11-27

As far as I know there no negative voltage on the output. With an AC signal, we have an offset of 2.5Vdc. As a result you get 2.5V for a zero current and 5 or 0 V for the maximum.

The theory is that you have to measure the RMS value of several points. Using Shanon, you obtain 2 x 50Hz (or 60Hz for US). That means 100-120 Hz. So if you sample it on the rate bigger than given - it's ok.

Another way vould be to sample it higher and get the max value (Vpeak), after what multiply it by 0.707 and get the RMS value. But the Arduino ADC will not allow you to sample at 1kHz.

SamuelL68 (author)EldarM12016-11-28

you are correct about the offset on the output signalnot sure exactly what you're getting at with the sampling theories. what i'm doing in my project is taking a fixed number of samples where I measure the maximum value of the waveform coming into the MCU. then, using the average value of the max, I calculate the RMS value using max/sqrt(2).

EldarM1 (author)SamuelL682016-11-28

What do you have for sampling rate? It's not eays to surely get the Max value

Khaleel123 (author)smooth_jamie2016-11-23

Thanks, Yes it works with 7-15 volts DC and can measure up to 30 amps of current. The voltage range is determined by the on board voltage regulator on the arduino nano.

marc.deloor.5 (author)2016-11-26

I've been thinking about the same concept, but then an AC wattmeter with those IC's. But... They measure the magnetic field inside the IC, so, with AC, the magnetic field switches polarity. 50 times a second... Then you should sync your measurement with the frequency of your line. Since the device is in series with your (household appliance) load, you can't really rectify it. Anyone some ideas about this? Oh... A 2% resolution would be fine...

Khaleel123 (author)marc.deloor.52016-11-28

As far as the modifications for an AC version there isn't much.The output from the acs712 never goes negative since at zero current it sits and the halfway point of 2.5 volts. It's really a matter of writing code that will find the highest value from the sensor then use that in the formula to convert to a current value. And to get the given voltage at the time I would rectify the AC then use a voltage divider configured for the voltage range of AC. Then multiply these two values to get watts. Also the power wiring for the arduino would have to be modified to include a DC power supply.

Khaleel123 (author)marc.deloor.52016-11-26

This is the first result in Google when searching for AC current acs712 tutorial.

kmsim (author)2016-11-28

here is some info about the 1.5% total accuracy of the ACS 712. There is also a link to the datasheet describing how chopper stabilization and ratiometry influence the overall and specific accuracy.

Khaleel123 (author)kmsim2016-11-28

Thanks, I'll check it out

andrewty (author)2016-11-27

You could do with changing the title to include "DC Watt meter"

You would need a multiplying function to calculate instantaneous I * V to generate a watt value.

You can't just measure Irms and Vrms and just multiply. That excludes the load phase.

a capacitor across the AC voltage. It absorbs virtually zero power even
though the current is measured as significant mAac, or Aac.

Same for an inductor. The reactive element of the load does not absorb power. Only the resistive part of the load absorbs power.

SallyJ18 (author)2016-11-25

The datasheet states that there are 3 chips available: 5A, 20A and 30A. (Google ACS712). Depending on which one you use, the calibrated output mv/A changes. Use the chip and value you need. Accuray is calibrated at manufacture and doesn't drift with current. The chips read the specified current in both DC polarities with output NOMINALLY (see datasheet) 0V at -Amax through to about 4V at +Amax, so the Arduino ADC will always get a positive voltage even when reading AC.

This output is fine for DC, but when fed from AC. it will be the instantaneous current. Most power meters process this to get an RMS current vale. Ditto for the supply voltage - this all of a sudden gets a lot more complicated without a major redesign, and you haven't yet dealt with non-sinusoidal inputs!

For DC, with the stated voltage, as designed, it should be a good design

(Datasheets are essential if you want to understand what's going on (or wrong), and usually found through GOOGLE. Saves a lot of questions!

Khaleel123 (author)SallyJ182016-11-25

With different wiring and a few different components this can be converted into an AC watt meter. I would wire in a cheap usb wall charger to power the arduino, display and sensor with 5 volts. Then I would use a rectifier to convert AC to DC followed by an voltage divider with the correct resistor values for lets say 130 volts to be safe. The wiring between the arduino, display, sensor and voltage divider would remain the same however it would be different on the power and code side of things. With all the interest in an AC version maybe I should show how that would work next. You are absolutely right about datasheets and google. Thanks

ptkrf (author)2016-11-24

About the cheap ampmeter: you will be fine with a cheap voltmeter but ampmeters loose acuracy with rising power due to their design. To handle that, proper wattmeters use better components in their ampmeter section. Long story short: you made a power indicator rather than power meter as your ampmeter is highly inacurate.

Long version of that story: both Vmeter and Ameter contain a Vmeter. Ameter has a resistor with very constant (doesn't change much with temperature and humidity) and very accurately measured resistance on which voltage is being measured. Ameter gets current by dividing measured voltage with known resistance. What makes Ameters inaccurate is the fact those high quality resistors can get very expensive.

Nice ible though :)

SamuelL68 (author)ptkrf2016-11-25

these ACS modules are actually quite accurate. they don't need a shunt resistor to measure current like you're describing because they use the Hall Effect sensing method to obtain the measurement.

Khaleel123 (author)ptkrf2016-11-24

I used a multi meter to compare readings with and it seemed to be very close to what it read. I mean obliviously its not going to be the most accurate, but it will work well enough to be used in my application.

vaxus (author)2016-11-24

there is another sensor for AC current also up to 30 A. It is called ACS712 also at 1.8$ on ebay

Khaleel123 (author)vaxus2016-11-24

As far as I know the acs712 sensor can be used with AC current. The arduino code would have to be modified. You will also need a separate DC power source for the sensor arduino and display.

SamuelL68 (author)Khaleel1232016-11-25

yeah definitely don't try powering your arduino with AC!! in addition to the current ratings, each ACS model has a different output voltage proportional to the input current. you need to read the data sheet to get these values.

PhilS43 (author)vaxus2016-11-24

Isn't it what he's using?

"ACS 712 30amp current sensor module $1 on Ebay", or does the space make a difference?

SamuelL68 (author)PhilS432016-11-24

these modules output a different mV proportional to the input current. the 5A module gives something like 185mV/A on the output while the 20A gives something like 130mV/A. these values can be found in the datasheet for the ACS712 family.

PhilS43 (author)SamuelL682016-11-24

So why not say so?

If there are so many versions why just

"ACS 712 30amp current sensor module $1 on Ebay"?

Getting the right part number matters - FWIW I have samples of all of these, so being a little more precise helps, that's all.

Khaleel123 (author)PhilS432016-11-24

As far as I know the only difference in the variations is the amount of current they can handle. I believe the model is acs712elc-30a at least thats what the ebay description says.

Khaleel123 (author)PhilS432016-11-24

I believe its the same sensor.

rastervec (author)PhilS432016-11-24

There are three versions of ACS712ELCTR integrated circuit. The-5A-T, -20A-T (20 amps) and the -30A-T (30 amps)

qamarsk (author)2016-11-24


Khaleel123 (author)qamarsk2016-11-24

Thank You

wb8nbs (author)2016-11-24

I think the 5-15 volt feed line in the prototype drawing is in the wrong place.

clothier_bruce (author)wb8nbs2016-11-24

I think you're right: theres something horribly wrong with the wiring.

Please, care to explain how, what and where something is wrong with the wiring. check my response to wb8nbs and elaborate.

OK, maybe I read it wrong - apologies.

Khaleel123 (author)wb8nbs2016-11-24

The arduino nano pin labeled Vin connects to the ams117 5 volt regulator on the nano. The datasheet says it has a input voltage range of 6.5-15 volts. The arduino, display, and sensor get powered from the output of the on board ams117. Which is also connected to the pin labeled +5v on the nano. The diagram is specific to the arduino nano which has the on board voltage regulator ams117 5.0 built in. Unless I missed something please explain how it is wrong.

wb8nbs (author)Khaleel1232016-11-24

I apologize, Reading closer you are powering off the DC feed, I thought the relay was switching the AC mains, in which case a separate DC feed would be necessary.

Khaleel123 (author)wb8nbs2016-11-24

This complete setup is designed to work with a solar charge controller which operates on a DC voltage of around 12 volts. It is connected in a way where it draws power from the load side of the controller while also measuring voltage and current flowing out of the controller. The arduino then multiples the values to give you a wattage reading. There is no mains AC or relay involved.

Eric Brouwer (author)2016-11-23

Very nice looking 3D printed enclosure.

Khaleel123 (author)Eric Brouwer2016-11-23

Thanks, This was the first time I designed and printed an enclosure for a project and it turned out perfect.

About This Instructable




Bio: I like finding new uses for things, making things, and improving things. I'm a student who is currently looking for a better job, one ... More »
More by Khaleel123:ESP 8266 ARDUINO WIFI CONTROLLED AC OUTLET3D Printed Arduino OLED Watt MeterSolar Powered Radio with Bluetooth + MP3
Add instructable to: