MarcoMartines / GSM-GPRS-GPS-Shield

GSM/GPRS & GPS Shield Library for modules using SIM900/SIM908
GNU General Public License v2.0
207 stars 151 forks source link

IComSat SIM900 POWER ON code #11

Closed mpena2099 closed 10 years ago

mpena2099 commented 10 years ago

Hi!

I'm using the "IComSat v1.1 -SIM900 GSM/GPRS shield" and, as you can see on the datasheet (ftp://imall.iteadstudio.com/IM120417009_IComSat/DS_IM120417009_IComSat.pdf, page 6), "the pin 9 of Arduino interface is connecting to PWRKEY, and a high pulse with 400us wide can power on/off it."

So, to my sim900 module works I have to put this in the code, before calling "gsm.begin":

#define SIM900_POWER 9

void setup() 
{
  //Serial connection.
  Serial.begin(9600);
  Serial.println("GSM Shield testing.");

  // Power on SIM900 module
  pinMode(SIM900_POWER, OUTPUT);
  digitalWrite(SIM900_POWER, HIGH);
  delay(500);
  digitalWrite(SIM900_POWER, LOW);  
  delay(5000);  
  // end

  //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");
  ...
  ...
  ...

Without that lines the module responds as follows:

............................................ GSM Shield testing. DB:NO RESP DB:NO RESP DB:NO RESP Trying to force the baud-rate to 9600

1200 2400 4800 9600 19200 38400 57600 115200 ERROR: SIM900 doesn't answer. Check power and serial pins in GSM.cpp

status=IDLE ............................................

The problem is not why my code is working with these lines. The problem is: why YOUR CODE is working without that? :?

Note: in GSM.h there are two lines that I think don't do nothing:

43 // pins definition 44 #define GSM_ON 8 // connect GSM Module turn ON to pin 77 45 #define GSM_RESET 9 // connect GSM Module RESET to pin 35

Thanks! Mauricio

MarcoMartines commented 10 years ago

The powerup procedure is the same of the poweroff. The powerup is already done within the begin() function. If you powerup the module manually before the begin(), it will power off the module.

2014-11-14 17:29 GMT+01:00 Maurício Pena notifications@github.com:

Hi!

I'm using the "IComSat v1.1 -SIM900 GSM/GPRS shield" and, as you can see on the datasheet ( ftp://imall.iteadstudio.com/IM120417009_IComSat/DS_IM120417009_IComSat.pdf, page 6), "the pin 9 of Arduino interface is connecting to PWRKEY, and a high pulse with 400us wide can power on/off it."

So, to my sim900 module works I have to put this in the code, before calling "gsm.begin":

define SIM900_POWER 9

void setup() { //Serial connection. Serial.begin(9600); Serial.println("GSM Shield testing.");

// Power on SIM900 module pinMode(SIM900_POWER, OUTPUT); digitalWrite(SIM900_POWER, HIGH); delay(500); digitalWrite(SIM900_POWER, LOW); delay(5000); // end

//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"); ... ... ...

Without that lines the module responds as follows:

............................................ GSM Shield testing. DB:NO RESP DB:NO RESP DB:NO RESP Trying to force the baud-rate to 9600

1200 2400 4800 9600 19200 38400 57600 115200 ERROR: SIM900 doesn't answer. Check power and serial pins in GSM.cpp

status=IDLE ............................................

The problem is not why my code is working with these lines. The problem is: why YOUR CODE is working without that? :?

Note: in GSM.h there are two lines that I think don't do nothing:

43 // pins definition 44 #define GSM_ON 8 // connect GSM Module turn ON to pin 77 45 #define GSM_RESET 9 // connect GSM Module RESET to pin 35

Thanks! Mauricio

— Reply to this email directly or view it on GitHub https://github.com/MarcoMartines/GSM-GPRS-GPS-Shield/issues/11.

mpena2099 commented 10 years ago

Ok @MarcoMartines but the code only works here with these lines (powerup procedure) before begin():

// Power on SIM900 module
  pinMode(SIM900_POWER, OUTPUT);
  digitalWrite(SIM900_POWER, HIGH);
  delay(500);
  digitalWrite(SIM900_POWER, LOW);  
  delay(5000);  
  // end

Without it... DB:NO RESP DB:NO RESP DB:NO RESP

:-/

Xuob commented 10 years ago

@mpena2099 For icomsat 1.1 to work just change pin definitions in GSM.h as shown below

#define GSM_ON          9 
#define GSM_RESET       8 

so it will match pins connections on the board. No need to run additional code:smiley:

mpena2099 commented 10 years ago

Thanks @Xuob and... that is embarrassing. Now I see that I was not using the latest version of the library... :flushed:

And... no change was necessary after using the last commit of the library. So the default:

#define GSM_ON                 8 
#define GSM_RESET           9 

Works!

Thanks a lot!

Otavioensa commented 9 years ago

Thanks so much!! I spent one day long trying figure out what was not ok! Thank you ! Its working now! I just had to change GSM.h to :

define GSM_ON 9

define GSM_RESET 8

dineshimatrix commented 9 years ago

Dear Sir,

i have no shield and i have one sim900 module with rx and tx pins only.i have connected my sim900 module tx, rx pins only to arduino mega2560. now i have connected the sim900 module to serial port 1 of mega and i have changed all the pin as mentioned in your instructions file. but always i get only DB: NO RESP . please help me how to connect the sim900 to mega2560

marcobosa commented 8 years ago

Hi @mpena2099 , can you share the library? I have the same problem... Thanks.

Hermawanz commented 8 years ago

include "SIM900.h"

include < SoftwareSerial.h >

include "sms.h"

SMSGSM sms;

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

char sms_position; char phone_number[20]; char sms_text[100]; int i;

void setup() { //Serial connection. Serial.begin(9600); Serial.println("GSM Shield testing."); if (gsm.begin(2400)){ Serial.println("\nstatus=READY"); started=true;
} else Serial.println("\nstatus=IDLE");

if(started){ { if (sms.SendSMS("+6282283500114", "Arduino SMS")) { Serial.println("\nSMS sent OK"); } else { Serial.println("\nError sending SMS."); }

}}};

void loop() { if(started) { if(gsm.readSMS(smsbuffer, 160, n, 20)) { Serial.println(n); Serial.println(smsbuffer); } delay(500); } }

//// help me its sim900A , im not work GSM shield testing trying to force the baud-rate to 9600

ERROR= SIM900 doesn't answer. Chek power and serial pins in GSM.cpp

Status=Idle

ivanfelipecp commented 8 years ago

I have this error:

GSM Texting...Trying to force the baud-rate to 9600

1200 2400 4800 9600 19200 38400 57600 115200 ERROR: SIM900 doesn't answer. Check power and serial pins in GSM.cpp

status=IDLE

and all the code and conections are ok

Yamapalla commented 8 years ago

i have ICOMSAT 1.1 and i changed the code in GSM.h as u mentioned above.

define GSM_ON 9

define GSM_RESET 8

and now my irs turn off automatically and meanwhile the same error has indicating

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

Please Help me to sort this.

blacktorch commented 8 years ago

If you are using Arduino Mega 2560, follow these steps. [1] How to switch between Arduino Mega and Arduino Uno?

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

2)
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

3)
Save and compile

[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)?

1)
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

2)
Save and compile

Connect the RX pin of your sim module to pin 18 of your arduino mega and the TX pin to pin 19 of the arduino mega. This is because the library uses Hardware serial for mega. Connect VIO pin of your sim module to IOREF pin of your arduino mega and the connect the GND of your sim module to GND of your arduino mega. That's all.

tayfunslife commented 8 years ago

Could you please give information how we can do it with micro , nano version

quique123 commented 8 years ago

I have an issue where the library works with the Mega using the sendsms() method. I can see all the debug commands which work and the sms is received.

So Ive tried to use the nano with the library and directly with AT commands, this is what Ive found:

Library But when I try to use the nano, I cant upload the sketch with references to Serial1 in HWSerial, so I changed them all to Serial instead. I can see the logs again and I noticed that CPMS returns error whenever it doesnt work on the nano. When it works in the Mega, CPMS returns OK in the logs.

AT Commands I tried sending the sms with CMGS but the sms is never received. I started looking at the library and noticed that Im not using the pulse method, forceON(). I then googled it and found this thread and others where it seems to state that pulsing is required. The problem is I dont have the shield, I have a SIM900 breakout and thus cant really access the powerkey pin.

But I have made it work before. I dont know how, but I think switching to the mega/library sketch must have done something and i managed to receive a couple of sms from the nano/at sketch. That only worked for that session and when I tried to repeat it it stopped working.

Ive' posted about the issue here:http://forum.arduino.cc/index.php?topic=428200.msg2952179#msg2952179