Go Down

Topic: Seeed Studio SD shield (Read 5030 times) previous topic - next topic

leffler9

ok, so i have a long project that I am working on, and this is the first time that I have had to work with microprocessors or anything of the sort.  So I am still in the learning stage of things.  I am working with the Seeedstudio SD shield, and I have already taken up pins 9 -15 (for an lcd display, kinda pointless, but it has its uses), so I have wired up the 3.3 V, the 5V, and two grounds to their respective pins, but I had to wire what was designed for pin D9 to D1 and D10 to D2 and so on.  My question is will it matter what pins I wire the SD shield to, and does anyone have code snippets that could direct me on how to go about coding the program to write to the sd card ( i have coded in java, c++, matlab, and VB, but I am new to straight C).

in case you are curious I am working on a project to send a balloon to the outer atmosphere, collect data, take pictures, pop and come back down.  I will be using 2 arduinos for this project, one as a sensor package, and the other as a gps interface that will have to transmit the location of the arduinos during the flight and when the sensors and everything else end up back on the ground.

thanks

PaulS

It is far easier to change which pins the LCD uses, isn't it?

How you read and write to the SD card depends on which library you are using.

Quote
i have coded in java, c++, matlab, and VB, but I am new to straight C

That's fine, since the Arduino is programmed using C++, which is a superset of C.

Quote
I am working on a project to send a balloon to the outer atmosphere

You are going to have to be pretty tall to read the LCD, aren't you?

orbitalair

Change the pins the lcd is on. 
OR
Add a pcf8574 i2c port expander and wire up your lcd to that.(or you can buy one premade, google rbbb)
http://www.arduino.cc/playground/Code/LCD  see section i2c lcds.

This will put your lcd on i2c bus that is already allocated, and free up 8 pins on your 'duino.


leffler9

the lcd is temporary, but what i need to know is does it matter what pins the sd shield goes into or not

PaulS

Quote
what i need to know is does it matter what pins the sd shield goes into or not

A proper shield fits one way.

Some of the stuff that Seeed is foisting off as "shields" needs to remain in stock until they re-design the item as a proper shield. Whether the SD shield fits in that category, or not, is hard to tell, since you didn't post a link to the device.

Which library are you using to read from the SD card? That may also have an influence on the answer to your question.

leffler9

So the guys from seeed studio emailed me the schematic for their design (see attached), and I have been trying to configure it to work with just the example of readwrite that is included with the arduino software

the cs is pin 10
the hardware ss is pin 10 as well

i am really confused as to how this all works, but I want to learn, any help in getting this to work would be great



/*
  SD card read/write

This example shows how to read and write data to and from an SD card file    
The circuit:
* SD card attached to SPI bus as follows:
** MOSI - pin 11
** MISO - pin 12
** CLK - pin 13
** CS - pin 4

created   Nov 2010
by David A. Mellis
updated 2 Dec 2010
by Tom Igoe

This example code is in the public domain.
   
*/

#include <SD.h>

File myFile;

void setup()
{
  Serial.begin(9600);
  Serial.print("Initializing SD card...");
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
  // Note that even if it's not used as the CS pin, the hardware SS pin
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output
  // or the SD library functions will not work.
   pinMode(10, OUTPUT);
   
  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");
 
  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  myFile = SD.open("test.txt", FILE_WRITE);
 
  // if the file opened okay, write to it:
  if (myFile) {
    Serial.print("Writing to test.txt...");
    myFile.println("testing 1, 2, 3.");
   // close the file:
    myFile.close();
    Serial.println("done.");
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }
 
  // re-open the file for reading:
  myFile = SD.open("test.txt");
  if (myFile) {
    Serial.println("test.txt:");
   
    // read from the file until there's nothing else in it:
    while (myFile.available()) {
       Serial.write(myFile.read());
    }
    // close the file:
    myFile.close();
  } else {
     // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }
}

void loop()
{
   // nothing happens after setup
}




leffler9

ok, so I finally figured it out after I talk to seeed studio for a bit, here is there schematic



i ended up using the full sd fat library by bill greiman

http://code.google.com/p/sdfatlib/

it works just how i would like it to now.

Go Up