loading

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

  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

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

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

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.

<p>Awesome, will actually try to make this. However will it work on higher voltages then &quot;7-15V&quot;? like 24-48V?</p>
<p>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.</p>
<p>Love this! Very quick and easy to assemble, great instructable!</p>
<p>Thank You</p>
<p>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. </p>
<p>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.</p>
<p>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 :-)</p>
<p>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.</p>
<p>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.</p>
<p>Nice project! I assume it only measures DC power since you made it for a solar application?</p>
<p>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. </p>
<p>Can you please share how do you calculate the AC amp value?</p>
the same way you would calculate the DC current...you 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. <br>
<p>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.</p><p>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.</p><p>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.</p>
<p>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). </p>
<p>What do you have for sampling rate? It's not eays to surely get the Max value</p>
<p>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. </p>
<p>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...</p>
<p>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.</p>
<p>This is the first result in Google when searching for AC current acs712 tutorial. http://henrysbench.capnfatz.com/henrys-bench/arduino-current-measurements/acs712-arduino-ac-current-tutorial/</p>
<p>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.</p><p>http://embedded-lab.com/blog/a-brief-overview-of-allegro-acs712-current-sensor-part-1/</p>
<p>Thanks, I'll check it out</p>
<p>You could do with changing the title to include &quot;DC Watt meter&quot;</p><p>You would need a multiplying function to calculate instantaneous I * V to generate a watt value.</p><p>You can't just measure Irms and Vrms and just multiply. That excludes the load phase.</p><p>Take<br> a capacitor across the AC voltage. It absorbs virtually zero power even<br> though the current is measured as significant mAac, or Aac.</p><p>Same for an inductor. The reactive element of the load does not absorb power. Only the resistive part of the load absorbs power.</p>
<p>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.</p><p>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! </p><p>For DC, with the stated voltage, as designed, it should be a good design</p><p>(Datasheets are essential if you want to understand what's going on (or wrong), and usually found through GOOGLE. Saves a lot of questions!</p>
<p>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</p>
<p>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.</p><p>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.</p><p>Nice ible though :)</p>
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.
<p>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.</p>
<p>there is another sensor for AC current also up to 30 A. It is called ACS712 also at 1.8$ on ebay</p>
<p>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.</p>
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.
<p>Isn't it what he's using?</p><p>&quot;ACS 712 30amp current sensor module $1 on Ebay&quot;, or does the space make a difference?</p>
<p>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. </p>
<p>So why not say so?</p><p>If there are so many versions why just </p><p>&quot;ACS 712 30amp current sensor module $1 on Ebay&quot;?</p><p>Getting the right part number matters - FWIW I have samples of all of these, so being a little more precise helps, that's all.</p>
<p>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.</p>
<p>I believe its the same sensor.</p>
<p>There are three versions of ACS712ELCTR integrated circuit. The-5A-T, -20A-T (20 amps) and the -30A-T (30 amps)</p>
<p>MASHAA ALLAH GR8 WORK</p>
<p>Thank You</p>
<p>I think the 5-15 volt feed line in the prototype drawing is in the wrong place.</p>
<p>I think you're right: theres something horribly wrong with the wiring.</p>
<p>Please, care to explain how, what and where something is wrong with the wiring. check my response to wb8nbs and elaborate.</p>
<p>OK, maybe I read it wrong - apologies.</p>
<p>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.</p>
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.
<p>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.</p>
<p>Very nice looking 3D printed enclosure.</p>
<p>Thanks, This was the first time I designed and printed an enclosure for a project and it turned out perfect.</p>

About This Instructable

30,946views

375favorites

License:

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 OUTLET 3D Printed Arduino OLED Watt Meter Solar Powered Radio with Bluetooth + MP3 
Add instructable to: