Temperature and Current Monitoring with OpenEnergyMonitor

Submitted by admin on

Overview

The goal is to read a temperatures sensor via a OneWire network and display this on a webpage.

An Arduino reads the sensors and 'publishes' other Ethernet (or Wifi) the data using the MQTT protocol. See "Arduino".

A MQTT broker acts as a server to handle the messages. See "mosquitto" and "MQTT"

A linux machine running EmonCMS subscribes to correctly formatted and authenticated messages, and displays then in a webpage.

Installation

Arduino - collect temperatures

This page http://guide.openenergymonitor.org/technical/mqtt/ details how EmonCMS will expect the temperatures.

The topic should be, for example: emon/emontx/temp1

... and the message should be, for example, 20.40

My sample sketch is attached. For ease of use I didn't use authentication.

Mosquitto and MQTT

Can be installed anywhere on the local network, but usually it's best to install on the EmonCMS server. You need to use a static IP address for the install machine so client services now where it is.

There appear to be two incompatible versions: V3.1 and V3.11. Use the v3.11 version.

This is installed together with EmonCMS (see below).

Use mosquitto_pub and mosquitto_sub for testing.

EmonCMS - display and record data

Install EmonCMS on a linux box (not on a raspberrypi)

Excellent instructions. This is a 30 minute process. I used an old laptop with a fresh Debian Wheeze install - this is similiar to Raspbian. You need to create a "pi" user in linux.. Otherwise the install scripts won't work.

https://github.com/emoncms/emoncms/blob/master/docs/LinuxInstall.md

Setup MQTT in EmonCMS

https://github.com/emoncms/emoncms/blob/master/docs/RaspberryPi/MQTT.md

These both installed okay, but there were some discrepancies between /var/www/emoncms or /var/www/html/emoncms - I needed to modify the php file location in the daemon at /etc/init.d/mqtt_input

I also have an error trying to install Redis (needed PHP >7.0.0) so I had to install an older version:

sudo pecl install redis-2.2.8

EmonHub - listen to temperatures and send to EmonCMS

No, this is not required. It is for decoding RF nodes and publishing to MQTT. I followed the rabbit here https://github.com/openenergymonitor/emonhub

Configure EmonCMS

  1. Login to localhost/emoncms and create a user.
  2. I get confused between nodes/feeds and inputs. But you'll see inputs/feeds created automatically from EmonCMS listening to MQTT. Try mosquitto_pub to emon/some/thing to see a quick test.
  3. Can an input and create a feed. I just 'logged to feed'
  4. Create a dashboard. Use visualisation tool to create a nice multi-variable graph (multigraph).

The results!

Publish ... publicly on EmonCMS.org