Environmental uSD card data logger

Jeremy Harris

Senior Member
I'm currently finishing the design of a new house we're building and, because it's being designed as a near-zero mean energy input house, I wanted to fit an array of temperature and humidity sensors and log the data in a form that would be easy to read on a PC. I also wanted to display the last measured sample, for ease of checking some parameters, like the water temperature or relative humidity in the living area.

The core of the logger is a 14M2, with 6 measurement channels. Data is stored on a uSD card, using the cheap, open source, OpenLog as a simple card read/write and file handling module. The OpenLog is driven with serial commands in ASCII, making it extremely easy to interface with a Picaxe. The hardest part of the project was designing temperature and humidity sensing modules that were cheap to build, accurate enough for the job and compatible with a 5V system without faffing around doing level conversion. I ended up using the same cheap Humirel sensor that's used in the rather awkward to utilise HH10D module, their HS1101. These are around £2 or so in quantities of 6, direct from China. The sensor forms part of a CMOS 555 oscillator with the frequency being read by a 08M2. This also reads a DS18B20 temperature sensor. By using an 08M2 right at each sensor I was able to build in accurate calibration and do conversion to meaningful numbers that could be squirted out of the serial port and down a three wire connection to the logger.

The logger has four channels that are directly connected to DS18B20 temperature sensors and two channels that are connected to the temperature and humidity sensor modules, so can log and display 6 temperatures and 2 relative humidity readings. In the photo below only a single temperature and humidity sensor is connected, hence all the "0 deg" readings.

The logger can record up to 16 Gb of data on the uSD card, which at the fastest sampling rate of one reading per minute would give over 4,500 years of storage capacity. The logger can have the date and time on the real time clock on board (a DS1307 with battery back up) set by simply writing a datetime.txt file to the uSD card, inserting it and the logger then reads the data when powered on and sets the clock. Similarly, the sample interval can be set anywhere between 1 sample per minute (on all channels) to one sample every 23 hours and 59 minutes, just by writing a short text file (setsampl.txt) to the uSD card. Data is stored as a comma separated value (.csv) text file that can be directly opened by most spreadsheet software, allowing easy data manipulation for creating graphics etc.

Some of the code has been adapted from contributions here and from some of the Picaxe projects, like the AXE110 data logger, and I openly acknowledge the help this has been and would like to thank the code authors. I don't pretend that my code is optimised or particularly neatly written, there are probably many different ways to do this. As neither execution speed or code brevity were important for this project I haven't bothered to seek to make it any faster or slimmer.

Hopefully the photos and pdf description below (which was written for a friend, who also wants one of these, rather than for this forum's readership) may give others a few ideas. The temperature and humidity sensor modules, in particular, have the potential to be used in other projects, as the code could easily be adapted to send ASCII values directly to a serial display or some other device, like a PC.


Last edited:


Technical Support
Staff member
An excellent project and a great write-up. Perhaps consider submitting it to the Project Gallery.

One minor point to note: the PCB layout in the PDF shows the 10K and 22K download resistors swapped over for the temperature / humidity module.

Jeremy Harris

Senior Member
An excellent project and a great write-up. Perhaps consider submitting it to the Project Gallery.

One minor point to note: the PCB layout in the PDF shows the 10K and 22K download resistors swapped over for the temperature / humidity module.
Thanks Hippy, I've corrected the drawing error (luckily it's only the drawing that was wrong!) and will pop this in the Project Gallery as you suggest.


An excellent project and great documentation, well done. Given me lots of ideas (not least, a use for the plastic trunking in the garage!!). Good to see a PICAXE logging to an SDcard in a real world application.

Jeremy Harris

Senior Member
Thanks for the kind words. I'm hoping it can help a few of us better understand some of the key issues with low energy house design, where the risk of condensation can be quite high in parts of the structure and actually be exacerbated by adding insulation. This was one reason for wanting to measure temperature and RH accurately, as we want to be able to see how close to dew point some areas are getting. I ended up using the microSD card because I struggled to get the USB stick VDrive2 to work. After struggling with it for a day or two I went and bought an OpenLog out of frustration and had it up and running with a Picaxe in less than an hour. I'm sure the VDrive2 could be made to work with this logger, and I may go back and look at doing this at some time in the future, but I wanted to get the logger finished so that I could get some data on the house before the end of the cold weather!


Senior Member
I really appreciate your fine effort since I have struggled with similar requirements, and used a somewhat different approach (http://projects.worsleyassociates.com/mobilelogger). In a different project of mine I also used the HS1101 humidity sensor without the painstaking calibration you used, and the results were unsatisfactory. This time I bought the already-calibrated AM2301, and struggled with its strange output format. It's output, however, is accurate.


Senior Member
Hi JH,
I really like this project, especially as I'm trying to put something similar together myself, and some of your ideas and code are really going to help me! I've only just come aross this and not had a chance to study your code, but I have a problem sorting the MIN and MAX temps and saving to an external EEprom, especially reading them back in the correct order. W1 stored as b1,b0...
Thanks for a great project.


a possible shorter temp conversion routine for data from a DS18B20 could be:

  	LET sign = 32                                       			;set sign to ASCII 32 = " " (space character)
  	IF temp_word > 64655 THEN                           			;-55 deg C = 64656
  	LET sign = 45                                       			;set sign to "-" for less than 0 deg C
	temp_word = - temp_word                           			;2's complement temperature, extracts sign
	whole_degrees = temp_word / 16
	decimal_degrees = temp_word * 4096 ** 10000 / 1000 + $48 		; to 1 decimal place


New Member
Thanks Jeremy this thread as inspired me, though my wife will not appreciate me having another hobby :D

I'm renovaing a house and it's also super insulated, but i want a data logger for the ground source heat pump that we have just fitted, you can buy hardware that plugs into the heatpump that extracts the reading from the heat pump but for one it's not cheap and requires either a computer connected to record the data or a yearly subscription to have it charted online.

But i want to do more than just read temp sensors, i want to measure actual voltage and current draw water flow rates and temps and have the picaxe calculate the actual Cofficent Of Performance and display it, a Picaxe seems to be the ideal solution and having it write to an excel format even better.

ive ordered a 28/40 kit and axe134Y, i've done some electronics before but last time i programed something it was on a spectrum zx,

One point about the write up excel 2007 onwards can work with 1,000,000 rows that will allow longer or higher resolution sampling. or access should be able to open the file over 1 million rows or you can use a java script to split the file into smaller chunks.


New Member
Dear Jeremy (or anyone else).

Are +10 to 15V power source mandatory if i throw away Open Log uSD card module,DS1307 (and CR2032 + crystal) and four inputs to sensors?
And do i have use the 4k7 resistors on board, if i plugged two sensors (and have two inputs)?

16x2 Serial LCD Display are still on board.. yep, im new rookie, whos only interested in outdoor and indoor temperature and humidity. :eek:

I share everything, when I get something done.
But you all have promise, do not laugh my "noobie"-project.



Senior Member
This thread is great. I have ordered my OpenLog to interface to an existing light controller setup with a 40x2. The data tables are getting very large so I needed a way to read data into the pic from a large data bank and the SD card is perfect. My pic will only need to read data from the SD card. The light pattern data will be loaded into the SD card by my desktop. Data table format has yet to be decided on how I will implement.
Last edited: