Monthly Archives: April 2012

Arduino temperature web server

I have been playing around at building something using the Arduino system. (I have tried to mix the supplier links on this page, though for reference, all items so far have been supplied by Proto-Pic UK).

At work, we have a temperature logger that plugs into the network. It stores temperature and humidity data onto an SD card and displays it on an LCD screen. When the temperature is too hot or cold, it emails people to warn them. It has a webserver which shows latest temperature and humidity and allows simple graphs to be plotted. Unfortunately, the resolution of the temperature data is only 0.1 °C. Whilst this may be OK for most applications, the logger is installed in one of our temperature-controlled laboratories which is controlled to 20.0 ±0.1 °C, i.e. min-max range is double the logger’s resolution!

I wanted something with better resolution, and ideally cheaper, so I set about building something using the Open Source Arduino system.

 

Arduino temperature sensor and server - click to enlarge picture

So far, I have been building the system using an Arduino Uno R3 unit, into which I have plugged the latest version of the Ethernet Shield. This add-on board contains a serial to ethernet interface as well as a micro SD card holder. The Arduino Uno is connected to the PC using a USB lead and programs are uploaded to the Uno via this USB lead which can also power the device. When not connected to the USB, there is a power socket which can be used with either a battery adapter or mains adapter. So, in this simple two-board system I have:

  • data storage on micro SD card
  • network interface
  • programming ability

To enable proper real-time logging, which is tolerant of power outages, I have added a DS1307 Real Time Clock module, which retains time using a small battery when the power supply is disconnected. This RTC module uses an I2C interface which basically requires 5 V, 0 V and two signal wires.

At the moment, I am testing two types of good accuracy temperature sensors: the SHT15 unit from Sensirion (also includes humidity sensor), mounted on a SparkFun board and several DS18B20 OneWire devices.

Local display is made available via a backlit LCD screen. To cut down on the number of Arduino pins used, I have opted not for the usual Hitachi driver model, but one using a serial interface, from SparkFun. The LCD characters to display, as well as control codes, are sent along a 1 wire software serial connection, so I only use up one extra pin, as well as the common power supplies (0 V, 3.3 V).

The DS18B20 OneWire devices are really neat. They need only one wire for data and power (plus GND) – called parasitic power mode, where they power themselves for a short time each time the data line goes high (using a capacitor). They can also accept a supply voltage on a third pin, if necessary. Several devices can be connected to the same interface, i.e. with just a GND wire and a DATA wire, you can connect several of these to an Arduino, using only 2 pins – DATA and GND. Each device has an in-built hard coded serial number, and they can be individually addressable. Data resolution is 12 bit, or can be reduced if required.

I have got a small web server running on the board which will display latest data from one of the sensors – soon all of them. The LCD screen cycles between displaying temperature and humdity from the SHT15 device, the IP address and RTC time and the serial numbers and temperatures from the DS18B20 sensors.

Next stages:

  • Output all current data to the served web page
  • Log data to the micro SD card slot
  • Feed the logged data into a chart on the web server page (possibly using Google Chart Tools, or Pachube)
  • Implement email alerts
  • Compact the code size (probably need to do this sooner rather than later !)

Here is a video of the LCD screen cycling through the various displays: logger video (7 MB – right click and download if your browser does not play it).