Micro SD and GSM/GPS/GPRS shield with Mega 2560 interface problem

Hey All,

am using 1- Arduino Mega 2560 2- Micro SD Module for Arduino from Cooking-hacks. http://www.cooking-hacks.com/index.php/microsd-2gb-module-for-arduino.html 3- GSM/GPS/GPRS shield from antrax http://www.antrax.de/site/Online-Shop/Home/Arduino-Components/GSM-GPRS-GPS-Shield::51.html

i used ICSP connection for Micro sd module. And for the GPS shield i used the kit as shown in the this PDF file http://www.antrax.de/downloads/arduino-gsm-gprs-gps-shield-mega2560-rework_en.pdf

I tested the SD card and the GPS shield separately and they are working fine, but when i interface them both together i get initialization cant completed for the GPS.

you guys have any idea what would be my problem.if my explanation is not clear you can ask for other information.

PS: Is it possible to take (MOSI, MISO and CS) as common pins and use them for GPS shield and the Micro sd module ??

Waiting for your reply...

I tested the SD card and the GPS shield separately and they are working fine, but when i interface them both together i get initialization cant completed for the GPS.

Without seeing your code (subtle hint), it is difficult to tell what your challenge is. I would suspect you are not managing the slave select lines on each device during setup.

PS: Is it possible to take (MOSI, MISO and CS) as common pins and use them for GPS shield and the Micro sd module ??

The MOSI, MISO, and SCK lines are common to both devices, but the slave select line (CS or SS) must be unique for each device.

Thank you for your reply..

i knew what my problem was... it related to Slave select

and its working now :)

edit: Please do not delete your posts.

sorry i am not good at using forum...and deleted it by mistake

according to cooking hacks i they said to use digital pins to power the SD module...so i used pin 22 to power the sd module.

http://www.cooking-hacks.com/index.php/documentation/tutorials/arduino-micro-sd

so you means the source of those random numbers i am getting in the sd card is powering it from digital pins ? and what should i do to solve this issue

Thank you,

Just glancing at the specs, that uSD unit has a choice of power supplies. One is the digital pin and the other is the ICSP connector. I would use the ICSP connector power. It should have the power to write. Here is the page it is on: http://www.cooking-hacks.com/index.php/documentation/tutorials/arduino-micro-sd Look at "Step 2 : Powering the module".

i used the ICSP connectors…but still i have to connect SS pin as output to make the library work (i used pin 22 as an output and connected it to SS pin of the SD module)
and pin 53 (SS) is already used it for the GPS shield.

so thats why i used the digital pins to make the connection simpler…and since am using the GPS shield which comes on top of the Mega board…it difficult to connect the ICSP connector…

when i run the programme , it shows me in serial monitor “initialization done” for both the uSD module and the GPS shield
and then followed by the GPS readings…and when i open the saved file it should show me the coordinates
but the thing i get is :

no í
a Ž
no valid gps data

GGGGGGGGGGGGGGGGGGG
no valid gps data

4444444444444444444
no valid gps data

,
no valid gps data

,
no valid gps data

,
no valid gps data

5555555555555555555
no valid gps data

,
no valid gps data

,
no valid gps data

,
no í
a Ž
no valid gps data

GGGGGGGGGGGGGGGGGGG
no valid gps data

5555555555555555555
no valid gps data

,
no valid gps data

,
no valid gps data

,
no valid gps data

no valid gps data

no valid gps data

no valid gps data

no valid gps data

no valid gps data

no valid gps data

no valid gps data

this is the code:

#include <GSM_GPS_Shield_Mega.h>
#include <SPI.h>
#include <SD.h>
#include <Stdlib.h>

#define power_pin 7


String gps_data;
File gps_datafile;
int j_old=0;
String old_data[0]=10;

GSM gsm(power_pin,9600);                                                 // (power_pin, baudrate)
GPS gps(9600);                                                          // (baudrate)


void setup()
{
   Serial.begin(9600);
   digitalWrite(power_pin,HIGH);  // make power pin 5V
   pinMode(power_pin, OUTPUT);    // make pin 7 as an output
   pinMode(22, OUTPUT);

   if (SD.begin(22)) 
      {
          Serial.println("initialization done");
          gps_datafile = SD.open("DataFile.txt", FILE_WRITE);

      }
  
    else
      {
          Serial.println("initialization failed!");
      }


  if(gps.initializeGPS())                                            // check the modem initialization
  {
    Serial.println(" Initialization completed");
  }
  else
  {
    Serial.println(" Initialization can't completed");
  }
  
  delay(1000);
  

}

void loop()
{
  
  gps.getGPS();  // get the coordinates
  gps_data=gps.coordinates;
  
  save_data();
  
  gps_datafile.println(gps_data);
  Serial.println(gps_data);
  
  delay(500);

  if(!gps.checkS2())                                                 // if S2 is presed, send a msg including the coordinates
  {
    send_msg();                                                     // call the function
  }

 }


void save_data()
{
  delay(200);
  old_data[j_old]=gps_data;
  gps_datafile.println(old_data[j_old]);
  j_old++;
  
    if (j_old==10)
      {
        j_old=0;
        gps_datafile.close();
        Serial.println("saving is done");        
      }
  delay(100);  
}

There is a power select jumper on the SD card, and it should be set to use the ICSP power, correct?

Also, you may want to check your power for the GPS module. This is from the manual:

NOTE: The Telit GE864 GSM module has a dynamic transmission power control. In poor reception conditions, the transmission power is increased accordingly. In this case, a relatively high current is required from the power supply. Please use a sufficiently sized external power supply. The exclusive use of the USB power supply may result in interruptions (due to voltage drops when sparking)

Yes, am well aware of the power select jumber of th SD card... and regarding powering the GPS, i will try to power it from external power supply and see the results...

Thank you so much or you help.. :)