arduino + gsm shield 2 stuck [solved]

I try to setup a Weather station that send data through gsm shield to my site. The code will send data every 30 min and then sleep. All work fine for large amount of time but somtimes arduino or the shield (i suspect the shield: stuck. So I try to follow all the steps suggested in the link, but problems persists. Questions: 1 Someone that have similar problem have a good solution? 2 A rude solution and i will a feedback by someone that have experience: Arduino is powered by a 12volt battery, so i have think about a timer switch. He leaves always pass the current, but every 24 hour turns off for a little time, and so reset Arduino. There is a product that can do this without drain all my battery?

Maybe i have solved by myself: I think for the use that i want is better to use an asyncronous connection so fo hu will have my same problem i have do this:

  unsigned long myTimeout = 3000; // YOUR LIMIT IN MILLISECONDS

  unsigned long timeConnect = millis();

  while((millis() - timeConnect) < myTimeout)
    if(gsmAccess.begin(PINNUMBER, true, false)==GSM_READY)
      Serial.println("Not connected");

by following this topic:


hello i have a problem with my connection between the gsm, to the arduino uno, when i turn on the program i get error in the serial screen.

this is my code:


SoftwareSerial SIM900(7, 8); // Configura el puerto serial para el SIM900

char incoming_char=0; //Variable que guarda los caracteres que envia el SIM900 int salir = 0; void setup() { SIM900.begin(19200); //Configura velocidad serial para el SIM900 delay(25000); //Retardo para que encuentra a una RED Serial.begin(19200); //Configura velocidad serial para el Arduino Serial.println("OK"); //Mensaje OK en el arduino, para saber que todo va bien. }

void llamar() // Función que permite llamar a un celular local { // SIM900.println("ATD 10725275;"); //Numero local SIM900.println("ATD +972533432823;"); //Celular delay(100); SIM900.println(); delay(30000); // wait for 30 seconds... SIM900.println("ATH"); // Cuelta el telefono delay(1000); } void mensaje_sms() //Funcion para mandar mensaje de texto {

SIM900.print("AT+CMGF=1\r"); // AT command to send SMS message delay(100); SIM900.println("AT+CMGS=\"+972533432823\""); // recipient's mobile number, in international format delay(100); SIM900.println("Saludos desde HetPro"); // message to send delay(100); SIM900.println((char)26); // End AT command with a ^Z, ASCII code 26 //Comando de finalizacion delay(100); SIM900.println(); delay(5000); // Tiempo para que se envie el mensaje Serial.println("SMS sent successfully"); }

void espera_mensaje() { salir = 1; while(salir==1) { if(SIM900.available() >0) {; //Get the character from the cellular serial port. Serial.print(incoming_char); //Print the incoming character to the terminal. salir = 0; } } } void modo_recibe_mensaje() { //Configura el modo texto para enviar o recibir mensajes SIM900.print("AT+CMGF=1\r"); // set SMS mode to text delay(100); SIM900.print("AT+CNMI=2,2,0,0,0\r");

// blurt out contents of new SMS upon receipt to the GSM shield's serial out delay(1000); } void loop() { llamar(); //Llama mensaje_sms(); //Envia mensaje modo_recibe_mensaje(); for(;;) { if(SIM900.available() >0) {; //Get the character from the cellular serial port. Serial.print(incoming_char); //Print the incoming character to the terminal. } if(Serial.available() > 0) { if( == 'A') break; } } Serial.println("OK-2");

delay(100); SIM900.println(); delay(30000); while(1); // Esperate por tiempo indefinido