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.


  1. Pingback: Blog » Blog Archive » Real-Time Energy Monitor with Arduino and LabVIEW

  2. Pingback: Mesurer et Suivre sa conso électrique

  3. Pingback: Cubietruck | Pearltrees

Leave a Reply