Difference: EnergyCounter (1 vs. 5)

Revision 52015-06-18 - PedroMaiaAlves

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Energy Counter Project

Line: 153 to 153
 1429270860.000000 25.534447 124.544685 181.391650
Changed:
<
<
  • The first column have the time as reported by command "ts %.s"
  • The next columns have the average power consumption, on each phase, during the corresponding minute.
>
>
  • The first column have the time as reported by command "ts %.s". For example 1429270680.000000 corresponds to 17-4-15 12:38:00
  • The next columns have the average power consumption (in W), on each phase, during the corresponding minute.
  The data generated by the "energymeter_resample" is stored in a file and can be processed afterwards in EXCEL.
Added:
>
>
Just as an example, the following figure show the power consumption,for each minute of the day 16-Feb-2015.
 
Added:
>
>
 
Added:
>
>
  • The pulses in red on the left correspond to the heater on the children's bedroom
  • The green pulses in the middle correspond to the heater of the living room
  • The two blue rectangles starting at 15:59 is the washing machine
  • The small square wave in blue is the refrigerated chest

The next figure shows the accumulated expense (in EUROs) for the same day. This is only a "zoom" on the data corresponding to the day. The absolute value is the expense since 7-Feb-2014.

In this day there was an expense of ~€6 and we can see an increase on the rate between 9:00 and 15:00 corresponding to the time where the heater of the living room was turned on.

The last picture shows a comparison between the readings on EDP's meter (real or interpolated) in blue and the readings from the Energy Counter in green.

Readings.jpg

 
Line: 172 to 188
 
META FILEATTACHMENT attachment="IMG_1202.JPG" attr="h" comment="MOD-IO with the connections to the Energy Counters" date="1434412742" name="IMG_1202.JPG" path="IMG_1202.JPG" size="90442" user="PedroMaiaAlves" version="1"
META FILEATTACHMENT attachment="ATmegaOnDIN_1.jpg" attr="h" comment="ATmegaOnDIN installed on the eletrical box" date="1434413153" name="ATmegaOnDIN_1.jpg" path="ATmegaOnDIN_1.jpg" size="89660" user="PedroMaiaAlves" version="1"
META FILEATTACHMENT attachment="Linux_SW.jpg" attr="h" comment="" date="1434578077" name="Linux_SW.jpg" path="Linux_SW.jpg" size="29872" user="PedroMaiaAlves" version="1"
Added:
>
>
META FILEATTACHMENT attachment="PowerPhase.jpg" attr="h" comment="" date="1434584531" name="PowerPhase.jpg" path="PowerPhase.jpg" size="170611" user="PedroMaiaAlves" version="1"
META FILEATTACHMENT attachment="AccumulatedExpenses.jpg" attr="h" comment="Accumulated expense" date="1434585532" name="AccumulatedExpenses.jpg" path="AccumulatedExpenses.jpg" size="97128" user="PedroMaiaAlves" version="2"
META FILEATTACHMENT attachment="Readings.jpg" attr="h" comment="Reading from EDP's meter vs Energy Counter" date="1434589144" name="Readings.jpg" path="Readings.jpg" size="55759" user="PedroMaiaAlves" version="2"

Revision 42015-06-17 - PedroMaiaAlves

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Energy Counter Project

Line: 118 to 118
 

Data storage

Changed:
<
<
Search
>
>
This module doesn't store the data by itself. The objective is to have the data in some place where it can be quickly accessed. The following figure describes the SW architecture inside the Linux Server. Further detais in the next sub-sections.

USB to serial

The "USB to serial" adapter is a standard of-the-shelf adapter usually based on a FTDI or Prolific device. In this case the serial interface is done at TTL levels in order to skip all the TTL to/from RS-232 conversion.

Linux Driver ttyUSB

The "USB to serial" adapter is directly supported by the Linux Kernel and is mapped into a /dev/ttyUSBxxx device.

serial_hub

The serial_hub software, developed by me, has some interesting features, most of them not needed for this specific project. In general:

  • It opens a Linux character device, keeps it open and retry to open it again if it's closed on the other end
  • After opening the character device, it can run a program (usually stty) to setup the device configuration
  • Accepts multiple connections done through:
    • Raw TCP sockets
    • RFC2217/TCP sockets.
  • The data received on the character device is sent to all open sockets
  • The data received from any socket is sent to the character device.

energymeter_resample

The energymeter_resample software converts energy consumption events (pulses reported by ATmegaOnDIN) into an average power consumption report once per minute.
The output of this SW is something similar to:

1429270680.000000  25.683640 123.180953 182.124549
1429270740.000000  25.680292 123.784811 182.011305
1429270800.000000  25.534447 123.763774 182.006320
1429270860.000000  25.534447 124.544685 181.391650

  • The first column have the time as reported by command "ts %.s"
  • The next columns have the average power consumption, on each phase, during the corresponding minute.

The data generated by the "energymeter_resample" is stored in a file and can be processed afterwards in EXCEL.

 
Deleted:
<
<
-- PedroMaiaAlves - 2015-06-16
 
META FILEATTACHMENT attachment="DRS155D_1.jpg" attr="h" comment="Energy counter" date="1434402425" name="DRS155D_1.jpg" path="DRS155D_1.jpg" size="11414" user="PedroMaiaAlves" version="1"
META FILEATTACHMENT attachment="DRS155D_2.jpg" attr="h" comment="Energy counter diagram" date="1434402703" name="DRS155D_2.jpg" path="DRS155D_2.jpg" size="6848" user="PedroMaiaAlves" version="2"
Line: 131 to 171
 
META FILEATTACHMENT attachment="diagram_step2.jpg" attr="h" comment="Step 2 diagram" date="1434412498" name="diagram_step2.jpg" path="diagram_step2.jpg" size="36737" user="PedroMaiaAlves" version="1"
META FILEATTACHMENT attachment="IMG_1202.JPG" attr="h" comment="MOD-IO with the connections to the Energy Counters" date="1434412742" name="IMG_1202.JPG" path="IMG_1202.JPG" size="90442" user="PedroMaiaAlves" version="1"
META FILEATTACHMENT attachment="ATmegaOnDIN_1.jpg" attr="h" comment="ATmegaOnDIN installed on the eletrical box" date="1434413153" name="ATmegaOnDIN_1.jpg" path="ATmegaOnDIN_1.jpg" size="89660" user="PedroMaiaAlves" version="1"
Added:
>
>
META FILEATTACHMENT attachment="Linux_SW.jpg" attr="h" comment="" date="1434578077" name="Linux_SW.jpg" path="Linux_SW.jpg" size="29872" user="PedroMaiaAlves" version="1"

Revision 32015-06-17 - PedroMaiaAlves

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Energy Counter Project

Line: 116 to 116
 
    • The buzzer (just above the push-button) to warn on excessive consumption
    • The push-button is not used in this application
Added:
>
>

Data storage

 
Added:
>
>
Search
  -- PedroMaiaAlves - 2015-06-16

Revision 22015-06-16 - PedroMaiaAlves

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Energy Counter Project

Line: 89 to 89
  Some solutions are available to integrate Arduino and other similar boards on DIN rails but they are not compact.
Changed:
<
<
For this purpose I developed a small board that fits inside a 17.5mm DIN rail module which can be seen on the ATmega on DIN page.
>
>
For this purpose I developed a small board that fits inside a 17.5mm DIN rail module which can be seen on the ATmega on DIN page.
 This board is powered by 24V, has one LED, one buzzer and one button on it's front plate and has 14 GPIOs and 2 ADC inputs available.

In the context of this project, no fundamental difference on the system architecture was need when using the ATmegaOnDIN board.

Line: 113 to 113
 
  • On the front plate:
    • The green LED is on when internal power is available
    • The red LED pulses according to energy measurements
Changed:
<
<
    • The buzzer (just above the push-button) to warn on excessive consumpsion
>
>
    • The buzzer (just above the push-button) to warn on excessive consumption
 
    • The push-button is not used in this application

Revision 12015-06-16 - PedroMaiaAlves

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="WebHome"

Energy Counter Project

Everything started with the idea of measuring the energy consumption of my house mainly due to some huge electricity bill that arrived to my mailbox... My solution for the problem is based on three components:

  1. Energy Meter
  2. Real-time data capture
  3. Data storage

Energy Meter

My house has a three-phase supply and I need to measure the energy consumption on each phase independently. For my project I've used 3 x DRS155DC which I've found here http://bg-etech.de/os/product_info.php/products_id/40 but was acquired through amazon.de.

In this module the input phase is connected on connection 1 and the output phase is connected on connection 2. The neutral is connected on connections 4 and 6.

The energy measurement is done on connections 20 and 21 (in an upper level) which implements a DIN EN 62053-31 interface AKA S0-Schnittstelle. In this interface, every time 1Wh is measured by the energy counter, one pulse with a few milliseconds (>30ms) is generated.

The three energy counters were installed on the electrical box close to the main power breaker.

These pulses must be captured in real-time.

Real-time data capture

Each one of the three-phase meters will generate one pulse every time 1Wh is measured. These pulses must be counted and recorded.
On my house I have a linux "server" (EEE Box PC) which is used to record the energy consumption but can't, of course, directly capture the pulses from the energy meters.

To capture the real-time data I've use an ATmega system in two steps.

Step 1 - Olimex MOD-IO

In order to prototype the real-time data capture I've used and MOD-IO from OLIMEX.

The MOD-IO board has a lot of features but the most relevant for this application are:

  • Open source hardware board with ATMega16L-8AU microcontroller
  • 4-optocoupler isolated inputs with screw terminals
  • Input status LEDs

In this first step each energy meter was connected into one MOD-IO input and a small software generates, through the serial interface, one line for each pulse received.

The software doesn't receive anything through the serial interface and its output is something similar to:

K 0095714786
2 0095715022 0000001986 0000039514
K 0095715272
1 0095715447 0000002887 0000049680
0 0095715565 0000014099 0000050803
K 0095715815
K 0095716065

  • The first field reports in which "phase" an additional 1Wh was measured.
    • 0,1 or 2 - Phase number
    • K - Keep-alive sent after 2.5 seconds without measured consumption
  • The second field reports how much time has elapsed since the MOD-IO startup (in 1/100th of second) - 0095715022 means 11 days 1 hour 52 minutes 30.22 seconds
  • The third field reports how much time has elapsed since the last pulse - deltaT. Can be used to compute the average power = 360000 / (deltaT) in W - 1986 means 181.3W
  • The forth field reports how many pulses were already counted since MOD-IO startup

This OLIMEX MOD-IO board was just standing on the floor of the electrical box.

Step 2 - ATmega on DIN rail

After the prototyping with OLIMEX's MOD-IO this project needed some professional touch. The ATmega board must be placed directly on the electrical box just like any other standard DIN rail module, side-by-side to the breakers.

Some brief search on the Internet didn't show anything as simple as what I need for this project. My requirements were very basic:

  • Micro-controller based board
  • A solution as compact as possible (width equivalent to a power breaker would be interesting)
  • Direct access to the micro-controller GPIOs
  • Optional - Buzzer to warn on excessive power
  • Optional - LED to signal each 1Wh measured
  • Powered by 24V (available from my domotics system)

Some solutions are available to integrate Arduino and other similar boards on DIN rails but they are not compact.

For this purpose I developed a small board that fits inside a 17.5mm DIN rail module which can be seen on the ATmega on DIN page.
This board is powered by 24V, has one LED, one buzzer and one button on it's front plate and has 14 GPIOs and 2 ADC inputs available.

In the context of this project, no fundamental difference on the system architecture was need when using the ATmegaOnDIN board.

The differences are:

  • Pulses from energy meters pull the input low - Pull-up needs to be enabled on ATmega inputs
  • The LED pulses once for each energy counter measurement pulse
  • The buzzer beeps when the power on, at least, one phase exceeds a predefined limit.

No changes on the serial protocol.

This picture shows the version 1 of the board installed on the electrical box.

  • On the top side it's possible to see the connections going to the energy meters.
  • On the bottom, the UTP cable is connected to an USB to serial (TTL) adaptor
  • The red and the brown wires are connected to the 24V power distribution
  • On the front plate:
    • The green LED is on when internal power is available
    • The red LED pulses according to energy measurements
    • The buzzer (just above the push-button) to warn on excessive consumpsion
    • The push-button is not used in this application

-- PedroMaiaAlves - 2015-06-16

META FILEATTACHMENT attachment="DRS155D_1.jpg" attr="h" comment="Energy counter" date="1434402425" name="DRS155D_1.jpg" path="DRS155D_1.jpg" size="11414" user="PedroMaiaAlves" version="1"
META FILEATTACHMENT attachment="DRS155D_2.jpg" attr="h" comment="Energy counter diagram" date="1434402703" name="DRS155D_2.jpg" path="DRS155D_2.jpg" size="6848" user="PedroMaiaAlves" version="2"
META FILEATTACHMENT attachment="S0-Schnittstelle.jpg" attr="h" comment="S0 Schnittstelle picture" date="1434404279" name="S0-Schnittstelle.jpg" path="S0-Schnittstelle.jpg" size="39460" user="PedroMaiaAlves" version="1"
META FILEATTACHMENT attachment="MOD-IO-2.jpg" attr="h" comment="Olimex MOD-IO picture" date="1434406350" name="MOD-IO-2.jpg" path="MOD-IO-2.jpg" size="27688" user="PedroMaiaAlves" version="1"
META FILEATTACHMENT attachment="MetersInstalled.jpg" attr="h" comment="Installed Meters" date="1434408337" name="MetersInstalled.jpg" path="MetersInstalled.jpg" size="125596" user="PedroMaiaAlves" version="1"
META FILEATTACHMENT attachment="diagram_step1.jpg" attr="h" comment="Step 1 diagram" date="1434408653" name="diagram_step1.jpg" path="diagram_step1.jpg" size="39695" user="PedroMaiaAlves" version="1"
META FILEATTACHMENT attachment="diagram_step2.jpg" attr="h" comment="Step 2 diagram" date="1434412498" name="diagram_step2.jpg" path="diagram_step2.jpg" size="36737" user="PedroMaiaAlves" version="1"
META FILEATTACHMENT attachment="IMG_1202.JPG" attr="h" comment="MOD-IO with the connections to the Energy Counters" date="1434412742" name="IMG_1202.JPG" path="IMG_1202.JPG" size="90442" user="PedroMaiaAlves" version="1"
META FILEATTACHMENT attachment="ATmegaOnDIN_1.jpg" attr="h" comment="ATmegaOnDIN installed on the eletrical box" date="1434413153" name="ATmegaOnDIN_1.jpg" path="ATmegaOnDIN_1.jpg" size="89660" user="PedroMaiaAlves" version="1"
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback