Introduction: Logger Shield: Datalogging for Arduino
Data logging shield
Here's a handy Arduino shield: we've had a lot of people looking for a dedicated and well-designed data logging shield. We worked hard to engineer an inexpensive but well-rounded design. Not only is it easy to assemble and customize, it also comes with great documentation and libraries.
You can get going within an hour - saving data to files on any FAT16 or FAT32 formatted SD card, to be read by any plotting, spreadsheet or analysis program. We even have a tutorial on how to use two free software programs to plot your data. The included Real Time Clock timestamps all your data with the current time, so that you know precisely what happened when!
- SD card interface works with FAT16 or FAT32 formatted cards. 3.3v level shifter circuitry prevents damage to your SD card
- Real time clock (RTC) keeps the time going even when the Arduino is unplugged. The battery backup lasts for years
- Included libraries and example code for both SD and RTC mean you can get going quickly
- Prototyping area for soldering connectors, circuitry or sensors.
- Onboard 3.3v regulator is both a reliable reference voltage and also reliably runs SD cards that require a lot of power to run
Step 1: Overview
This page will run through the schematic, explaining whats going on and why picked the parts we did!
Here's the 'big picture' schematic for reference:
There is a small power supply on the board for generating 3.3V @ 250mA. We don't use the 'built in' 3.3v regulator on the Arduino because its only guaranteed up to 50mA and some SD card need a lot of power when writing. This supply is nice and steady, we can use it as an analog reference too! We have two sets of bypass caps to try and keep both 5V and 3.3V supply nice and clean - the 100uF ones are for the low frequency noise and 0.1 for higher frequency
The real time clock is the DS1307 from Maxim, which has a battery backup (CR1220) and communicates with the Arduino via i2c (the SCL and SDA lines). i2c requires pullup resistors on the clock and data lines, which you see as R1 and R2. 2.2K are good values, but if you're in a bind, 1.0K to 10K will probably work fine.
The RTC requires a single 12.5pF load crystal at 32.768 KHz, Q1 - this is how it keeps time
There are also two LEDs for general purpose blinkin' - we like to use them to tell when the SD card is being written to.
SD card interface:
The SD card holder is connected to the Arduino through a buffer IC3. The buffer is a level shifter, converting the 5V signals into 3.3V ones which are safe to use. (For some cards its OK to use 5V signals but you risk the card being permanently damaged!) There is a pull up on the CS line so that if you program the Arduino with a ISP programmer while theres a card in, you wont scramble it.
There are two 'unused' lines from the SD card - Card Detect is shorted to ground when a card is inserted. Write Protect is shorted to ground when a card with the safety switch flipped is inserted.
There is also a RESET button, handy when you want to start the Arduino over!
Step 2: Tools and Preparation
This kit is pretty simple, but you should follow these steps fully so that you'll have no problems!Learn to solder
There are a few tools that are required for assembly. None of these tools are included. If you don't have them, now would be a good time to borrow or purchase them. They are very very handy whenever assembling/fixing/modifying electronic devices! I provide links to buy them, but of course, you should get them wherever is most convenient/inexpensive. Many of these parts are available in a place like Radio Shack or other (higher quality) DIY electronics stores.
Soldering iron. One with temperature control and a stand is best. A conical or small 'screwdriver' tip is good, almost all irons come with one of these.
A low quality (ahem, $10 model from Radioshack) iron may cause more problems than its worth!
Do not use a "ColdHeat" soldering iron, they are not suitable for delicate electronics work and can damage the kit (see here)
Solder. Rosin core, 60/40. Good solder is a good thing. Bad solder leads to bridging and cold solder joints which can be tough to find. Don't buy a tiny amount, you'll run out when you least expect it. A half pound spool is a minimum.
Multimeter/Oscilloscope A meter is helpful to check voltages and continuity.
Flush/diagonal cutters. Essential for cutting leads close to the PCB.
Desoldering tool. If you are prone to incorrectly soldering parts.
'Handy Hands' with Magnifying Glass. Not absolutely necessary but will make things go much much faster.
|Good light. More important than you think.|
Step 3: Check the Parts List
Bill of Materials
3.3V linear voltage regulator, 250mA current
|Real time clock||DS1307|
Level shifter for SD card
If you don't have this part, you've probably got a v1.0 kit. See the parts list below
|32.768 KHz, 12.5 pF watch crystal||1|
|SD/MMC card holder|
|LED1||3mm Red LED||Generic|
3mm Green LED
1/4W 5% 10K resistor
Brown, Black, Orange, Gold
1/4W 5% 1.0K resistor
Brown, Black, Red, Gold
1/4W 5% 2.2K resistor
Red, Red, Red, Gold
0.1uF ceramic capacitor (104)
Looks deceptively like the 0.01uF ceramic capacitor!
|100uF / 6V or greater capacitor||Generic|
|6mm tactile switch||B3F-1000|
|6-pin ICSP header||Generic|
|36 pin male header (1x36)||Generic|
|12mm 3V lithium coin cell|
|12mm coin cell holder|
Step 4: Solder the Kit!
Solder together the kit
Step 5: Use It!
Get 'er loggin'
Once you have your shield soldered up you can use the RTC and SD card for logging time-stamped data.
- The Real Time Clock (RTC) - what it is and how to use it!
- The SD card - Preparation for writing the the SD card
- Fridgelogger - An example project showing (nearly) everything you'll need to know about getting data, and writing it to the SD card
- A detailed walkthrough of the final sketch used in the fridgelogger - a really good idea to read for information on why things are done
Step 6: Download Files
- SDFATlib - a FAT16/FAT32 SD card library perfect for reading & writing from SD cards written by fat16lib
- RTClib - a library for getting and setting time from a DS1307 (originally written by JeeLab, our version is slightly different so please only use ours to make sure its compatible!) - download the .zip by clicking on Download Source (top right) and rename the uncompressed folder RTClib
These files are Creative Commons Attribution, Share-Alike - enjoy!
We have a be nice policy.
Please be positive and constructive.