A few weeks ago I started learning Python. The first steps with it are so easy and inspiring that I quickly decided to try and build something. I had a challenge at hand -- to measure and keep track of the temperature at home and later play with the data (as I progress with Python).

I got all the hardware parts needed -- a Raspberry Pi 2, a breadboard, jumpers, a temperature sensor (DS18B20) and a 4.7k resistor -- and assembled it. A few commands later I saw the first signs of success in Terminal -- a number with five digits, the temperature in Celsius.

The working digital thermometer

The next step was to write the Python script that would read the data from the sensor. Once that was ready, I decided to include a timer, so that temperature was measured periodically. The last stage was to write the data (temp and time (Unix Time Stamp)) to a database (SQLite for starters). And my Python script was ready.

But then, to keep it running, I had to keep an SSH connection to the Raspberry Pi. I started looking for a way to run my Python script as a system service. This tutorial on Stack Overflow offered an easy solution.

I have been recording the temperature at home every 15 minutes since then. In a few days I will add external temperature and gas consumption (on daily basis) and play with all that. My solution to the task is available on Github.

Retrieving the home temperature data