COLLEGAMENTO SHIELD E ARDUINO MEGA 2560

Salve...
mi trovo in questa situazione:
ho in dotazione arduino mega e una scheda shield gsm ma non riesco a far funzionare nulla sia sotto l'aspetto hardware e software.
Ho provato a configurare il tutto seguendo le istruzioni di questo link: Hardware - Arduino Forum
I miei risultati sono pessimi in quanto non riesco a visualizzare nulla sul Serial Monitor.
come altro tentativo ho provato anche questo link http://www.geeetech.com/wiki/index.php/Arduino_GPRS_Shield
senza far funzionare nulla.
chi mi puo aiutare?
grazie mille simone

La tua scheda è esattamente QUESTA qui ? Se SI, hai letto e fatto esattamente quanto è scritto QUI ?

Guglielmo

Cia Guglielmo
la scheda e arduino è quello riportato in questo Link Seeed Studio GPRS Shield 1.4 and Arduino Mega 2560 – arbitraryuser
io ho seguito le istruzioni riportate in quel Link e anche in questo http://www.geeetech.com/wiki/index.php/Arduino_GPRS_Shield

Simone

Quella NON è una scheda come quella prodotta da Arduino, quindi ... NON puoi seguire esempi che riguardano quella prodotta da Arduino ne la libreria GSM di Arduino !

DEVI seguire gli esempi di SeeedStudio !!!

Quale versione del GPRS Shield hai ? La v1, v2 o la v3 ?

Guglielmo

Ecco le foto!

No, aspetta, quella è un clone di Arduino Mega 2560, io ti ho chiesto che versione del SeeedStudio GPRS Shield hai, perché ne esistono TRE versioni differenti !

Sulla fattura d'acquisto cosa è riportato ?

Guglielmo

Scusa ho fatto casino con le foto.

Eccola la foto

IMG_20151007_213611-1_resized.jpg

Mmm ... dalla foto sembrerebbe un vecchio GPRS Shield v1, ormai NON più in produzione.

La documentazione ufficiale la trovi QUI.

Attento, la Mega ha più porte seriali ed ha delle limitazioni su quali pin la SoftwareSerial può usare, quindi ...

  1. ti consiglio di modificare gli esempi per usare una delle VERE porte seriali della Mega (... visto che ci sono, usatele!)

  2. Se proprio vuoi usare la SoftwareSerial ... leggiti quali pin esattamente possono essere usati sulla Mega.

Guglielmo

Questo è il modulo gsm giusto vedi questo Link
http://www.geeetech.com/wiki/index.php/Arduino_GPRS_Shield

Simone

Il modulo giusto è quello che ti ho linkato io dal sito di SeeedStudio (... che poi probabilmente è lo stesso), e STUDIATI (... che non significa, dai solo un'occhiata!) tutto quello che ti ho linkato, quindi sia le specifiche del modulo, sia quelle della SoftwareSerial, perché se non fai certe modifiche con la Mega non può andare !

Guglielmo

Ciao Guglielmo
come detto da te ho studiato molto, ma senza ottenere un grande risultato.
il mio Arduino sembra che non comunichi con la scheda shield gsm.
ricapitolo quello che ho provato.
codice:
#include "SIM900.h"
#include <SoftwareSerial.h>
//If not used, is better to exclude the HTTP library,
//for RAM saving.
//If your sketch reboots itself proprably you have finished,
//your memory available.
//#include "inetGSM.h"

//If you want to use the Arduino functions to manage SMS, uncomment the lines below.
#include "sms.h"
SMSGSM sms;

//To change pins for Software Serial, use the two lines in GSM.cpp.

//GSM Shield for Arduino
//www.open-electronics.org
//this code is based on the example of Arduino Labs.

//Simple sketch to send and receive SMS.

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];

void setup()
{
//Serial connection.
Serial.begin(9600);
Serial.println("GSM Shield testing.");
//Start configuration of shield with baudrate.
//For http uses is raccomanded to use 4800 or slower.
if (gsm.begin(2400)) {
Serial.println("\nstatus=READY");
started=true;
} else Serial.println("\nstatus=IDLE");

if(started) {
//Enable this two lines if you want to send an SMS.
//if (sms.SendSMS("3331234567", "Arduino SMS"))
//Serial.println("\nSMS sent OK");
}

};

void loop()
{
if(started) {
//Read if there are messages on SIM card and print them.
if(gsm.readSMS(smsbuffer, 160, n, 20)) {
Serial.println(n);
Serial.println(smsbuffer);
}
delay(1000);
}
}

libreria usata da questo link

collegamenti effettuati con questo link

dove sbaglio?
mi da questo tipo di errore (allegato file ?
grazie mille
simone

chi mi puo aiutare?
ho seguito anche questo video ma senza ottenere risultati.

e ho ottenuto sempre un errore di questo benere
ERROR: SIM900 doesn't answer. Check power and serial pins in GSM.cpp

status=IDLE

simone

Primo,
come da regolamento, punto 7, il codice DEVE essere racchiuso tra i tag CODE (quelli che inserisce il bottone </> tutto a sinistra quando sei in edit). Quindi ... cortesemente riprendi il tuo post precedente, editalo e racchiudi il codice nei dovuti TAG.

Poi ...
... come descritto nei commenti :

//To change pins for Software Serial, use the two lines in GSM.cpp.

... hai editato il file GSM.cpp per adattarlo hai pin della SoftwareSerial che tu usi ? Che valori hai messo ?

Guglielmo

scusa Guglielmo ma non ti seguo, ti riassumo nei minimi dettagli cosa ho fatto come ultima prova.
collegamento tra gsm shield è questo:https://ermagherd.files.wordpress.com/2013/04/img_20130407_120640.jpg

scaricato libreria da qua: GitHub - MarcoMartines/GSM-GPRS-GPS-Shield: GSM/GPRS & GPS Shield Library for modules using SIM900/SIM908

fatto modifiche che sono elencate nel file doc-istructions
[1] How to switch between Arduino Mega and Arduino Uno?

Open GSM.h and comment-decomment the appropriate lines like below
e.g. for Arduino Mega
//#define UNO
#define MEGA

If you use Arduino Uno comment the line in HWSerial.h or decomment if
you are using Arduino Mega
e.g. for Arduino Mega
#define MEGA

mi manca da definire l'istruzione riportata che sarebbe questa
[2] How to switch between the old shield (that uses 4 and 5 pins for
SoftwareSerial and the new (that used 2 and 3 pins)?

Open GSM.cpp and comment-decomment the appropriate lines like below
e.g. for the new one

//#define GSM_TXPIN 4
//#define GSM_RXPIN 5
#define GSM_TXPIN 2
#define GSM_RXPIN 3

Premetto che ho provato ha mettere 0,1 oppure 18,19

il codice utilizzato è questo:
#include "SIM900.h"
#include <SoftwareSerial.h>
//If not used, is better to exclude the HTTP library,
//for RAM saving.
//If your sketch reboots itself proprably you have finished,
//your memory available.
//#include "inetGSM.h"

//If you want to use the Arduino functions to manage SMS, uncomment the lines below.
#include "sms.h"
SMSGSM sms;

//To change pins for Software Serial, use the two lines in GSM.cpp.

//GSM Shield for Arduino
//www.open-electronics.org
//this code is based on the example of Arduino Labs.

//Simple sketch to send and receive SMS.

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];

void setup()
{
//Serial connection.
Serial.begin(9600);
Serial.println("GSM Shield testing.");
//Start configuration of shield with baudrate.
//For http uses is raccomanded to use 4800 or slower.
if (gsm.begin(2400)) {
Serial.println("\nstatus=READY");
started=true;
} else Serial.println("\nstatus=IDLE");

if(started) {
//Enable this two lines if you want to send an SMS.
if (sms.SendSMS("333........", "Arduino SMS"))
Serial.println("\nSMS sent OK");
}

};

void loop()
{
if(started) {
//Read if there are messages on SIM card and print them.
if(gsm.readSMS(smsbuffer, 160, n, 20)) {
Serial.println(n);
Serial.println(smsbuffer);
}
delay(1000);
}
};

ma senza ottenere risultati..... anzi mi da questo tipo di errore:
"ERROR: SIM900 doesn't answer. Check power and serial pins in GSM.cpp

status=IDLE"

simone

Cosa non ti è chiaro nella frase : IL CODICE DEVE ESSERE RACCHIUSO NEGLI APPOSITI TAG CODE ? ? ? :o

REGOLAMENTO ... punto 7 ... cambia solo il bottone che ora ha il simbolo </> e si trova tutto a sinistra.

Cortesemente edita i tuoi due post precedenti e correggili

Guglielmo

ciao Guglielmo
questo è il codice che ho caricato su arduino mega

#include "SIM900.h"
#include <SoftwareSerial.h>
//If not used, is better to exclude the HTTP library,
//for RAM saving.
//If your sketch reboots itself proprably you have finished,
//your memory available.
//#include "inetGSM.h"

//If you want to use the Arduino functions to manage SMS, uncomment the lines below.
#include "sms.h"
SMSGSM sms;

//To change pins for Software Serial, use the two lines in GSM.cpp.

//GSM Shield for Arduino
//www.open-electronics.org
//this code is based on the example of Arduino Labs.

//Simple sketch to send and receive SMS.

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];

void setup()
{
     //Serial connection.
     Serial.begin(19200);
     Serial.println("GSM Shield testing.");
     //Start configuration of shield with baudrate.
     //For http uses is raccomanded to use 4800 or slower.
     if (gsm.begin(19200)) {
          Serial.println("\nstatus=READY");
          started=true;
     } else Serial.println("\nstatus=IDLE");

     if(started) {
          //Enable this two lines if you want to send an SMS.
          if (sms.SendSMS("333.........", "Arduino SMS"))
          Serial.println("\nSMS sent OK");
     }

};

void loop()
{
     if(started) {
          //Read if there are messages on SIM card and print them.
          if(gsm.readSMS(smsbuffer, 160, n, 20)) {
               Serial.println(n);
               Serial.println(smsbuffer);
          }
          delay(1000);
     }
};

codice gsm.cpp

#include "GSM.h"
#include "WideTextFinder.h"

//De-comment this two lines below if you have the
//first version of GSM GPRS Shield
#define _GSM_TXPIN_ 18#define _GSM_RXPIN_ 19

//De-comment this two lines below if you have the
//second version og GSM GPRS Shield//
#define _GSM_TXPIN_ 2
//#define _GSM_RXPIN_ 3

#ifdef UNO
GSM::GSM():_cell(_GSM_TXPIN_,_GSM_RXPIN_),_tf(_cell, 10),_status(IDLE)
{
};
#endif
#ifdef MEGA
GSM::GSM()
{
     _cell.begin(9600);
};
#endif


int GSM::begin(long baud_rate)
{
	 // Set pin modes
	 pinMode(GSM_ON,OUTPUT);
	 pinMode(GSM_RESET,OUTPUT);

#ifdef UNO
     if (baud_rate==115200) {
          Serial.println(F("Don't use baudrate 115200 with Software Serial.\nAutomatically changed at 9600."));
          baud_rate=9600;
     }
#endif
     int response=-1;
     int cont=0;
     boolean norep=true;
     boolean turnedON=false;
     SetCommLineStatus(CLS_ATCMD);
     _cell.begin(baud_rate);
     p_comm_buf = &comm_buf[0];
     setStatus(IDLE);

     // if no-reply we turn to turn on the module
     for (cont=0; cont<3; cont++) {
          if (AT_RESP_ERR_NO_RESP == SendATCmdWaitResp(str_at, 500, 100, str_ok, 5)&&!turnedON) {		//check power
               // there is no response => turn on the module
#ifdef DEBUG_ON
               Serial.println(F("DB:NO RESP"));
#endif
               // generate turn on pulse
               digitalWrite(GSM_ON, HIGH);
               delay(1200);
               digitalWrite(GSM_ON, LOW);
               delay(10000);
               WaitResp(1000, 1000);
          } else {
#ifdef DEBUG_ON
               Serial.println(F("DB:ELSE"));
#endif
               WaitResp(1000, 1000);
          }
     }


     if (AT_RESP_OK == SendATCmdWaitResp(str_at, 500, 100, str_ok, 5)) {
#ifdef DEBUG_ON
          Serial.println(F("DB:CORRECT BR"));
#endif
          turnedON=true;
          norep=false;
     }


     if (AT_RESP_ERR_DIF_RESP == SendATCmdWaitResp(str_at, 500, 100, str_ok, 5)&&!turnedON) {		//check OK
#ifdef DEBUG_ON
          Serial.println(F("DB:AUTO BAUD RATE"));
#endif
          for (int i=0; i<8; i++) {
               switch (i) {
               case 0:
                    _cell.begin(1200);
                    break;

               case 1:
                    _cell.begin(2400);
                    break;

               case 2:
                    _cell.begin(4800);
                    break;

               case 3:
                    _cell.begin(9600);
                    break;

               case 4:
                    _cell.begin(19200);
                    break;

               case 5:
                    _cell.begin(38400);
                    break;

               case 6:
                    _cell.begin(57600);
                    break;

               case 7:
                    _cell.begin(115200);
                    break;

                    // if nothing else matches, do the default
                    // default is optional
               }

               delay(100);

#ifdef DEBUG_PRINT
               // parameter 0 - because module is off so it is not necessary
               // to send finish AT<CR> here
               DebugPrint(F("DEBUG: Stringa "), 0);
               DebugPrint(buff, 0);
#endif


               if (AT_RESP_OK == SendATCmdWaitResp(str_at, 500, 100, str_ok, 5)) {
#ifdef DEBUG_ON
                    Serial.println(F("DB:FOUND PREV BR"));
#endif
                    _cell.print("AT+IPR=");
                    _cell.print(baud_rate);
                    _cell.print("\r"); // send <CR>
                    delay(500);
                    _cell.begin(baud_rate);
                    delay(100);
                    if (AT_RESP_OK == SendATCmdWaitResp(str_at, 500, 100, str_ok, 5)) {
#ifdef DEBUG_ON
                         Serial.println(F("DB:OK BR"));
#endif
                    }
                    turnedON=true;
                    break;
               }
#ifdef DEBUG_ON
               Serial.println(F("DB:NO BR"));
#endif
          }
          // communication line is not used yet = free
          SetCommLineStatus(CLS_FREE);
          // pointer is initialized to the first item of comm. buffer
          p_comm_buf = &comm_buf[0];
     }

     if(norep==true&&!turnedON) {
          Serial.println(F("Trying to force the baud-rate to 9600\n"));
          for (int i=0; i<8; i++) {
               switch (i) {
               case 0:
                    _cell.begin(1200);
                    delay(1000);
                    Serial.println(F("1200"));
                    _cell.print(F("AT+IPR=9600\r"));
                    delay(1000);
                    _cell.begin(9600);
                    delay(1000);
                    SendATCmdWaitResp(str_at, 500, 100, str_ok, 5);
                    delay(1000);
                    WaitResp(1000,1000);
                    break;

la libreria è stata presa da questo link

i collegamenti sono come questa immagine
[https://ermagherd.files.wordpress.com/2013/04/img_20130407_120640.jmg

questo è l'errore che mi da è questo

GSM Shield testing.
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:ELSE
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:ELSE
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:ELSE
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:AUTO BAUD RATE
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:NO BR
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:NO BR
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:NO BR
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:NO BR
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:NO BR
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:NO BR
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:NO BR
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:NO BR
Trying to force the baud-rate to 9600

1200
ATT: OK
RIC: AT+IPR=9600
AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

2400
ATT: OK
RIC: AT+IPR=9600
AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

4800
ATT: OK
RIC: AT+IPR=9600
AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

9600
ATT: OK
RIC: AT+IPR=9600
AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

19200
ATT: OK
RIC: AT+IPR=9600
AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

38400
ATT: OK
RIC: AT+IPR=9600
AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

57600
ATT: OK
RIC: AT+IPR=9600
AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

115200
ATT: OK
RIC: AT+IPR=9600
AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ERROR: SIM900 doesn't answer. Check power and serial pins in GSM.cpp

status=IDLE

spero di essere stato preciso questa volta e di non farti perdere del tempo.
simone
](https://ermagherd.files.wordpress.com/2013/04/img_20130407_120640.jpg)

Intanto confronta COME E' SCRITTO il codice originale di GSM.cpp :

//De-comment this two lines below if you have the
//first version of GSM GPRS Shield
//#define _GSM_TXPIN_ 4
//#define _GSM_RXPIN_ 5

//De-comment this two lines below if you have the
//second version og GSM GPRS Shield
#define _GSM_TXPIN_ 2
#define _GSM_RXPIN_ 3

... e di come è scritto MALE ed in modo errato il tuo !!!

poi, tu hai la "first version" o la "second version" ? Inoltre ... ti sei preso la briga di leggere come si usa esattamente quella libreria e di guardare come sono fatti i vari files ?

Ad esempio, ti sei guardato cosa c'è in GSM.h ?

Guglielmo

Anche con il codice inserito da te non funziona.
non so di che versione ti riferisci.
La libreria trovata è quella riportata qua.

e la scheda gsm è questa
simone