January 3, 2013

Thermometer with data logging and multiple sensors

After my first experiments (here and here) with Dallas One-Wire temperature sensors, I've decided to realize a thermometer that was able to log temperatures coming from multiple sensors, adding date/time information (coming from a Real Time Clock).

Here's the outcome: a thermometer based on Dallas DS18B20 sensors on a Dallas One-Wire bus, logging data on an SD card. Information are showed on a 2x16 LCD.

Thanks to three push buttons you're able to perform different tasks.

The first pushbutton is used select showing mode on LCD (alternating time/date show, single sensor temperature show or scanning sensors temperatures).

The second one is used to enable/disable logging data on SD card.

The third one is used to temporarily switch LCD backlight on.

There's a LED to show when logs are written on the SD.

When the "mode" push button is kept pressed during reset, verbouse startup is done (i.e. all sensor addresses are shown, together with other information like the number of sensors that has been found, the refresh period and the file name used for logging).

When the "end-log" push button is kept pressed during reset, temperatures logging is not done (i.e. it is possible to use this digital thermometer without an SD card inserted in its slot).

Temperatures are logged every temperature-refresh cycle.

Log file is closed each cycle (so it is safe to switch power off when the writing-status LED is off, e.g. right after an entry has been written - or you can use the "end-log" push button to end logging and safely switch off the thermometer).

When enable/disable log push button is pressed, logging on file is enabled/disabled (untill a reset, the same log file is used in append).

Temperatures logging is started on a new file each reset (to start loggin on a new file, press the reset button or switch the Thermometer off and on).

When the third "LCD backlight" push button is pressed, LCD backlight is temporarily switched on.

Date/time showing and date/time information in log files are based on a Real Time Clock module (using a Dallas DS1307 chip).

This is the schematics I've used to realize this thermometer:

It shows how the different components are connected to my Arduino 2009 board.

And (after several iterations...) here's the code I'm using:

(compiled with Arduino IDE 0022)

If you're going to give it a try, send info/link to your work in the comments.

UPDATED: since I don't like to waste my precious Arduino hosted in a project, I've realized a stand-alone version on a single stripboard hosting a minimal version of Arduino, an LCD with a basic interface, the PNP transistor to control LCD backlight, and a 3.3V and 5V supply circuitry

I've connected to the stripboard a One-Wire bus for the temperature sensors, a small stripboard hosting the three pushbuttons (in enabled internal pull-up resistor configuration), the LED, the SD Card module, the RTC module and a power jack to give power to the unit (I'm planning to use a battery pack or a wall adapter).


  1. You...completely read my mind with this project...aside from the picture frame enclosure that you now have. Very nicely done. I'll be basing my work off of your success. Thanks for sharing!

    1. Thank you for your nice comment! Much appreciated ;) Do let me know if you've any doubt or when your project is done!