Arduino Energy Cost Electrical Meter Device

3,224

34

6

About: Klaatu baradu nikto

Do you pay too much for your electricity bills?

Do you want to know how much electricity your kettle or heater consumes?

Make your own portable Energy Cost Electrical Meter!

Watch how I found the use of this device.

Step 1: Preparation. Tools Screws and Consumables.

You need several things to make this project.

  • Home computer with XOD IDE installed.
  • 3D printer.

Tools:

  • Clippers.
  • Screwdriver.
  • Pliers.
  • Soldering tools.
  • Needle file.

Consumables:

  • Sandpaper.
  • Shrink tubes.
  • 14 AWG wires or less for 220V circuit.
  • 24 or 26 AWG wires for 5V logic circuit.

Screws:

  • Screw M3 (DIN7985 / DIN 84 / DIN 912) 20mm length.
  • Screw M3 (DIN7985 / DIN 84 / DIN 912) 10mm length.
  • Screw M2 / M2.5 (DIN7981 or other).
  • Hex nut M3 (DIN 934/ DIN 985).

Step 2: Preparation. Electronics.

To create the device you need some electronic components. Let's figure out which ones.

First of all, you need an AC current sensor.

The device can works with a high current, so the sensor should be suitable. On the internet, I found an ACS712 sensor manufactured by Allegro.

1 x 20A range Current Sensor ACS712 Module ~ 9$;

This sensor is analog and measures current using the Hall effect. It uses one wire to transmit the measured value. It may not be very accurate, but I think it's enough for such a device. The ACS712 sensor can be of three types with different maximum limits of measurement :

  • ACS712ELCTR-05B (5 amperes max);
  • ACS712ELCTR-20A (20 amperes max);
  • ACS712ELCTR-30A (30 amperes max).

You can pick the version you need. I use the 20 amp version. I don't think the current in my sockets exceeds this value.

You need a controller, to read sensor data and to perform all other calculations.

Of course, I chose Arduino. I think that there is nothing more convenient for such DIY projects. My task isn’t difficult, so I don’t need a fancy board. I bought Arduino Micro.

1 x Arduino Micro ~ 20$;

Arduino is powered by DC voltage up to 12V while I was going to measure AC voltage 220V. Moreover, the ACS sensor should be powered by an exact 5 volts. To solve the problem, I bought the AC to DC converter from 220 to 5 volts.

1 x AC to DC Power Module Supply Input: AC86-265V Output: 5V 1A ~ 7$;

I use this converter to power Arduino and sensor.

To visualize my measurements, l display the amount of money spent on a screen. I use this 8x2 character LCD display.

1 x 0802 LCD 8x2 Character LCD Display Module 5V ~9$;

This is small, compatible with Arduino display. It use own data bus to communicate with the controller. Also, this display has a backlight which can be one of different colors. I got the orange one.

Step 3: Preparation. Sonnectors.

The device should have its own power plug and socket.

It is quite challenging to make a quality and reliable plug connection at home. Also, I wanted the device to be portable and compact without any cords and wires.

I decided to buy some universal sockets and plugs in the hardware store to disassemble them to use any their parts. Connectors that I purchased are F type or as they are called Shuko. This connection is used all over the European Union. There are different connector types, for example, the A or B types are a bit smaller than F and are used in Northen America. The internal dimensions of sockets and external dimensions of plugs are standardized for all connectors of the type.

For more information, you can read about different socket types here.

Disassembling a few sockets, I found that their inside parts can be easily removed. These parts have almost the same mechanical dimensions. I decided to use them.

So, To create own device you need :

  • Choose the connection type;
  • Find plugs and sockets that you can use, and that can be easily disassembled;
  • Remove their inner parts.

I used this socket:

1 x Earthed Female Plug 16A 250V ~ 1$;

And this plug:

1 x Male Plug 16A 250V ~ 0,50$;

Step 4: Preparation. 3D Printing.

I printed body parts of the device on a 3D printer. I used ABS plastic of different colors.

Here is the list of parts:

  • Main body (purple) - 1 piece;
  • Back cover (yellow) - 1 piece;
  • Socket case (pink) - 1 piece;
  • Plug case (red) - 1 piece;

The main body has threading holes to fasten the current sensor and back cover.

The back cover has threading holes to fasten the AC-DC converter and a snap-fit joint to attach Arduino Micro.

All parts have holes for M3 screws to fix the display, plug and socket cases.

Pay attention to the socket case and plug case parts.

The inner surfaces of these parts are pre-modeled specifically for my connectors. For those disassembled connectors from the previous step.

Thus, if you want to make own device and your plug and socket connectors differ from mine, you need to fix or modify the socket case and plug case 3D models.

STL models are in the attachment. If it is necessary, I can attach the source CAD models.

Step 5: Assembling. Socket Case.

The material list:

  1. 3D printed socket case - 1 piece;
  2. Socket - 1 piece;
  3. High voltage wires (14 AWG or less).

Assembling process:

Look at the sketch. The image will help you with the assembly.

  • Prepare the socket (pos. 2). The socket should fit tightly into the case until the stop ledge. If it is necessary, process the contour of the socket with a sandpaper or needle file.
  • Connect high voltage wires to the socket. Use terminal blocks or soldering.
  • Insert the socket (pos. 2) into the case (pos. 1).

Optional:

  • Fix the socket in the case with a screw through the platform on the case.

Step 6: Assembling. Main Body.

The material list:

  1. 3D printed main body - 1 piece;
  2. Assembled socket case - 1 piece;
  3. ACS 712 current sensor - 1 piece;
  4. 8x2 LCD display - 1 piece;
  5. Screw M3 (DIN7985 / DIN 84 / DIN 912) 20mm length- 4 pieces.
  6. Screw M3 (DIN7985 / DIN 84 / DIN 912) 10mm length- 4 pieces.
  7. Screw M2 / M2.5 (DIN7981 or other) - 2 pieces.
  8. Hex nut M3 (DIN 934/ DIN 985) - 8 pieces.
  9. 24 or 26 AWG wires.
  10. High voltage wires (14 AWG or less).

Assembling process:

Look at the sketch. The image will help you with the assembly.

  • Prepare the large hole at the main body (pos. 1). The assembled socket case should fit tightly into it. If it is necessary, process the contour of the hole with a sandpaper or needle file.
  • Insert the socket case (pos. 2) to the main body (pos. 1) and fasten it using screws (pos. 6) and nuts (pos. 8).
  • Connect high voltage wires to the current sensor (pos. 3). Use terminal blocks.
  • Fasten the current sensor (pos. 3) with the main body (pos. 1) using screws (pos. 7).
  • Connect or solder the wires to the display (pos. 4) and to the current sensor (pos. 3)
  • Fasten the display (pos. 4) with the main body (pos. 1) using screws (pos. 5) and nuts (pos. 8).

Step 7: Assembling. Plug Case.

The material list:

  1. 3D printed plug case - 1 piece;
  2. Plug - 1 piece;
  3. High voltage wires (14 AWG or less).

Assembling process:

Look at the sketch. The image will help you with the assembly.

  • Prepare the plug (pos. 2). The plug should fit tightly into the case until the stop. If it is necessary, process the contour of the socket with a sandpaper or needle file.
  • Connect high voltage wires to the plug (pos. 2). Use terminal blocks or soldering.
  • Insert the plug (pos. 2) into the case (pos. 1).

Optional:

  • Fix the plug in the case with a screw. The place to screw is shown at the sketch.

Step 8: Assembling. Back Cover.

The material list:

  1. 3D printed back cover - 1 piece;
  2. Assembled plug case - 1 piece;
  3. AC-DC voltage converter - 1 piece;
  4. Arduino Micro - 1 piece;
  5. Screw M3 (DIN7985 / DIN 84 / DIN 912) 10mm length- 4 pieces.
  6. Screw M2 / M2.5 (DIN7981 or other) - 4 pieces.
  7. Hex nut M3 (DIN 934/ DIN 985) - 4 pieces.

Assembling process:

Look at the sketch. The image will help you with the assembly.

  • Prepare the large hole at the back cover (pos. 1). The assembled plug case (pos. 2) should fit tightly into it. If it is necessary, process the contour of the hole with a sandpaper or needle file.
  • Insert the plug case (pos. 2) to the back cover (pos. 1) and fasten it using screws (pos. 5) and nuts (pos. 7).
  • Attach Arduino (pos. 4) to the back cover (pos. 1) using the snap-fit connection.
  • Fasten the AC-DC voltage converter (pos. 3) to the back cover (pos. 1) using screws (pos. 6).

Step 9: Assembling. Soldering.

The material list:

  1. High voltage wires (14 AWG or less).
  2. 24 or 26 AWG wires.

Assembling:

Solder all components together as it is shown in the sketch.

High voltage wires from the plug are soldered to the AC-DC converter and to cables from the socket.

The ACS712 is an analog current sensor, and it is powered by 5V. You can power the sensor from Arduino or from the AC-DC converter directly.

  • Vcc pin - 5V Arduino pin / 5V AC-DC pin;
  • GND - GND Arduino pin / GND AC-DC pin;
  • OUT - analog A0 Arduino pin;

The LCD 8x2 Character LCD Display is powered by 3.3-5V and has own data bus. The display can communicate in an 8-bit (DB0-DB7) or 4-bit mode (DB4-DB7). I used a 4-bit one. You can power the display from Arduino or from the AC-DC converter.

  • Vcc pin - 5V Arduino pin / 5V AC-DC pin;
  • GND - GND Arduino pin / GND AC-DC pin;
  • Vo - GND Arduino pin / GND AC-DC pin;
  • R/W - GND Arduino pin / GND AC-DC pin;
  • RS - digital 12 Arduino pin;
  • E - digital 11 Arduino pin;
  • DB4 - digital 5 Arduino pin;
  • DB5 - digital 4 Arduino pin;
  • DB6 - digital 3 Arduino pin;
  • DB7 - digital 2 Arduino pin;

Notification:

Do not forget to isolate all high voltage wires with shrink tubes! Also, isolate high voltage soldered contacts on the AC-DC voltage converter. Also, isolate high voltage soldered contacts on the AC-DC voltage converter.

Please be careful with 220V. High voltage can kill you!

Do not touch any electronic component when the device is connected to the electricity grid.

Do not connect the Arduino to a computer when the device is connected to the electricity grid.

Step 10: Assembling. Finish.

The material list:

  1. Assembled main body - 1 piece;
  2. Assembled back cover - 1 piece;
  3. Screw M3 (DIN7985 / DIN 84 / DIN 912) 10mm length - 4 pieces.

Assembling process:

Look at the sketch. The image will help you with the assembly.

  • After you finish soldering, place all wires securely into the main body (pos. 1).
  • Make sure that there are no open contacts anywhere. Wires must not intersect, and their open places must not contact the plastic body.
  • Fasten the back cover (pos. 2) to the main body (pos. 1) using screws (pos. 3).

Step 11: XOD.

To program Arduino controllers, I use the XOD visual programming environment. If you are new to electrical engineering or maybe you just like to write simple programs for Arduino controllers like me, try XOD. It’s the ideal instrument for fast device prototyping.

In XOD you can create programs directly in the browser window. Personally, I prefer the desktop version.

For my ECEM device, I created the gabbapeople/electricity-meter library in XOD. This library contains all nodes you need to make the same program. It also includes the prepared program example. So, be sure to add it into your XOD workspace.

Process:

  • Install the XOD IDE software on your computer.
  • Add the gabbapeople/electricity-meter library to the workspace.
  • Create a new project and call it smth.

Next, I'm going to describe how to program this device in XOD.

I also attached the screenshot with the extended version of the program at the last instructable step.

Step 12: Program.

Here are nodes you need:

The acs712-20a-ac-current-sensor node.

This is the first node to place onto the patch. It is used to measure the momentary current. In this library, there are 3 different types of nodes. They differ in the amperage measurement cap type. Chose the one corresponding to your type of sensor. I place the acs712-20a-ac-current-sensor node. This node outputs a value of the current intensity in amperes.

At the PORT pin of this node, I should put the value of the Arduino Micro pin to which I connected my current sensor. I soldered the signal pin of the sensor to the A0 Arduino pin, so I put A0 value to the PORT pin.

The value at the UPD pin should be set to Continuously, to measure the current intensity continuously after turning on the device. Also for AC measurement, I need to specify the frequency. In my electricity grid, the AC frequency equals to 50 Hz. I put the 50 value to the frequency FRQ pin.

The multiply node.

It calculates the electric power. Electrical power is the product of the current to voltage multiplication.

Put the multiply node and link one of its pins with the sensor node and put the AC voltage value to the second pin. I put the 230 value. It refers to the voltage in my electricity grid.

The integrate-dt node.

With two previous nodes, the current and power of the device can be measured instantly. But, you need to calculate how the power consumption changes over time. For this, you can integrate the instant power value using the integrate-dt node. This node will accumulate the current power value.

The UPD pin triggers an accumulated value update, while the RST pin resets the accumulated value to zero.

The to-money node.

After integration, at the output of the integrate-dt node, you get the electric power consumption in watts per second. To make it more convenient to count the money spent place the to-money node onto the patch. This node converts the power consumption from watts per second to kilowatts per hour and multiples the accumulated value by the cost of one kilowatt per hour.

Put the price of one kilowatt per hour to the PRC pin.

With the to-money node, the accumulated value of electricity consumption is converted to the amount of money spent. This node outputs it in dollars.

All you left to do is to display this value on the display of the screen.

The text-lcd-8x2 node.

I used LCD display with 2 lines four 8 characters. I put the text-lcd-8x2 node for this display and set up all port pin values. This port pins correspond to the Arduino micro ports the display is soldered to.

On the first line of the display, at the L1 pin, I wrote the “Total: ” string.

I linked the output pin of the to-money node to the L2 pin, to show the amount of money on the second line of the display.

The patch is ready.

Press Deploy, choose the board type and upload it to the device.

Step 13: Extended Program.

You can extend the program from the previous step on your own. For example look at the attached screenshot.

How the patch can be modified?

  • Link the output of the acs712-20a-ac-current-sensor directlyto the display node to output the momentary current value on the screen without other calculations.
  • Link the output of the multiply node directly to the display node to output electrical power that is consumed right now;
  • Link the output of the integrate-dt node directly to the display node to output the accumulated consumption value;
  • Reset the counter by pressing a button. It's a good idea, but I forgot to add a place for a button on my device =). Put the button node onto the patch and link its PRS pin with the RST pin of the integrate-dt node.
  • You can create a device with a screen that is larger than 8x2 and display all parameters at the same time. If you are going to use the 8x2 screen like me, use the concat, format-number, pad-with-zeroes nodes to fit all the values into rows.

Make your own device and find out the most greedy technique at home!

You can find this device very useful in the household to save electricity.

See you soon.

Share

    Recommendations

    • PCB Contest

      PCB Contest
    • Toys Contest

      Toys Contest
    • Big and Small Contest

      Big and Small Contest

    6 Discussions

    0
    None
    provenza

    6 days ago

    is it possible to receive the "ino" code? :-)

    1 reply
    0
    None
    gabbapeople provenza

    Reply 6 days ago

    Hi!
    Xod can auto generate an “ino” code so you can upload it using Arduino IDE.
    Open the project and push the «show code for arduino” button at the menu.

    0
    None
    TheRadMan

    13 days ago

    I have two (consumer-off-the-shelf) Energy Consumption meters probably costing 66 Euros ($100 Cdn) of more. Neither of the two have the flexibility in calculation as compared to your meter.

    I have some ACS712 and I will try this in my Electronics Bench power bar.
    There are further applications such as over-current shutdown with an output relay.

    (I think) I see that the way in which you wired the 220-5V ACDC module 'behind' the ACS712 Shunt means that the Arduino-Micro is also measuring that ACDC along with the load UUT.
    That additional current may be insignificant in total current drawn (and value displayed).
    In STEP 9 first diagram, would switching? the positions of ACS712 sensor and the 5V power adapter AC input ?eliminate the (small) current drawn by that adapter in the measurements?

    I enjoyed your Steps 11 XOD IDE , 12 PROGRAM and 13 extended (math). Your library is interesting.

    I am concerned about the Safety of insulation and isolation techniques shown in Step 9 images; the potential hazards in this instructible mean that construction and assembly are for experienced or Technically Certified builders. This Instructible is well written, but the cautions in Step 9, and dressing/folding of the wires in the second image of Step 10, are important for all builders.

    In Canada, technical and political debates around smart meters mean a greater interest in "phantom electrical appliance consumption" by the general public. Although mistrust of the Power Utility providers is subject of North American Media scrutiny, Electric Power Cost metering is still a fringe mystery to most consumers. Even when they get the !surprise! at billing time.

    Interesting fact: 4 years ago, a Hydro Quebec Engineer told me that they know about 25% of all Household electric consumption comes from the mains load of the Electric Hot Water Tank Heaters.

    John (CET, 39years, Canada)

    1 reply
    0
    None
    waltercfTheRadMan

    Reply 13 days ago

    Nice instructable! I agree with John's comments. It would be better to wire the power module directly to the input line and have only the socket connected through the HAL sensor (see modified image). Also, if you are really going to pull up to 20A, it'd be better to use 12 AWG wire instead of 14. And as John points out, people need to be careful with the wiring and any exposed traces on the AC side of that sensor board.

    PowerMeasureCircuit2.jpg
    0
    None
    jiripraus

    15 days ago

    Love the detailed tutorial!

    0
    None

    This would be a great way to motivate people to save electricity.