EMONWRT3: Difference between revisions

From lechacal
Jump to navigation Jump to search
 
(140 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Image: IMG_1488_small.png | right]]
 
[[Image: Emonwrt3_enclosure_draw.png | right]]
[[Image:Emonwrt3_principle_draw_01.png| right]]


=Project Progress=
=Project Progress=


This page is for a product in current development. We expect the first units to be ready around mid May 2018.
Hardware units are now ready and can be purchased [http://lechacalshop.com/gb/internetofthing/49-emonwrt3ct1v1t1base.html here].


Software is operational and new features are continuously being added. This has support for Emoncms and Influxdb and Json requests. <br>
Do not hesitate to inform us of the remote service you wish to see included here.


=EmonWRT3 Wifi Energy Monitoring Device with OpenWRT<br />=
=EmonWRT3 Wifi Energy Monitoring Device with OpenWRT=


'''''<br />'''''
[[Image: IMG_1528_small.png | right | 300px]]


[[EmonWRT | Earlier version here]]
[http://lechacalshop.com/gb/internetofthing/49-emonwrt3ct1v1t1base.html Link to the shop.]
 
[http://lechacalshop.com/gb/internetofthing/1-emonwrt.html Buy it online here.]


EmonWRT3 is a one unit system for energy monitoring. It measures usage of an electrical installation and post data on a server (Emoncms or other). You can then view the data on your computer or phone.
EmonWRT3 is a one unit system for energy monitoring. It measures usage of an electrical installation and post data on a server (Emoncms or other). You can then view the data on your computer or phone.


It combines the Arduino based microcontroller and OpenWRT wifi module together. EmonWRT3 interfaces with sensors like Current Transformers/ Temperature and Voltage.
It combines the Arduino based microcontroller and OpenWRT wifi module together. EmonWRT3 interfaces with sensors like Current Transformers/ Temperature and Voltage.
[[Image:diagram_small.png|directct1temp1]]<br />


* Simple to use with web interface for configuration.<br />  
* Simple to use with web interface for configuration.<br />  
* Connect with Wired or Wifi.<br />
* Connect with Wired or Wifi.<br />
* Wall mountable.<br />  
* Wall mountable.<br />  
* Single box system.<br />
* Store and retry send feature.
* Measures AC current and voltage.
* Measures Temperature.
* Computes Vrms, Irms,  Real Power, Apparent power, Power Factor.
* Open source components OpenWRT and Arduino.
* Open source components OpenWRT and Arduino.
* Emoncms Influxdb support.


EmonWRT vs Raspberry Pi. The main motivation for developing the EmonWRT was to increase robustness. For the long run the RaspberryPi solution can become vulnerable due to the operating system hosted on a SD card. High quality SD cards can be used but a higher risk of failure still remains. The EmonWRT contains the operating system on an embedded flash memory and will solidly keep on running.
=Data Storage=
 
==Emoncms==
 
From the web interface the user can enter the hostname and apikey of the Emoncms account. More than one service can be added if needed.
 
==Influxdb==
 
The Influxdb details can be setup in the device web interface. More than one service can be added if needed.
 
==Json request==
 
The device can be queried directly to obtain the data locally stored. A simple GET call will return a Json formatted data string.
This is an example of the json call
http://OpenWrt/cgi-bin/emonwrt3-json?last=2
 
will return the last 2 samples read as a json array like
[{"timestamp": 1528977907,"Vrms": 246.71,"P1": 1.83,"P2": 16.00,"P3": 4.16,"Temperature": 19.58},
{"timestamp": 1528977897,"Vrms": 246.82,"P1": 1.42,"P2": 14.44,"P3": 7.36,"Temperature": 19.64}]


=Technical Specifications=
=Technical Specifications=


 
[[File:IMG_1521_small.png | right | 400px]]
[[File:dIMG_0856_small.jpg | right | 400px]]


* 3 Current Sensor Ports
* 3 Current Sensor Ports
* 1 AC/AC Volatege Port
* 1 AC/AC Voltage Port
* 1 Temperature Sensor Port
* 1 Temperature Sensor Port


Line 55: Line 73:


===Defaults===
===Defaults===
IP Address (LAN): 192.168.2.1<br />
IP Address (Wired LAN): 192.168.2.1<br />
IP Address (WAN): DHCP<br />
Username: root<br />
Username: root<br />
Password: To be set on first use.<br />
Password: admin or 'To be set on first use'.<br />


=Hardware=
=Hardware=
[[File:IMG_1535_small.png | 300px]]
==Base Board==
* [http://lechacalshop.com/gb/internetofthing/49-emonwrt3ct1v1t1base.html Link to the shop].
[[File:IMG_1488_small.png | 300px]]
This is the key central board which
* host the SKW71 module.
* hosts the sensor ports.
* Embed the Arduino microcontroller.
* Power the system from the micro USB.
* Avail ethernet connection.
This first unit is CT3V1T1 as for 3 CT 1 Voltage and 1 temperature sensors.
==SKW71 Module==
* [http://lechacalshop.com/gb/various/21-skylab-skw71.html Link to the shop]
[[File:Skw71_pic01.jpg | 225px]]
The SKW71 module from Skylab runs the operating system OpenWrt.


The EmonWRT3 is made of the following components.
* Wifi enabled
* Runs the Emonwrt3 software
* Collect acquired data from Arduino
* Forward to Emoncms/Influxdb/Thingspeak


* EmonWRT3 CT3V1T1 Base Board
[[File:S-l300.jpg | right]]
* Skylab SKW71 Wifi Module (OpenWRT)
* Atmega328 Microcontroller (Arduino)
* 3D printed enclosure.


The SKW71 modules has two antenna options.
===PCB Antenna===
The antenna is internal and does not require any other parts. This usually a good option if other connecting devices are in a good range.
===External Antenna===
[http://lechacalshop.com/gb/various/51-wifi-antenna-01.html Link to the shop]
If a stronger range is needed this can be a good option. Two additional components will be required.
* 1 U.FL IPX to SMA cable.
* 1 SMA Antenna.
The U.FL IPX connector fits on the SKW71 module.
==Enclosure==
* [http://lechacalshop.com/gb/internetofthing/50-enclosure-kit-for-emonwrt3.html Link to the shop].
[[Image: IMG_1536_small.png | 300px]]
Enclosure is 3D printed. 60mm square size with 2 wall mount hole.
Two M3 screws hold the assembly together.
Overall dimension 80x60x27mm


=Internal Dataflow=
=Internal Dataflow=
Line 74: Line 133:
Internally the Arduino mcu collects data from sensors on the ADC port and transmit them to the OpenWRT module via serial interface.  
Internally the Arduino mcu collects data from sensors on the ADC port and transmit them to the OpenWRT module via serial interface.  


Then the OpenWRT module transfer all data to the specified web server (Emoncms, InfluxDB etc...) using conventional ethernet protocols.
Then the OpenWRT module transfer all data to the specified web server (Emoncms, InfluxDB etc...) using conventional HTTP protocols.


The configuration of the unit is using the Luci web interface that comes with OpenWRT. One can at easyly configure the EmonWRT to connect to a wireless network.
The configuration of the unit is using the Luci web interface that comes with OpenWRT. One can easyly configure the EmonWRT to connect to a wireless network.


=Configuration=
=Configuration=


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


[[Image:web_emonwrt_small_02.png]]
All configuration can be done from the luci interface provided by OpenWRT.  


'''''Apikey''''' is the long number that identify the account on the Emoncms server. It can be found on the emoncms server in the API help page. The Read & Write apikey key should be copy pasted here.<br />
===Output Channels===
'''''EmonCMS Hostname''''' is the location of the emoncms server to use. It can either be emoncms.org or your own server. If using your own emoncms server you might need to indicate the full path here. e.g. ''192.168.1.50/emoncms/''<br />
'''''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.<br />


All channels are acquired and computed from the Arduino micro-controller. The configuration of the Arduino device is achieved with the web interface shown below.


===Background Configuration===
NOTICE. When submitting this page you will have to wait at least 30 to 45 seconds. This is due to the microcontroller restarting to write the data to eeprom.


The actual configuration is saved in a text configuration file /etc/config/emonwrt3.
[[Image:Emonwrt3_web_03.png]]


==Arduino Sketch==
===Stream ouput===


The emontx has an attiny84 mcu which can be programmed with the Arduino IDE. To upload a sketch you will have to open the EmonWRT box and connect an avr programmer to the SPI port on the EmonWRT. The default arduino sketch can be found on this page. The library from OEM is also needed for this. It can be found [https://github.com/openenergymonitor/EmonLib here].<br /> <br />
The EmonWRT3 aims to output data to various remote services. Emoncms and Influxdb are supported. This can be configured from the page below:


===Serial String Format===
[[Image:emonwrt3_04.png | 800px]]


If you decide to write your own sketch you need to output on serial interface the data in the following format:
===Background Configuration===


EMONWRT CSV_DATA
The actual configuration is saved in a text configuration file /etc/config/emonwrt3.


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


EMONWRT 75,45,4058
[[File:Mesh_diag.png | right]]
EMONWRT 79,51,4060


This format is necessary for the forwarder program in the WR703N. <br />
Using the powerful Operating System OpenWRT the EmonWRT3 supports mesh networking.


===Data Forwarder script===
Neighbouring units will connect together using ad-hoc wifi to build a network where only one unit may have access to the outer world wide web (or other network).


The WR703N router has a script written in bash to grab the data from the Arduino mcu and send them over to the emoncms server. This script is called emonwrt_forwarder.sh. You can download it below.<br />
One Emonwrt3 device will be connected to the network so long as it is in range of at least one other unit already connected to the mesh network.
The script is launched when OpenWRT boots up using init.d mechanism.


=RF Gateway=
Follow this guide to enable mesh networking on the EmonWRT3.


Previous version of EmonWRT used to have RF gateway. Due to lack of interest we have removed this option. Get in touch with us if you need a similar solution.
[[Mesh networking on OpenWRT 15.05 with OLSR]].


=Files=
<br clear=all>


[http://lechacal.com/EMONWRT2/EmonWRT2_default_attiny_v1_0.ino Default Attiny84 Sketch]<br />
=User Manual=


=Howtos=
[[First Use]]


[[Startup_guide_emonwrt | Startup Guide]]
[[Emonwrt3 Web Interface]]


[[update_emonWRT| (old) Install/Update EmonWRT on WR703N]]
[[Emonwrt3 Network Configuration]]


[[update_emonWRT_from1.5 | (New) Install/Update EmonWRT on WR703N]]
[[Emonwrt3 Upgrade Software]]


[[forwarder_debug| Start the forwarder in debug mode]]
[[Emonwrt3 Advanced Usage]]


[[FIRMWARE_UPLOAD_EMONWRT2 | Upload Firmware]]
=Files=


[[Timeout for some wifi connections]]
[http://lechacal.com/Emonwrt3/EmonWRT3_CT3V1T1_v1.0.ino CT3V1T1 Sketch V1.0]<br />
[http://lechacal.com/Emonwrt3/EmonWRT3_CT3V1T1_v2.0.ino CT3V1T1 Sketch V2.0]<br />
[http://lechacal.com/Emonwrt3/EmonWRT3_CT3V1T1_v2.1.ino CT3V1T1 Sketch V2.1]<br />
[http://lechacal.com/Emonwrt3/EmonWRT3_CT3V1T1_v2.2.ino CT3V1T1 Sketch V2.2]<br />


=Version History=
=Version History=
==Package==
===v1.1.0===
* Uses RPICTlib. Must run with sketch 2.1.
===v1.0.3===
* Changed the way data are recorded on InfluxDB. The name of the influxdb stream is now used as field. Only upgrade is you are ready to accept this formatting change.
===v1.0.2===
* Adapted code for Raspberrypi build.
===v1.0.1===
* Added Monitor page to view lastest 5 data records.<br>
* Fixed bug in json output.
===v1.0.0===
* First version


==Sketch==
==Sketch==
===1.6===
===v2.1===
 
* Phasecal now operational.
==EmonWRT Software==
* Must run with emonwrt3 v1.1.0 software.
===1.3===
===v2.0===
* Support for OpenWRT Attitude Adjustment
* Now uses [[RPICTlib]].  
 
* Note that Phasecal is hard coded to 0. A new version will follow to allow change of phasecal.
===1.4===
* Support for OpenWRT Barrier Breaker


[[Image: dIMG_0849_small.jpg]]
===v1.0===
* First version.

Latest revision as of 14:45, 26 April 2020

Project Progress

Hardware units are now ready and can be purchased here.

Software is operational and new features are continuously being added. This has support for Emoncms and Influxdb and Json requests.
Do not hesitate to inform us of the remote service you wish to see included here.

EmonWRT3 Wifi Energy Monitoring Device with OpenWRT

Link to the shop.

EmonWRT3 is a one unit system for energy monitoring. It measures usage of an electrical installation and post data on a server (Emoncms or other). You can then view the data on your computer or phone.

It combines the Arduino based microcontroller and OpenWRT wifi module together. EmonWRT3 interfaces with sensors like Current Transformers/ Temperature and Voltage.

  • Simple to use with web interface for configuration.
  • Connect with Wired or Wifi.
  • Wall mountable.
  • Store and retry send feature.
  • Measures AC current and voltage.
  • Measures Temperature.
  • Computes Vrms, Irms, Real Power, Apparent power, Power Factor.
  • Open source components OpenWRT and Arduino.
  • Emoncms Influxdb support.

Data Storage

Emoncms

From the web interface the user can enter the hostname and apikey of the Emoncms account. More than one service can be added if needed.

Influxdb

The Influxdb details can be setup in the device web interface. More than one service can be added if needed.

Json request

The device can be queried directly to obtain the data locally stored. A simple GET call will return a Json formatted data string. This is an example of the json call

http://OpenWrt/cgi-bin/emonwrt3-json?last=2

will return the last 2 samples read as a json array like

[{"timestamp": 1528977907,"Vrms": 246.71,"P1": 1.83,"P2": 16.00,"P3": 4.16,"Temperature": 19.58},
{"timestamp": 1528977897,"Vrms": 246.82,"P1": 1.42,"P2": 14.44,"P3": 7.36,"Temperature": 19.64}]

Technical Specifications

  • 3 Current Sensor Ports
  • 1 AC/AC Voltage Port
  • 1 Temperature Sensor Port
  • 1 Ethernet Port
  • 1 MicroUSB Power Supply port
  • Operating System: OpenWRT Chaos Calmer
  • Micro Controller Unit: AtMega328 (Arduino)
  • Wifi (internal or external antenna)
  • PCB Dimensions: 55x55mm
  • Enclosure Dimension: 80x60x27mm

Recommended Sensors

Current: SCT-013-000
Temperature: DS18B20
AC/AC Adaptor: 77DB-06-09 77DE-06-09 77DA-10-09

Defaults

IP Address (Wired LAN): 192.168.2.1
Username: root
Password: admin or 'To be set on first use'.

Hardware

Base Board

This is the key central board which

  • host the SKW71 module.
  • hosts the sensor ports.
  • Embed the Arduino microcontroller.
  • Power the system from the micro USB.
  • Avail ethernet connection.

This first unit is CT3V1T1 as for 3 CT 1 Voltage and 1 temperature sensors.

SKW71 Module

The SKW71 module from Skylab runs the operating system OpenWrt.

  • Wifi enabled
  • Runs the Emonwrt3 software
  • Collect acquired data from Arduino
  • Forward to Emoncms/Influxdb/Thingspeak

The SKW71 modules has two antenna options.

PCB Antenna

The antenna is internal and does not require any other parts. This usually a good option if other connecting devices are in a good range.

External Antenna

Link to the shop

If a stronger range is needed this can be a good option. Two additional components will be required.

  • 1 U.FL IPX to SMA cable.
  • 1 SMA Antenna.

The U.FL IPX connector fits on the SKW71 module.


Enclosure

Enclosure is 3D printed. 60mm square size with 2 wall mount hole. Two M3 screws hold the assembly together.

Overall dimension 80x60x27mm

Internal Dataflow

Internally the Arduino mcu collects data from sensors on the ADC port and transmit them to the OpenWRT module via serial interface.

Then the OpenWRT module transfer all data to the specified web server (Emoncms, InfluxDB etc...) using conventional HTTP protocols.

The configuration of the unit is using the Luci web interface that comes with OpenWRT. One can easyly configure the EmonWRT to connect to a wireless network.

Configuration

The web interface

All configuration can be done from the luci interface provided by OpenWRT.

Output Channels

All channels are acquired and computed from the Arduino micro-controller. The configuration of the Arduino device is achieved with the web interface shown below.

NOTICE. When submitting this page you will have to wait at least 30 to 45 seconds. This is due to the microcontroller restarting to write the data to eeprom.

Stream ouput

The EmonWRT3 aims to output data to various remote services. Emoncms and Influxdb are supported. This can be configured from the page below:

Background Configuration

The actual configuration is saved in a text configuration file /etc/config/emonwrt3.

Mesh Networking

Using the powerful Operating System OpenWRT the EmonWRT3 supports mesh networking.

Neighbouring units will connect together using ad-hoc wifi to build a network where only one unit may have access to the outer world wide web (or other network).

One Emonwrt3 device will be connected to the network so long as it is in range of at least one other unit already connected to the mesh network.

Follow this guide to enable mesh networking on the EmonWRT3.

Mesh networking on OpenWRT 15.05 with OLSR.


User Manual

First Use

Emonwrt3 Web Interface

Emonwrt3 Network Configuration

Emonwrt3 Upgrade Software

Emonwrt3 Advanced Usage

Files

CT3V1T1 Sketch V1.0
CT3V1T1 Sketch V2.0
CT3V1T1 Sketch V2.1
CT3V1T1 Sketch V2.2

Version History

Package

v1.1.0

  • Uses RPICTlib. Must run with sketch 2.1.

v1.0.3

  • Changed the way data are recorded on InfluxDB. The name of the influxdb stream is now used as field. Only upgrade is you are ready to accept this formatting change.

v1.0.2

  • Adapted code for Raspberrypi build.

v1.0.1

  • Added Monitor page to view lastest 5 data records.
  • Fixed bug in json output.

v1.0.0

  • First version

Sketch

v2.1

  • Phasecal now operational.
  • Must run with emonwrt3 v1.1.0 software.

v2.0

  • Now uses RPICTlib.
  • Note that Phasecal is hard coded to 0. A new version will follow to allow change of phasecal.

v1.0

  • First version.