Data logging shield

I bought the data logging shield from adafruit, as well as the 6 x AA battery holder, so I could try out their refrigerator logger: logging the light and temperature of my fridge, to see how the temperature fluctuates and how much the temperature rises when the door opens.

First, I needed to do some soldering. I hadn’t soldered in a while, so I first put the jack on the battery pack. I’ve done a bunch of these, and Lady Ada has a clear tutorial, but I botched this rather badly.

  • When you do the black wire, on the outer tab, you need to put the solder on the inside rather than the outside. I got too much on the outside and wasn’t able to screw on the plug cover.
  • Cut it off and put on a different one, but realized afterwards that I’d used a 2.5 mm plug instead of a 2.1 mm plug. The larger plug fits into the arduino, but it’s a bit loose and so the connection is unreliable.
  • Cut it off and tried again, but forgot to put the plug cover on the wires first.
  • Cut if off and tried again, and finally got it. The wires are a bit short, but the battery pack works.

I moved on to soldering together the data logging shield. Lady Ada’s instructions are, as always, superb and easy to follow. It all went together easily.

It wasn’t too clear what the LEDs were for, but when I got to the instructions about the light/temp logging, it became clear. You use jumpers to connect them to digital pins 2 and 3 (green will be 3 and red will be 2): note the two short yellow wires in the top right of this picture. Then you do whatever you want with them. (In the light/temp logging sketch, they use green to indicate that a reading is being taken and red to indicate either an error or that data is being written to the SD card; see the walk-through of the code.)

There was one other thing that wasn’t clear: the shield came with a 6-pin ICSP header, but it isn’t mentioned in the assembly instructions, though it does appear in the picture of the shield, next to the two jumpers for the LEDs. I soldered it there but I’m not sure what it would be used for. (As mentioned at the adafruit forum, it’s for programming the arduino via ICSP rather than USB; I don’t think I’ll be doing that.)

Lady Ada used the prototype section of the data logging shield to permanently solder the sensors. I instead put extra long headers in the shield, so that I could easily plug in jumper cables and attach sensors via a breadboard. I also put a single pin of extra long header in the 3V spot on the shield.

Here’s the assembled stuff:

It was super easy to follow the code; I had no trouble getting it all to work.

Here’s the shield in the refrigerator:

I’d planned to leave it in for 24 hours, but I pulled it out after 16 hours so that I could make a plot of the results.

Here’s a plot I made (in R) of the temperature over time. The dots at the bottom indicate when the door was opened; red dots indicate the door was open for more than 10 seconds.

The temperature is mostly below 40 degrees, as it’s supposed to be. I was surprised to see it dip so far below freezing. Just before noon, I left one side of the refrigerator door slightly ajar (a not uncommon mistake in our house). I went into work last night and stayed absurdly late; I opened the fridge when I got home, at a bit after 2am.

I’ll add R code and a sketch of the circuit later. I ended up using the light/temp logging sketch from adafruit without changes, so there’s no need to include that.

Given our tendency to leave the refrigerator door ajar, maybe I should create a temperature-based alarm. No; I think the batteries would cost too much.


Tags: ,

4 Responses to “Data logging shield”

  1. WT Says:

    The LG fridges has a door ajar ckt which beeps after timing out perhaps 30 secs.

  2. mattfors Says:

    What is vcc in your data files the far right column?

    • karlduino Says:

      I think it’s supposed to be the supply voltage, but I must have set up the wiring for the circuit incorrectly, as it seems to be following the photoresistor readings.

      Here’s the relevant code; see lines 32-35 and 194-198 of the code at github.

      #define BANDGAPREF 14            // special indicator that we want to measure the bandgap
      #define aref_voltage 3.3         // we tie 3.3V to ARef and measure it with a multimeter!
      #define bandgap_voltage 1.1      // this is not super guaranteed but its not -too- off
      // Log the estimated 'VCC' voltage by measuring the internal 1.1v ref
      int refReading = analogRead(BANDGAPREF);
      float supplyvoltage = (bandgap_voltage * 1024) / refReading;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s