DIY Arduino Multifunction Energy Meter V1.0

19,731

164

20

Introduction: DIY Arduino Multifunction Energy Meter V1.0

About: I am a DIY hobbyist by passion and Power Engineer by profession. Most of my works are related to Solar Energy and Arduino. Apart from Electronics I love 3D printing, Woodworking and to make crafts from used …

In this Instructable, I will show you how to make an Arduino based Multifunction Energy Meter. This little Meter is a very useful device that displays important information on electrical parameters. The device can measure 6 useful electrical parameters: Voltage, Current, Power, Energy, Capacity, and Temperature. This device is suitable only for DC loads such as Solar PV systems. You can also use this meter for battery capacity measurement.

The Meter can measure up to voltage range from 0 - 26V and a maximum current of 3.2A.

Supplies

Components Used:

1. Arduino Pro Micro ( Amazon )

2. INA219 ( Amazon )

3. 0.96" OLED ( Amazon )

4. DS18B20 ( Amazon )

5. Lipo Battery ( Amazon )

6. Screw Terminals ( Amazon )

7. Female / Male Headers ( Amazon )

8. Perforated Board ( Amazon )

9. 24 AWG Wire ( Amazon )

10. Slide Switch ( Amazon )

Tools & Instruments Used:

1. Soldering Iron ( Amazon )

2. Wire Stripper ( Amazon )

3. Multimeter ( Amazon )

4. Electrical Tester ( Amazon )

Step 1: How It Works?

The heart of the Energy Meter is an Arduino Pro Micro board. The Arduino senses the current and voltage by using the INA219 current sensor and temperature is sensed by temperature sensor DS18B20. According to this voltage and current, Arduino does the maths for calculating power and energy.

The Whole Schematic is divided into 4 groups

1. Arduino Pro Micro

The power required for Arduino Pro Micro is supplied from a LiPo/ Li-Ion Battery through a slide switch.

2. Current Sensor

The Current Sensor INA219 is connected to the Arduino board in I2C communication mode ( SDA and SCL pin).

3. OLED Display

Similar to the current Sensor, the OLED display is also connected to the Arduino board in the I2C communication mode. However, the address for both the device is different.

4. Temperature Sensor

Here I have used the DS18B20 temperature sensor. It uses a one-wire protocol to communicate with the Arduino.

Step 2: Breadboard Testing

First, we will make the circuit on a Breadboard. The main advantage of a solderless breadboard is that it’s, solderless. Thus you can easily change the design just by unplugging components and leads as you need to.

After making the breadboard testing, I made the circuit on a Perforated Board

Step 3: Prepare the Arduino Board

The Arduino Pro Micro comes without soldering the headers pin. So you have to solder the headers into the Arduino first.

Insert your male headers long-side-down into a breadboard. Now, with the headers installed, you can easily drop the Arduino board into place on top of the headers pin. Then solder all the pins to the Arduino Board.

Step 4: Prepare the Headers

To mount the Arduino, OLED display, current sensor, and temperature sensor, you need some female straight headers pin. When you purchase the straight headers, they'll be too long for the components to be used. So, You'll need to trim them down to an appropriate length. I used a nipper to trim down it.

Following are the details about the headers :

1. Arduino Board - 2 x 12 pins

2. INA219 - 1 x 6 pins

3. OLED - 1 x 4 pins

4. Temp. Sensor - 1 x 3 pins

Step 5: Solder the Female Headers

After preparing the female headers pin, solder them to the perforated board. After soldering the header pins, check whether all the components fit perfectly or not.

Note: I will recommend solder the current sensor directly to the board instead of through the female header.

I have connected through the header pin for reusing the INA219 for other projects.

Step 6: Mount the Temperature Sensor

Here I am using the DS18B20 temperature sensor in the TO-92 package. By considering the easy replacement, I have used a 3 pin female header. But you can directly solder the sensor to the perforated board.

Step 7: Solder the Screw Terminals

Here screw terminals are used for external connection to the board. The external connections are

1. Source ( Battery / Solar Panel )

2. Load

3. Power supply to Arduino

The blue screw terminal is used for power supply to the Arduino and two green terminals are used for source and load connection.

Step 8: Make the Circuit

After soldering the female headers and screw terminals, you have to join the pads as per the schematic diagram shown above.

The connections are pretty straight forward

INA219 / OLED -> Arduino

VCC -> VCC

GND - > GND

SDA -> D2

SCL-> D3

DS18B20 -> Arduino

GND - > GND

DQ -> D4 through a 4.7K pull-up resistor

VCC -> VCC

At last, connect the screw terminals as per the schematic.

I have used 24AWG colored wires to make the circuit. Solder the wire as per the circuit diagram.

Step 9: Mounting the Standoffs

After soldering and wiring, mount the standoffs at 4 corners. It will provide sufficient clearance to the soldering joints and wires from the ground.

Step 10: PCB Design

I have designed a custom PCB for this project. Due to the current pandemic COVID-19 situation, I am not able to place an order for this PCB. So I have not tested the PCB yet.

You can download the Gerber files from PCBWay

When you place an order from PCBWay, I will get a 10% donation from PCBWay for a contribution to my work. Your little help may encourage me to do more awesome work in the future. Thank you for your cooperation.

Step 11: Power and Energy

Power: Power is the product of voltage (volt) and current (Amp)

P=VxI

Unit of power is Watt or KW

Energy: Energy is the product of power (watt) and time (Hour)

E= Pxt

Unit of Energy is Watt Hour or Kilowatt Hour (kWh)

Capacity: Capacity is product of Current (Amp) and time (Hour)

C = I x t

Unit of capacity is Amp-Hour

To monitor the power and energy above logic is implemented in software and the parameters are displayed in a 0.96-inch OLED display.

Image credit:imgoat

Step 12: Software and Libraries

First, download the code attached below. Then download the following libraries and install them.

1. Adafruit INA219 Library

2. Adafruit SSD1306 Library

3. DallasTemperature

After install all the libraries, set the correct board and COM port, then upload the code.

Step 13: Final Testing

To test the board, I have connected a 12V battery as a source and a 3W LED as a load.

The battery is connected to the screw terminal below the Arduino and LED is connected to the screw terminal below the INA219. The LiPo battery is connected to the blue screw terminal and then switch ON the circuit by using the slide switch.

You can see all the parameters are displaying on the OLED screen.

The parameters in the first column are

1. Voltage

2. Current

3. Power

The parameters in the second column are

1. Energy

2. Capacity

3. Temperature

To check the accuracy I used my multimeter and a Tester as shown above. The accuracy is close to them. I am really satisfied with this pocket-sized gadget.

Thanks for reading my Instructable.
If you like my project, don't forget to share it. Comments and feedback are always welcome.

Pocket-Sized Speed Challenge

Participated in the
Pocket-Sized Speed Challenge

Be the First to Share

    Recommendations

    • Box Challenge

      Box Challenge
    • Furniture Contest

      Furniture Contest
    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest

    20 Comments

    0
    Andrei252
    Andrei252

    5 months ago

    Hi, how can I make the change from OLED 0.96" to oled 1.3" . I know not to change only in one place, I searched but I did not find how I could change. Thanks
    0
    luqmannh.ismail
    luqmannh.ismail

    Question 5 months ago on Step 13

    hello sir, it that can use Arduino Wemos D1 for this project?? Or must use Arduino Pro Micro only??

    0
    Larrysch
    Larrysch

    Question 10 months ago on Introduction

    Have you considered making a board for this project? Looks good!

    larry

    0
    mridgley
    mridgley

    Question 11 months ago on Step 9

    What is the status of your PCB for this project? Are they now available?

    0
    opengreenenergy
    opengreenenergy

    Answer 10 months ago

    Yes, now it is available.
    You can buy or download it from PCBWay.

    0
    banman11
    banman11

    Question 11 months ago

    This looks like a very good project.

    Question, can this device be used like a data logger?
    That is to say, it would be very useful indeed if you could record the daily, even monthly readings from say a solar array and have that data accessed off location by wifi to a spreadsheet based application for detailed analysis.
    Do you have code for that?

    1
    opengreenenergy
    opengreenenergy

    Answer 11 months ago

    Thank You.
    Yes, it can be modified for the data logger.
    I will write a separate instructables for data logging and remote monitoring through the smartphone. Please keep in touch.

    0
    banman11
    banman11

    Reply 11 months ago

    Thanks. I will be very interested in seeing this....

    0
    Zero2019
    Zero2019

    11 months ago

    is there any way that this could be modded so it dose A instead of mA? As well what is the upper limit for it to read for amps?

    0
    KarlTorp
    KarlTorp

    Reply 11 months ago

    It should not be hard to modigt the code to show A instead of mA. The limit of the standard resistor is 3.2 A for the sensor. But by replacing it with a smaller resistor you can measure larger current - but with smaller resolution.

    2
    RaymondR6
    RaymondR6

    11 months ago

    "Unit of Energy is Watt Hour or Kilowatt Hour (kWh)"

    Not true. The real unit of energy is the Joule, which is one watt-second:
    E= Pxt
    Where E is in joules, P is in watts, and t is in seconds.
    If we convert the common but erroneous kilo-watt-hour (kWh) into joules, we get 3.6 x 10^6 J, or 3.6 megajoules. Since your sensor is measuring small amounts of power and energy, , it is much more correct to express it as joules.

    Also: "Unit of capacity is Amp-Hour"

    Not true. The real unit is capacity or charge is the Coulomb which is one amp-second. A current of one ampere flowing for one second delivers one coulomb of charge. But this is a unit that very little laypersons use. Mostly Physicists and Engineers use it. And that amp-hour is equal to 3.6 x 10^3 C or 3.6 kilo-coulomb.

    0
    RomasP
    RomasP

    Reply 11 months ago

    From point of physics you are absolutely right but from point of real life you are wrong. No one care about power in joules except only several pulsed power things - strobe lamp, gun, some arresters power, etc . In all real life electrical applications only Watt, Watt-Hour, Amp-Hour mater. Battery producers capacity gives only in Amp-Hour. So I think not to mention not usable in real life units is not big deal

    0
    opengreenenergy
    opengreenenergy

    Reply 11 months ago

    You are correct. Thank you.

    0
    ardu11
    ardu11

    Reply 11 months ago

    Very good.

    0
    meanblackbike
    meanblackbike

    11 months ago

    You can use the arduino and make a solar concentrator on your solar cell. So the DS18B20 can give you max temp - to avoid damage.
    You will need to use precise aiming to the Sun of that concentrator but you shall get 8x more el. power - and no need of heat sink - enjoy.

    0
    opengreenenergy
    opengreenenergy

    Reply 11 months ago

    Thank you for your suggestion.

    0
    pemazzei
    pemazzei

    11 months ago

    Really good! And very usefull! Paulo, Brazil