Issue with multi-shiled h/w stack (GSM and camera)

Hi Sir/Madam,

I’m trying to interface arduino compatible Camera and GSM module with Arduino Uno.

To keep the demo kit compact and simple I preferred this layered/stack approach. I tested both individually with Arduino Uno and they are working. but when I stack them it is not working.

The Camera Module details: http://www.seeedstudio.com/wiki/Camera_Shield

The GSM module Details:http://www.ebay.in/itm/301311860023?ssP … 1439.l2649

The code i used:

#include <VC0706_UART.h>

#include "SoftwareSerial.h"
#include <SD.h>
#include <SPI.h>
#define SS_SD  10

//use software serial
SoftwareSerial cameraconnection(2,3);//Rx, Tx
VC0706 cam = VC0706(&cameraconnection);
//use hardware serial
//VC0706 cam = VC0706(&Serial);

void setup() 
{
    Serial.begin(9600);
    
//GSM MODULE CODE SECTION
  Serial.print("\r");
  delay(1000);                  
  Serial.print("AT+CMGF=1\r");    
  delay(1000);
  Serial.print("AT+CMGS=\"+919884969933\"\r");    //Number to which you want to send the sms
  delay(1000);
  Serial.print("SMS- HELLO RALAK\r");   //The text of the message to be sent
  delay(1000);
  Serial.write(0x1A);
  delay(1000); 
    
//CAMERA MODULE AND SD CARD CODE SECTION
    Serial.println("VC0706 Camera Snapshot Test ...");
    
    if (!SD.begin(SS_SD)) {
        Serial.println("SD Card init failed...");
        return;
    }  
    if(true == cameraInit()){
        snapShot();
    }else{
        Serial.println("camera init error...");
    }

}

void loop() 
{
    //nothing to do
}

bool cameraInit()
{
    cam.begin(BaudRate_19200);
    char *reply = cam.getVersion();
    if (reply == 0) {
        Serial.println("Failed to get version");
        return false;
    } else {
        Serial.println("version:");
        Serial.println("-----------------");
        Serial.println(reply);
        Serial.println("-----------------");
        return true;
    }
}

void snapShot()
{
    Serial.println("Snap in 3 secs...");
    delay(3000);
    if (! cam.takePicture()){ 
        Serial.println("Failed to snap!");
    }else { 
        Serial.println("Picture taken!");
    }
    // Create an image with the name IMAGExx.JPG
    char filename[13];
    strcpy(filename, "IMAGE00.JPG");
    for (int i = 0; i < 100; i++) {
        filename[5] = '0' + i/10;
        filename[6] = '0' + i%10;
        // create if does not exist, do not open existing, write, sync after write
        if (! SD.exists(filename)) {
            break;
        }
    }
    // Open the file for writing
    File imgFile = SD.open(filename, FILE_WRITE);
    Serial.print("create ");
    Serial.println(filename);
    uint16_t jpglen = cam.getFrameLength();
    Serial.print("wait to fetch ");
    Serial.print(jpglen, DEC);
    Serial.println(" byte image ...");
    int32_t time = millis();
    cam.getPicture(jpglen);
    uint8_t *buffer;
    while(jpglen != 0){
         uint8_t bytesToRead = min(32, jpglen);
         buffer = cam.readPicture(bytesToRead);     
         imgFile.write(buffer, bytesToRead);
         //Serial.print("Read ");  Serial.print(bytesToRead, DEC); Serial.println(" bytes");
         jpglen -= bytesToRead;   
    } 
    imgFile.close();
    time = millis() - time;
    Serial.println("Done!");
    Serial.print("Took "); Serial.print(time); Serial.println(" ms");
    cam.resumeVideo();    
}

I hope there is no issue with the code and only with h/w.

Obsevation:

1 . The GSM module supplier told it needs 12V…And I did. but is it still not sufficient to the third layer camera module?. but for Camera module i think only 5V sufficient.

  1. Camera and Gsm both sharing pin 9 of the Uno board. how can we manage this?

2 . when i change the order of stack its working… ie . lower layer uno, middle layer Camera and on top GSM. but its of no use as the camera will always snap the GSM board in close.

Thanks

  1. Camera and Gsm both sharing pin 9 of the Uno board. how can we manage this?

Unless Seeedstudio made a mistake in the schematic of the camera module, it is actually Arduino pin 8 (D8, PB0). (their schematic says it is physical pin 9, but not from what microcontroller model it is) Both shields use this. The Camera to select the chip for SPI communication, and the GSM to wake-up from sleep.

The image on the GSM Ebay page suggests there is a jumper on the bottom side of the pcb to enable/disable this connection to pin 8. It is not shown on the ebay page or on the GSM board datasheet. So you’ll have to locate it yourself and see if this helps.

GSM Datasheet:

https://drive.google.com/a/researchdesi … V1Rk0/view

Similarly on the Camera shield schematic on the linked page it shows a jumper parallel to the trace labeled CMR. It has the text SPI CS Jumper next to it with a dashed box around it. I don’t know what the intended function of the jumper is (not mentioned anywhere), but maybe you could use this to make the chipselect by Arduino pin 8 optional and re-routeable to another arduino pin (as the chip-select signal IS REQUIRED for the shield to function). Cutting the short trace on the board right next to the legs of the jumper would seem to be the simple solution. And to make the connection to pin 8 functional again you would bridge it with a jumper-cap. However, I have not seen this on the photos of the shield. So don’t trust me on this.