62 December 2013
about 80,000 years. (That is just crazy.)
So, why on earth did we go to all that trouble
squeezing a measly 3,000-ish samples into the raw
Arduino when we can get so much space on a $5 SD
card? Well, part of the reason is cost. Saving the data on
the raw Arduino doesn’t add any extra expenses, while
adding an SD card to an Arduino can cost about $20
when you include both the card and the required circuitry.
So, only you can decide if your needs warrant that
extra expense. To me, it’s almost a no-brainer. If you are
seriously into data logging, you need the SD card. [Oh,
and the other reason for squeezing the data into a raw
Arduino is that it was a good learning exercise. Admit it,
you did learn some stuff.]
An Arduino Data Logger Shield
I had an old AdaFruit Arduino data logger shield
laying around (refer back to Figure 1), so that’s what I
used with the AHP to develop and test the final software.
AdaFruit discontinued that shield in favor of one that
comes pre-made with surface-mount parts. That will do
just fine, though you do miss the opportunity to inhale
some solder fumes.
As you can see from the photo, I soldered the DHT22
sensors to the prototyping area with the sensors going to
pins 8 and 9. Note this change from last month’s article. I
had used pins 10 and 11, but that conflicts with the
signals needed for the SD card. So, I moved them.
Using an SD Card With the Arduino
Using the SD card is dead-nuts easy with the Arduino
SD library. Just keep in mind that they use 3.3V for both the
power and logic interface. They can use about 100 mA at
times, and they can be fairly finicky about the logic signals.
Since the Arduino (in general) is 5V, you must have
special voltage level-shifter circuits to translate between
the two. You could roll your own connections, but there
are many shields available with all the current and
protection built in. For this article, I used an older data
logger shield from AdaFruit.
My shield required that I solder all the through-hole
parts on it, but the newer version comes ready to use. The
shield has a real time clock built in, so we can get our
■ FIGURE 13: Arduino SD card examples.
■ FIGURE 14: SD Example wrong chipSelect.
■ FIGURE 15: SD example right chipSelect.