Real-Time Energy Monitor with Arduino and LabVIEW

By on August 19, 2011
Pin It

We present the candidature of Mr. Michele Mancini for the TiDiGino Contest. He proposes us a recent application with Arduino: Real-Time Energy Monitor

This is a simple power meter to analize the current consuming in a house using the led indicator of a house energy meter.

Reading the red led of a home energy counters the system detects the corrent consumption in a house.

It is a noninvasive method, not cut wire, no current disconnects, so a very interesting method…
The system consists of two parts: the Arduino board that detects the led pulses and sends the data via the XBee module, and a PC that recive the data through a USB/Xbee module and processes the data with LabVIEW so you can prepare and study the consumption in a very instant.
Arduino sends two datas to the PC:
1 – Real time datas
2 – Average consumption measured in a time of 5 minutes.


From the picture we see that the LED that indicates the current consumption is the red LED near to the display. In particular is the LED superior.

Arduino module
To detect the LED blinking you have to apply a simple photoresistor above the led and covered it with black tape. To read the analog voltage using the Arduino you have to use a resistive divider as shown in diagram:

The LED blinking causes the voltage drop down and this value is read by Arduino and compared with the voltage acquired by the potentiometer connected in the channel A0. This potentiometer has the task to adjust the sensitivity threshold.
The read data are processed from the sketch and then sends to the PC via Xbee module.

The Arduino code acquisition is as follows:

With this code Arduino acquires the two voltages, the photoresistor voltage compared with the voltage of the potentiometer, if the value is greater than the sketch actives the flag “flag_acquire = 1”, then read how much time has passed to another flash.
To do this use arduino to read a statement in an internal counter that returns the milliseconds since power on. The instruction is “millis ()” code here:

There are 2 variables pre_tmS and cur_tmS, “cur_tmS” needs to read the current value of the internal counter: cur_tmS = millis (); Then if the condition (cur_tmS> pre_tmS) is true, I note the elapsed time between cycles, ie between the LED ON and the next cycle of the LED ON and write it on the variable “pre_tmS”. Now we have to send to the PC via the serial port using XBee with these instructions:

First Arduino sends a marker “S” used to labview to recognize that this value is part of the reading that real-time instant, then send the value in milliseconds elapsed. Now you have to reset the flag when the LED goes OFF using this statement:

You have to check the voltage acquired by the sensor, if it falls below the potentiometer value and the flag is active “flag_acquire == 1” then you have to reset the flag. Note that the statement “impulsi++;” is simply a counter that counts the cycles of the LED power meter, this is to make an average energy consumed every 5 minutes. The third task is similar to the first task, wait 1 second, and increments the counter “time_flag++,” which is the fourth task of counting 300secondi (5 minutes). In addition, this task blinks the LED connected to pin 12 at a rate of 1 second.
The fourth task as mentioned above waiting 5 minutes and then sent via serial marker “L” is used to program labview to recognize that the data sent is the data on the average found in 5 minutes.


The sketch


LABVIEW interface
To recive the data we use the XBee UartSbee V3.1 module from Futura Elettronica.

The interface created in LabVIEW is simple to use:

As can be seen from this figure, the top graph shows the average consumption every 5 minutes, while the bottom graph shows the real-time energy consumption. It ‘can save the data using the device as a data logger.


Download ZIP File  Arduino Sketch
 Download ZIP File  LabVIEW (VI file)
 Download ZIP File  Schematics (eagle file)

About Boris Landoni

Boris Landoni is the technical manager of Skilled in the GSM field, embraces the Open Source philosophy and its projects are available to the community.
  • Pingback: Blog » Blog Archive » Real-Time Energy Monitor with Arduino and LabVIEW()

  • Pingback: Mesurer et Suivre sa conso électrique()

  • Neit

    Can You answer on this questions, please:
    How this program on LabView can count Energy of any energy meters, if they are have individual constant (Impulses/(1Kw*h))?
    Whats correlation between Energy (W*h) and Time of one impulse (ms)?
    PS: Sorry for my bad english :)

    • BorisLandoni

      This sketch is specific for Italian Energy meter. You have to adapt it for your Energy meter.

      • Neit

        Thanks for information, I does not known it.
        I got this formula:
        A – constant of energy meter (impulses/Kw*h).
        t – time of one impulse
        (I write it here, if anybody will need in future)
        So, constant for Your energy meter is 1000 (impulses/Kw*h).
        PS: Is it energy meter on image №2?! When I saw this, I thought that is self-made energy meter made from shell of the hard drive!

        • BorisLandoni

          Thank you.

  • ShaamN

    day! Please tell me how to work photoresistor in this scheme (as I know
    the photoresistor slow response) On what the maximum load power meter
    tested this device?

    • BorisLandoni

      The led don’t blink too fast

  • suma
  • Pingback: Cubietruck | Pearltrees()

  • Matteo

    Hi!! I have a question.. How can we link xbee receiver module to pc?

  • Michael Nicholson

    Thanks for info, but I have a question
    how I do connect two and more power meters to arduino?