EmonWRT

From lechacal
Revision as of 21:49, 30 April 2014 by Administrator (talk | contribs)
Jump to navigation Jump to search

EMONWRT Wifi Energy Monitoring Device with OpenWRT and Emontx.


EmonWRT is a one unit system for energy monitoring. It combines the EmonTX and a WR703N router together. Emontx sensor node interfaces with sensors like Current Transformers/ Temperature and Interrupt.

The WR703N wifi routers is used to connect to the home router (wired or wireless) and forward the data to an Emoncms server such as emoncms.org
The two units are connected together with the serial interface available on each board.


directct1temp1

directct1temp1

This is powerfull system for a small installation like a domestic house with an access to the internet.
* Simple to use with web interface for configuration.
* Connect with Wired or Wifi.
* Wall mountable.
* Single box system.
* All open source components like OpenWRT and Emontx.

directct1temp1


EmonTX: The sensor node module

The EmonWRT uses the open source EmontX V2.2 from openenergymonitor.org for its sensor interface. The only difference is the RF module not being installed. It's not needed and make the box cheaper.

The sketch can be uploaded to the board to work for the application that you need. This is a default sketch to work with CT123 and temperature together.

A quick overview of the Emontx V2
* 3 Current transformer ports.
* 1 Temperature port (DS18B20).
* 1 Interrupt port.
* 1 AC Adaptor.
* 1 FTDI port for flashing the mcu.

More info on the Emontx here


WR703N Wifi Router:

The TP-LINK WR703N Wifi router runs with OpenWRT.

The configuration of the router is quite simple using the Luci web interface that comes with OpenWRT. One can at easy configure the router to connect to a home wireless router.

Emontx and WR703N communicates together using serial communication with /dev/ttyATH0


The web interface: Configuring Data Forwarding

OpenWRT uses Luci for configuration. The EmonWRT has a page on Luci where APikey, emoncms server and node ID can be configured.

directct1temp1

Apikey is the long number that identify the account on the Emoncms server.
EmonCMS Hostname is the location of the emoncms server to use. It can either be emoncms.org or your own server.
Node ID is a number that identify the device. If you have several EmonWRT (or emontx) you can change this number here to differentiate between them on the server.

Configuration from the background.
The actual configuration is saved in a text configuration file /etc/config/emonwrt.


Arduino Sketch:

The emontx has a atmega328 which can be programmed with the Arduino IDE. To upload a sketch you will have to open the EmonWRT box and connect a FTDI/USB cable to the FTDI port on the emontx.
A basic arduino sketch can be found Here. This sketch will output CT1 2 and 3 and temperature.
If you decide to write your own sketch you need to output on serial interface the data in the following format:


EMONWRT CSV_DATA
CSV_DATA being each output field separated by a comma. Here is an example for three fields:


EMONWRT 75,45,4058
EMONWRT 79,51,4060
This format is necessary for the forwarder program in the WR703N. 

Data Forwarder script

The WR703N router has a script written in bash to grab the data from the EmonTX and send them over to the emoncms server. This script is called emonwrt_forwarder.sh
The script is launched when the WR703N boots up from /etc/rc.local.