Solar Water Tank Temperature to ELK Stack (ElasticSearch + Logstash + Kibana)
SolarWaterTankTemperature
Get information from a Temperature Sensor to an Arduino and presented to an ELK (ElasticSearch Stack) from my GITHUB
*Goal: Retrieve water temperature from my solar tank and inject the data into my ELK Stack
Hardware:
- Arduino - ESP8266 (compatible) but in reality is: NodeMCU CP2102
Where to buy: -> I bought mine from Aliexpress.
- Temperature Sensor - DS18B20
Where to buy: https://www.tecnis.pt/compra/sonda-de-temperatura-submersivel-55%C2%BA-125%C2%BA-vdc3-5-5-ds18b20-para-4394
*Step 1: Get the electronic diagram
and mount your one version of it:
*Step 2: Get the Arduino code
I created a Webserver that will show the temperature from the sensor. There is bug that sometimes the output of the sensor gives 85 degrees or -127 degrees. For this reason I’ve added an extra validation before showing the result.
Wifi Web Server Water Sensor Arduino code
*Step 3: Make it work
As soon as you start it it will create a web server that is connected to your network and add a static page with the current temperature.
Serial testing it:
*Step 4: Because it is working, lets clean our hardware
Version 2 of our solution
Final Version of our solution - inside a platic protection (home made :D )
*Step 5: Get it installed
*Step 6: Get the data into a log/event file
Now that we have our webserver working, we need to get the data and every minute send it to our central ELK system. For that reason, I created this simple bash script that retrieves just the temperature and stores it in a event log file that will be consumed by our ELK.
https://github.com/tarrinho/SolarWaterTankTemperature/blob/master/get.data.water.temp.sh
*Step 7: Add a new source from ELK
Now that we have the event/log file, we need to inject it to our ELK (ElasticSearch + Logstash + Kibana stack).
https://github.com/tarrinho/SolarWaterTankTemperature/blob/master/logstash-watersolar.conf
*Step 8: Create a Dashboard
After ensuring the creating of the index, create a dashboard like this:
Final Note:
I want to thank all the guys that detailed information on the Internet but specially to the ones that created the following sites, this allowed me to learn:
https://randomnerdtutorials.com/esp8266-ds18b20-temperature-sensor-web-server-with-arduino-ide/
https://www.circuitbasics.com/arduino-thermistor-temperature-sensor-tutorial/