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).

2 thoughts on “Arduino temperature web server

  1. clf

    From the date on the post this may be outdated but this project sounds like what I’m looking for. I just got started in the arduino stuff and I’m not a programmer so I’m learning mostly by seeing what/how other people go about getting the results they want.
    I’m using an arduino Uno R3 for a webserver now and seems to work but I need something that will send emails if the temp parameters are exceeded. This project sounds like it has the email server in it and sounds like it would do what I want it to. Is this post current? if it is, have you posted the code somewhere I can look at it? thanks

    1. wpadmin Post author


      Yes, still current! All the recent work is included in the updated instructions in the main post (it links to PDF and WORD versions which are stored in my DropBox and updated whenever I change things or add new ideas). Follow the link to the main post and then access the WORD document. The code is embedded in the document. The email stuff is driven by a Python script that runs on the Pi. I also tried Arduino at the start but ran out of memory for performing all the things I wanted on a single device (data capture, storage, graphing, web serving, emailing) which is why I went to the Pi. I decided against writing it all myself (not enough time) which is why I joined together as many open source bits as I could, so I use Cacti for the graphing and web access and some simple Python code for data capture, raw data storage, LCD driving and email.

      Look through the document for the listing for which is the main code which includes the email stuff – since it is in Python, the email code is brought in as imported library and the actual email code in is pretty minimal.

      Hope you find something useful.



Leave a Reply

Your email address will not be published. Required fields are marked *