SD card to record date stamp on real time clock for IR sensor Help Please

Hi,
Totally new to arduino but I am trying to create a device to record items passing an infrared line and then record this onto a micro sd card and assign a date stamp.

At present I have an arduino Uno, Micro SD shield, Real time clock and the sensors.

First question, can I use header pins to fix the shield to the arduino and is it normal that the shield and card do not totally line up (the power socked and USB socket prevent the shield from laying flat)?

Ot should I be using wire/pins soldered in place and trim the edge of the shield to make it fit.

Has anybody done anything similar to this?

Thanks for any help,

infrared line

Infrared is not laser.

First question, can I use header pins to fix the shield to the arduino

Yes.

is it normal that the shield and card do not totally line up (the power socked and USB socket prevent the shield from laying flat)?

Use longer header pins, then. The Ethernet shield connector is even taller, so there are long pins that allow a shield on top of the ethernet shield to be parallel, without any contact.

Many thanks for your help.

I have soldered the headers into place on the micro SD shield and it now sits perfectly over the Uno. I have then attached wires to the correct headers for a realtime clock.

Silly question, but how do I know if this all works. I have added a sketch to the arduino for the clock, but the micro sd card seems more of a problem. It starts to refer to FAT, so I need to read up on that and insert a micro SD card.
I then need to add the two IR sensors.

Silly question, but how do I know if this all works.

There is an SD library included with the Arduino 1.0 release. There are examples. Put an SD card in, and try the examples. They will either work, or not. If not, fat16lib will be along to explain that it is not his current library, but will explain what is wrong, and how to fix it.

Ok,

I have formatted the micro sd card as FAT.

From serial monitor on COM 3 I get the following error -

Initializing SD card...initialization failed. Things to check:

  • is a card is inserted? - yes
  • Is your wiring correct? - it is a shield so it is in place using header pins and there seems to be only one way to do this.
  • did you change the chipSelect pin to match your shield or module? 8 as it is a sparkfun shield.

Also I note that when I upload the sketch from the library a red light flashes on the shield (it is near the sd card)

Problem solved. I needed to solder all 28 pins, and the power one was not sufficient. I now have a constant red light on the shield and the following message -

Initializing SD card...Wiring is correct and a card is present.

Card type: SD2

Volume type is FAT16

Volume size (bytes): 2004516864
Volume size (Kbytes): 1957536
Volume size (Mbytes): 1911

Files found on the card (name, date and size in bytes):

Just need to add the clock. Does the sketch for the clock need to sit at the end of the sketch for the SD card?