This is a Raspberry Pi-powered node.js application that reports the temperatures from DS18B20 temperature sensors.
Somewhat operational: thermometer readings are displayed on a webserver. Thermometers are able to be hot-swapped while the server is running. Data is logged to a SQLite3 databse.
Prerequisite: a Raspberry Pi with installed OS. We recommend the Raspberry Pi Educational Linux Distro from Adafruit: Occidentalis v0.2. It has built-in support for One Wire. One or more DS18B20 sensors is probably a good thing to have for this but not required to get things up and running.
Step 1: Download the latest stable version of node.js
~ $ wget http://nodejs.org/dist/v0.8.18/node-v0.8.18-linux-arm-pi.tar.gz
Step 2: Unzip and remove superfluous files
~ $ cd /usr/local
/usr/local $ sudo tar xzvf ~/node-v0.8.18-linux-arm-pi.tar.gz --strip=1
/usr/local $ sudo rm LICENSE
/usr/local $ sudo rm README.md
/usr/local $ sudo rm ChangeLog
/usr/local $ cd ~
~ $ git clone https://github.com/flamescape/TemperatureLab.git
~ $ cd TemperatureLab
~ $ npm install socket.io
~ $ npm install express
~ $ npm install sqlite3
In order to read the raw data from the DS18B20 sensors, we need to load the One Wire kernel modules. To do that, execute the following commands:
~ $ sudo modprobe w1-gpio
~ $ sudo modprobe w1-therm
To check that the modules loaded properly and that your sensor is functional, execute the following command:
cat /sys/bus/w1/devices/28-*/w1_slave
These modules must be loaded every time the RPi is booted for the temperature sensors to be read. To make things a little easier, you can load the modules at boot by editing /etc/modules
and appending the following lines:
w1-gpio
w1-therm
~ $ node server.js
Direct your web browser to http://localhost:8080 on the RPi (or to the RPi's local IP address from a different machine on the network) to view the lab.
TemperatureLab is released under the Simplified BSD License.