Recently I want to install a Temperature Insulation in my house since it’s very hot in daylight. But I really curious if this insulation really work lowering temperature in my house? For this obviously I will need a temperature sensor. So There is DHT-11 a very low price and low resolution with high noise level which I don’t know. So I start connecting this DHT-11 to Node-MCU.
The goal is I want to connect this Node-MCU via Wi-Fi and transmitting the temperature data using MQTT protocol. But first, I need to look how I can do that! It’s easy just use arduino programming and some example while I ever create a button IoT to turn on a LED. So this must be not hard right? Well If I only want to probe single value then it’s done!
The problem is, I want to compare the temperature data before the Insulation installed and after the insulation installed, so I will also need a data storage. Storing data is easy if it’s just for storing. But we want to easy access for it. This remind me how data visualization really helping in making decision and create an insight for the collected data. This remind when benchmarking a video conference platform a while ago using kubernetes, docker, and more importantly a Grafana! My client and my friend saying this tools really help us understand what went wrong with their video conference. I will write it later when I have more time (and off course permission). So yeah I want to use Grafana again for my personal project. So there is my final goal. It’s time to set the course for!
Now, I have Node-MCU and DHT-11 as my sensor node with MQTT as transport protocol. I also have deploy Grafana with InfluxDB in my previous work. All we need now is how we can bridge this two? So instead of re-inventing the wheel why not googling and see if any other people has done it and publish a “how to”. After a while googling with couple keyword I found one person who really done it in a way that really suit my need and preferences. He really good and he also use docker to deploy the idea which really make everything more scalable, moveable and replicable. I owe a lot to him. You can find the idea from here: http://nilhcem.com/iot/home-monitoring-with-mqtt-influxdb-grafana
After reading a while how he implement the idea, I can see that he using a python to bridge between MQTT and InfluxDB. So, it’s time to implement the thing. I start from installing a broker, subscriber, and publisher in raspberry so when the Node-MCU already publishing some data I can see if it’s work correctly or not. Here’s what I do to install:
$ sudo apt install mosquitto mosquitto-clients
And here’s what I do to check if the broker already up and ready to “brokering”, first I open two terminal (ssh) to my rpi. One for subscriber:
$ mosquitto_sub -h localhost -t test
and other terminal for publisher:
$ mosquitto_pub -h localhost -t test -m test1
If everything done correctly I should get the message “test1” in my subscriber terminal. So. Yes I have it! Time to start the Node-MCU and check if the topic published from Node-MCU get into rpi.
I think this is for our first part. I will continue with how the bridge and docker setup in the next part.
Setup a Beautiful Dashboard to Monitor Temperature and Battery Voltage. [Idea] – Otm’s Lab