Data visualisations

Hi,

Looking for some pointers please…

Assuming I can get some data uploaded from things like temperature sensors etc, what/which tools/sites are considered the best for creating dashboards from that data?

Cheers,

Ubidots, thingspeak, atomiot, azure, and numerous are some that pop up often. Have a look.

I am using “Grafana”.

Another vote for Grafana. +1

My particular “Metrics stack” is

SparkCore/Photon
MQTT and mosquitto broker http://mosquitto.org/
mqttwarn https://github.com/jpmens/mqttwarn
influxDB https://influxdata.com/
Grafana http://grafana.org/

2 Likes

What is your preferred way of hosting this stack ?

I use Grafana and InfluxDB, with the photon posting directly to InfluxDB. Works great, and it’s very easy to set up using docker containers!

Can you share your recipe for configuring the influxdb and grafana containers to talk to each other and your favourite way of submitting data from a core/photon/electron to them ?

Thanks for coming back with suggestions about what people use… are people using self hosted local servers or cloud hosted services?

I’ve taken a look and the best I can see in terms of very low cost and length of storage of data is thethings.io who offer a single device for free and then 1 euro per device per year which seems by far the best other than running a local server. I’d like some to just do on hobby basis with 12 months storage to see solar stats over 12 months…

Also found Freeboard.io which seems good.

Will take a look at the ones mentioned above.

Cheers

Sure! Once you have docker properly installed, you start both containers like this:

sudo docker run -d -p 8083:8083 -p 8086:8086 --name influxdb -e PRE_CREATE_DB="sensors" -v /media/nas/data/influxdb:/data --restart=unless-stopped tutum/influxdb:0.10
sudo docker run -d -p 3000:3000 --name grafana -v /media/nas/data/grafana/lib:/var/lib/grafana -v /media/nas/data/grafana/etc:/etc/grafana --restart=unless-stopped grafana/grafana:2.6.0

The directories /media/nas/data/* listed above are local directories that will be mounted inside the docker container. This allows you to delete and recreate the docker containers without loosing any of your data or configuration. This way, upgrading InfluxDB or Grafana is super simple, all it takes is a “docker rm -f” and a new “docker run”.

The next thing you need to do is log in to Grafana (https://localhost:3000) and add an InfluxDB data source pointing to http://localhost:8086. And you’re done!

Now you just have to get your Photon to send data to InfluxDB, like this:

#include "HttpClient/HttpClient.h"
...
#define INFLUXDB_HOST   "influxhost"
#define INFLUXDB_PORT   8086
#define INFLUXDB_DB     "sensors"
...
HttpClient http;

// Headers currently need to be set at init, useful for API keys etc.
http_header_t headers[] = {
    { "Host", INFLUXDB_HOST },
    { "Connection", "close" },
    { "Accept" , "application/json" },
    { NULL, NULL } // NOTE: Always terminate headers will NULL
};


bool sendInflux(String payload) {   
    http_request_t     request;
    http_response_t    response;
    
    request.hostname = INFLUXDB_HOST;
    request.port     = INFLUXDB_PORT;
    request.path     = "/write?db=" + String(INFLUXDB_DB);
    request.body     = payload;
   
    http.post(request, response, headers);
    
    if (response.status == 204) {
        return true;
    } else {
        return false;
    }
}

void setup() {
    ...
    // hello,zone=bla,sensor=XXX version="0.4.9",count=X
    String hello = "hello,zone=" + String(ZONE) + ",sensor="+System.deviceID() + " version=\"" + System.version() + "\",count=1";
    sendInflux(hello);
    ....
}

Let me know if you need any help!

6 Likes

https://data.sparkfun.com/ maybe.

You get 50MB of storage for free, which should be plenty for a year of solar data.

I’m glad someone mentioned posting directly to InfluxDB, I was going to suggest that.

At the moment I run the mosquitto & mqttwarn parts of my stack on a local Raspberry Pi and the InfluxDB and Grafana parts on a cheep virtual server.

You can get the whole stack onto a Raspberry PI 2 but it’s a lot more work and TBH a bit of a pain in the backside.
I’ve managed to get influxDB running on a Raspberry PI 2 by following these instructions. http://www.aymerick.com/2015/10/07/influxdb-telegraf-grafana-raspberry-pi.html
The whole pakageing steps of the infdluxDB install faild when i tried but I was able to compile a working influx DB by running ~/.gvm/pkgsets/go1.5/influxdb/src/github.com/influxdb/influxdb/build

YMMV

1 Like

But once you get it all working you get great graphs and visualization of your data

Help me out just a little more - in your arrangement, what do mosquito and mqttwarn bring to the party ?

To be clear, I’m not arguing, just trying to understand the value of each of those layers.

This post is a bit off the topic of data visualisation

The reason for the MQTT & mqttwarn in my metrics stack is that metrics is just a part of my DIY Smart Home / home automation / IoT system that is based around MQTT.

MQTT as a publish & subscribe messaging protocol allows two way communication with my cores/phontons/arduios/raspberry pi’s etc

Some examples

I have a Ethernet Arduino hooked up to an old Dynalight dimmer it receives MQTT messages to dim lights.
I have rebuilt a cheep chinese cat feeder it’s now power over ethernet and it receives commands and sends status messages.
I have a Photon that is hooked up to a Chirp Soil moisture sensor https://www.tindie.com/products/miceuz/i2c-soil-moisture-sensor/?pt=full_prod_search as well as a bunch of neopixels lighting a salt lamp. It sends messages for soil moisture, light levels etc and received messages for the colour of the Neopixels. (I’ve been meaning to write this project up.)
I have a Core doing a simple temperature readings from a fistank via your typical DS18B20 sensor. etc…

Then on a raspberry pi I’ve written MQTT bridges for a bunch of other random SmartHome devices and Kickstarter swag Smarthings, CurrentCost, Orvibo s20 wall sockets, Bloomsky weather station etc

With all the data available via MQTT I can then write simple python scripts for the logic side of things. Subscribe to the topics to get the information required and then publish to a topic to control a thing.

1 Like

Thanks for answering my curiosity. Appreciated.

www.Ubidots.com is really simple to use. There is a Ubidots library in the online IDE already to get you going.

You can view graphs just like their posting above without needing to do much as far as setup.

There are free accounts that would work perfectly for logging solar data.

Hi @Alex_,

thank you very much for your code. I have installed docker on my Ubuntu 15.10 Server and followed this guide: link to install guide

After that I ran

sudo docker run -d -p 8083:8083 -p 8086:8086 --name influxdb -e PRE_CREATE_DB="sensors" -v /media/nas/data/influxdb:/data --restart=unless-stopped tutum/influxdb:0.10

and this works fine as far as I can see.
But when I run

sudo docker run -d -p 3000:3000 --name grafana -v /media/nas/data/grafana/lib:/var/lib/grafana -v /media/nas/data/grafana/etc:/etc/grafana --restart=unless-stopped grafana/grafana:2.6.0

Grafana is not working. When I use `docker ps -a I see the status “restarting (1)” for Grafana.

I have only got Grafana to work when I use this code which does not have the advantages of your code:

docker run -d -p 3000:3000 --link influxdb:influxdb --name grafana grafana/grafana

Do you know what I am doing wrong?

Kind regards,
Tom

Do the local directories exist on your machine? You can also take a look at the docker logs (docker logs -f grafana) for further clues as to why it’s crashing.

Thank you very much @Alex_ for your reply. The directories did not exist so I have created

/media/nas/data/influxdb
/media/nas/data/grafana/lib
/media/nas/data/grafana/etc

with the mkdir command.

after that I have recreated these two containers.

docker logs -f grafana

shows me

2016/02/28 13:36:09 [log.go:75 Fatal()] [E] Failed to parse /etc/grafana/grafana.ini, open /etc/grafana/grafana.ini: no such file or directory

So the .ini file is missing but I think your command should override it.

So does it work now? I don’t remember having to create that file, to be honest, I think grafana generates the defaults the first time it runs.