Create a temperature logger

This project example illustrates how to create a temperature logger with web interface and data storage on SQL database. based on the FOX Board G20 and a Dallas DS18B20 thermal sensor.

Main features

  • 1-wire thermal sensor Dallas DS18B20 Datasheet with -55℃ to +125℃ temperature range
  • Sample storage on SQlite3 database on microSD. The sample are read from the thermal
    sensor by a program in Python and stored on SQLite3 using the Pysqlite2 module.
  • The reading sampling are made using the standard Linux utility Cron.
  • a PHP ) program and some Javascript/JQuery scripts manages the user interface program via web
  • The HTML5 RGraph library shows the sampling charts

Requirements

Hardware requirements

To build this logger we need a FOX Board G20 wired to a Dallas Thermal Sensor. To see how to read this article: Using 1-wire Dallas DS18B20 thermal sensor

Install the required softwares

The Python interpreter usually is already installed. If not install it by typing:

debarm:~# apt-get update
debarm:~# apt-get install python

The SQLite support for Python is provided by the module Pysqlite2 that can be install from the Debian standard repository package by typing:

debarm:~# apt-get update
debarm:~# apt-get install python-pysqlite2

Usually also the PHP interpreter is already installed on the FOX Board G20. If not please install it by typing:

debarm:~# apt-get update
debarm:~# apt-get install php

The SQLite support for PHP is not installed by default to install it type:

debarm:~# apt-get update
debarm:~# apt-get install php5-sqlite
...

Then restart the lighttpd web server:

debarm:~# /etc/init.d/lighttpd restart
Stopping web server: lighttpd.                                                  
Starting web server: lighttpd.

Install the SQLite command line interface useful to browse the SQLite files by typing:

debarm:~# apt-get update
debarm:~# apt-get install sqlite3 

Cron is the already installed

Lighttpd web server is alredy installed and configured to publish the pages and PHP scripts stored in the /var/www directory

RGraph

Reading the themperature and save them on a SQLite database

tlogger.py