Add environmental sensors to emon

Hi,

Is it possible to add other remote sensors to the "emon" architecture ? like remote RF board with air sensors , and to add these datas to the energy ones ? may be free slots are available by default on the "emon base" ? To have energy + CO monitoring for example, in the same time.

Many thanks for your revert

Nicolas

glyn.hudson's picture

Re: Add environmental sensors to emon

Hi Nicolas, 

Yes, its possible. The OpenEnergyMonitor system can easily accommodate more sensor nodes. Probably the easiest way to add another sensor would be to use a JeeNode/emonTx and wire in your sensor into a spare JeePort (digital and analog connections). Or alternatively you could build your own Atmega328 RFM12B sensor node from scratch: http://nathan.chantrell.net/20111229/temptx-v2-wireless-temperature-sensor-module/#more-2428.

In terms of Arduino firmware you will need to make sure your sensor is on the same frequency and network and give your sensor a node ID which is different from any other nodes on the same network, the default for the emonTx is ID 10, emonGLCD ID: 20 and emonBase ID: 15. 

You will then need to modify the emonBase code to post the data from your sensor to emoncms (see line 166): https://github.com/openenergymonitor/NanodeRF/blob/master/NanodeRF_Power_RTCrelay_GLCDtemp/NanodeRF_Power_RTCrelay_GLCDtemp.ino

Please post up what you work on, it would be great to get some documentation on site for how to wire up other environmental monitoring sensors. 

nicox's picture

Re: Add environmental sensors to emon

Thanks for all these infos, I'm working on project that will combine power datas + environmental ones too

My actual goal is to add remote boxes with RF connectivity and sensors board (temp, humidity, air quality  etc..) to the actual energy datas managed by Open Energy Monitoring archi.

Will it be possible to manage these new datas by give these an other "node ID" ? Will it be possible to not going through the Emon TX but send this datas directly to the Emon Base ?

 

Thanks for your answers

Nicolas

 

 

mharizanov's picture

Re: Add environmental sensors to emon

Thumbs up for Nathan's sensor, but also lookup the attiny84 version (also on his site) that is cheaper to build and requires less parts. I also ported Nathan's code to work with multiple DS18B20s instead of the original single TMP36, so that becomes my favorite solution for remote sensing. The Attiny works pretty well with I2C as well and you have tons of sensors on that protocol. 

glyn.hudson's picture

Re: Add environmental sensors to emon

Yes that's exactly how it will work. Just give your node its own unique node ID and the the data will be received on the emonBase once you have modified the emonBase code to take care of the data from this new node. 

Here is an example of the modifications required on the emonBase, you can call the data structure whatever you wish, I have used 'environmental' to demonstrate

 

 

typedef struct { int power1, power2, power3, voltage; } PayloadEnviromental;
PayloadEnviromental Enviromental;
 
 
In the loop:

 

 

if (node_id ==  ---INSERT NODE ID OF YOUR NODE HERE-----) /
        {
          emontx = *(PayloadTX*) rf12_data; // get data
          Serial.println(); // print data to serial
          Serial.print("1 enviromental packet rx");
          last_rf = millis(); // reset lastRF timer
          
          delay(50); // make sure serial printing finished
                               
          // JSON creation: JSON sent are of the format: {key1:value1,key2:value2} and so on
          
          str.reset(); // Reset json string
          str.print("{rf_fail:0"); // RF recieved so no failure
          str.print(",reading1:"); str.print(Enviromental.reading1); // Add power reading
          str.print(",reading2:"); str.print(Enviromental.reading2); // Add power reading
          str.print(",reading3:"); str.print(Enviromental.reading3); // Add power reading
          str.print(",voltage:"); str.print(Enviromental.voltage); // Add  battery voltage reading
    
          data_ready = 1; // data is ready
          rf_error = 0;
        }
 
To better understand how the RFM12B wireless transmission works it might be best to start out with a simple wireless transmission demo to get going: https://github.com/openenergymonitor/RFM12B_Simple

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.