Datalogger in an Altoids can
(Last modified 20 Oct 09)

This is pretty much one of those required projects; everyone builds a datalogger in an Altoids can.  But each is different and I enjoyed making mine.

Features:
Datalogger in an Altoids can

I've updated the photo (20 Oct 09) to show the datalogger after extensive updates.  The red PCB in the center is a 3.3VDC boost converter from SparkFun that should give me lots of extra life from the two alkaline batteries; check out their NCP1400-3.3 board.  The transistor just above the red PCB is the 2N3906, used to control power to the microSD card.

Here is the Eagle schematic as a PDF.  I fixed a schematic error that showed the ISP connector hooked to 5 VDC; this whole system runs at 3.3 VDC.  Updated 14 Oct 09 to add a 4.7K pullup to SS (CS for the SD card) and to add a 270-ohm resistor in the MISO connection to the SD card.

I wired directly to the terminals of a Kingston microSD adapter, which is the same size as a stock SD card.  I can then insert a microSD card into the adapter, write data to it, then pull the microSD card out of the adapter and insert it into a dedicated adapter in my PC's USB hub.

Note that total power consumption varies based on the microSD card.  I have a 128 MB card that reduces the total power draw in sleep mode to about 150 uA.  But if I use a Kingston 2 GB microSD card, the sleep-mode power draw jumps up to almost 400 uA.  Updated 13 Oct 2009: I have recoded the SD access routines so that the power-down current draw for the entire datalogger is less than 60 uA using the 128 MB microSD card.

BTW, the Kingston 2 GB card draws in excess of 45 mA during writes!  What's up with THAT?  The little no-name 128 MB card draws around 2 mA during writes.  The issue is moot at this point, however, as I've managed to trash the 2 GB card to the point that neither Windows nor MacOSX can see the card, let alone reformat it.  Oh well.

I had a bit of a problem finding a suitable temperature sensor because I want to run on 3.3 VDC.  The LM35 and DS18S20 both need 5 VDC for reliable operation.  I have some TMP36 temperature sensors from Analog Devices, which Lady Ada says work fine on 3 VDC.  So far, my tests show the TMP36 is an excellent choice.  Note that using the 'mega328p's internal 1.1 VDC reference limits the top temperature range for the TMP36 to about 60 degC.  Analog Devices offers two other variants of this device, the TMP35 and TMP37; check the specs to see if one of these might be a better choice for you.

The full source file set is quite large; the final object file is 27KB and includes a lot of my custom libraries, as well as Chan's FAT32 source files compiled for my board.  I'll skip releasing the source files for now because they really aren't very easy to use, even for me.  If I get the time to clean them up, I'll release them later.

BTW, if you haven't checked out Chan's work, by all means do so!  An excellent resource and very well done; it just works!  (Okay, you have to supply the code to read/write sectors on your hardware, but that's not much and Chan included excellent instructions on how to interface to his code.)
 
I created an Excel chart of temperature data taken on my back deck overnight on 10 Oct 2009.  The high initial readings were generated because the logger started out at indoor ambient.  The chart clearly shows the overnight low of 35 degF.


Home