Raspberry Pi based temperature logger using a DS18B20 1-Wire digital temperature sensor
PHP JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
resources circuit snapshot Dec 17, 2012
src/TemperaturePi fixing month value in Js Jul 20, 2013
web using new AnnotatedTimeLine chart from Google Viz API Jul 16, 2013
.gitignore updating thermometer to blink, using new php-gpio blinker Dec 16, 2012
LICENSE first commit Nov 23, 2012
README.md Update README.md Jul 24, 2013
example.png logger now generates a js file used to produce a temperature chart (s… Dec 3, 2012



temperature-pi is a simple Raspberry Pi based temperature logger using a DS18B20 1-Wire digital temperature sensor, & a local sqlite database. It's based on the php-gpio PHP library


Installation (hardware)

DS18B20 sensor connection

Read this very easy-reading tutorial on the Cambridge University CompSci Laboratory Raspberry Pi dedicated pages.

Then install the DS18B20 on your bread board, wired to the #4 gpio pin, following the tutorial indications.

Then add a led & a resistor wired to the #17 gpio pin.

Circuit snapshot

Installation (software)

The recommended way to install temperature-pi is through composer.

Just create a composer.json file for your project:

     "require": {
        "php": ">=5.3.0",
        "ronanguilloux/temperature-pi": "master-dev"

And run these two commands to install it:

$ wget http://getcomposer.org/composer.phar
$ php composer.phar install

Oprionnaly, allow the vendor/ronanguilloux/php-gpio/blinker file to be run without sudo: Edit your /etc/sudoers file:

$ sudo visudo

Then add this two lines in your /etc/sudoers file : (replace MyLinuxUser with your login name & change the path to the blinker) This will allow you and Apache2 to run the blinker without sudo

MyLinuxUser ALL=NOPASSWD: /path/to/blinker
www-data ALL=NOPASSWD: /path/to/blinker

Set up the sensor

Using the shell, manually add theses kernel modules:

$ sudo modprobe w1-gpio
$ sudo modprobe w1-therm

To load such kernel modules automatically at boot time, edit the /etc/modules file & add these two lines:


Run a cronjob & log temperatures

Run the executable php file to record temperatures

$ thermometer

To trace temperatures chages, add this into your crontab to log the temperature through the day, each 30 minutes

0,30 * * * * /my/path/to/the/temperature-pi/thermometer >> /my/path/to/the/temperature-pi/resources/log

Get a graph

To get the graph, run this app as a webserver

$ php -S "`hostname -I`:8080" -t web/




temperature-pi is released under the MIT License. See the bundled LICENSE file for details. You can find a copy of this software here: https://github.com/ronanguilloux/temperature-pi