Wednesday, September 19, 2012

Using Nanode RF and emonCMS for Remote Control and Monitoring

For the last couple of years I have been looking at simple low cost methods of measuring analogue data - such as that from temperature or humidity sensors placed around the house and getting that data up to a cloud based server for datalogging and visualisation.

With the introduction of the Nanode RF last September, and working cooperatively with Trystan Lea and Glyn Hudson of openenergymonitor.org, we have managed to send data from a variety of wireless sensors to   their emonCMS server.  Trystan and Glyn developed this platform mainly for logging and visualising electricity data - both consumption and generation from PV,  but the versatile open source server can be applied to a wide variety of monitoring and control tasks.

A typical system consists of one or more wireless sensors, which collect analogue or pulse data and send this  wirelessly to the Nanode RF - which acts as a basestation.  Nanode RF runs a multinode sketch, which allows it to receive data from any wireless sensors that are in range.  These sensors have a node ID from 1 to 30 and can be arranged into different groups.  Provided that the sensors don't all try to transmit at once, and a certain time randomness should be included into their transmission slots, the Nanode RF receivers their individual data and posts it up to the emonCMS platform - where it can be manipulated, graphed and visualised.

As well as electricity data, emonCMS has been used for heat-pump monitoring and bee hive temperature monitoring.

Now a little documented feature of emonCMS is that the last posted value of a feed can be requested by the Nanode RF. This feed value can generally be a 16-bit integer - for easy interpretation by the Nanode, and with suitable decoding can be used to control the hardware either on the Nanode RF, or any of the wireless nodes connected to it.

It is a relatively simple matter to create a web dashboard which contains switches and rotary controls - allowing different parameters to be sent to the Nanode RF, or any of it's connected nodes.  A simple example would be a RGB LED lamp, connected to pwm pins on the Nanode controlled remotely from sliders or knobs on the dashboard.

Trystan's code for reading a feed value is here on GitHub. - example g in the Guide.

An extension to this is to get the Nanode RF to send the feed value as an RF packet out to the wireless nodes. A simple hack was done using one of Trystan's graphical LCD display units which feature a pair of bicolour LEDS.  Sending a feed value of 0,1,2 or 3 allows you to remotely control the colour of the LEDs from the server - and because we are using the RFM12 - the distance between the base station and the wireless node can be quite large - better than 200m in open field conditions or 100m or so in a built up street.

If you want to experiment with this you just need to put the following line of text into your browser's URL window

http://emoncms.org/api/post?apikey=8795903a6c0611123007be8abef16e60&json=power:1

By changing the value of power from 0 to 3, this causes the colour of the  LEDs on my emonGLCD to change.  You can send me feedback on Twitter @monsonite - I'm going to get a proper control dashboard set out, but for the moment it proves the point.

More complex controls, for individually accessing the I/O pins of remote RF nodes could readily be devised, allowing each such node to be accessed from it's Node ID.  The read apikey ensures that your feeds are safe and cannot be tampered with - without having the apikey, the correct password and username.

This system makes it very simple to incorporate the monitoring and logging of room temperatures - from RF nodes - including WiNode, JeeNode - and the new very small, ATTiny84A based Funky,  another RFM12B compatible node. At the same time, relay outputs connected to these nodes could be used to turn on central heating, open or close radiator valves, or switch on or off electrical appliances - all from the web accessible platform - using laptop or even an app running on a smart phone.

In the 18 months that Nanode has been around, it has gone from strength to strength, and is now appearing in various compatible versions from new suppliers. The latest is the Micro IoT Gateway from Harizanov.com. This will make a great RF gateway, but just needs a RFM12 fitted to make it compatible with Nanode, Openenergymonitor and JeeNodes.

Watch out for an important announcement regarding an exciting Nanode new product towards the end of next week.


No comments:

Post a Comment