piBot – bot for monitoring temperature

This is a long due project using a raspberry Pi to monitor the temperature of a cabin I’ve been building for a very long time. I’ve bought the hardware almost 4 years ago and only arrived to the point where I could use it.


Beside the geek motivation the main practical motivation is to measure inside and outside temperature in order to estimate:

  • degree of insulation and week points
  • min temperature in order to calculate needed anti-freeze mix for heating pipes
  • temperature monitoring for pump automation (TODO)
  • min temperature in order to start some electric heating (TODO)
  • accuracy of weather predictions for the location


The architecture of the system is quite simple and has the following components:

    • the raspberry PI, model B which uses several DS18B20 sensors to monitor temperature
    • the piBot (this project) which is basicaly a main loop with sensors and output plugins
  • the vpn client over 3G in order to ensure connectivity in the lack of a fixed ip
  • the vpn server and db where data is stored
  • the visualisation which uses Grafana with a pgsql backend


PiBot is a python main loop which has a plugin mechanism for sensors and outputs (check it on gitHub). Currently I implemented:

  • sensor: ds18b20 which reads /sys/bus/w1/devices/%s/w1_slave data (sensor integration is present in the raspbian)
  • sensor: /sys/class/thermal/*/temp temperature for CPU temperature
  • output: csv plain output
  • pgsql: postgresql output in grafana friendly format

Grafana output

piBot grafana output

3 Responses

  1. Can you please detail about the vpn side of the project? I made a few years ago a box with a RPi, the box was recording temperature, humidity and atmospheric pressure and at given intervals, it was taking a photo (cronjobs). Then it was creating a graph for the atmospheric pressure from the last 8 hours (I was using gnuplot), then overlay the graph and current temperature / humidity on the photo (imagemagick), then upload the image on a Facebook account (IFTT, Dropbox and a script found on github) over 3G. My device was running on batteries. Device was able to send data over 3G, but due to lack of fixed IP, I was not able to connect to the device from home, I managed some connection by doing reverse SSH from device on a server from home (also not fixed IP but having dynamic DNS). Thanks!

  2. Hello Catalin, sorry for my delayed response. The pi connects to the internet using a 3g modem but my provider does not even gives an external ip but rather a NAT-ed one (192.168.*). I have however a server with a fixed ip somewhere on which I have installed an openvpn server. The pi connects as a vpn client and gets a fixed ip in the vpn network. Thus I can connect via vpn from my laptop (also in floating IP), access the vpn network and the pi. Check the openvpn page for configuration.

  3. Thanks, I’ll give it a try!

Leave a Reply