We were getting some strange behavior out of the SIM900 module.
Some times the module was working ok, and others not so ok. :)
The main problem was in turning on method of the SIM900.
The solution:
Turn off and Then Turn on the SIM900.
The arduino code with the NewSoftSerial:
#define GSM_ON_PIN 8
int AvrHardwareHelper::TurnOffGsm()
{
mySerial.println("AT+CPOWD=1");
delay(3000);
digitalWrite(GSM_ON_PIN, LOW);
delay(2000);
digitalWrite(GSM_ON_PIN, HIGH);
delay(2500);
return atCommandResult;
}
int AvrHardwareHelper::TurnOnGsm(char* pin, int pinSize)
{
mySerial.println("AT+CFUN=1");
delay(600);
mySerial.flush();
mySerial.println("AT");
delay(600);
int numberOfBytesRead = 0;
while((mySerial.read()) > 0)
{
numberOfBytesRead++;
}
if(numberOfBytesRead==0)
{
digitalWrite(GSM_ON_PIN, HIGH);
delay(1200);
digitalWrite(GSM_ON_PIN, LOW);
delay(2500);
}
mySerial.flush();
delay(2000);
.... Do the rest here, at+cpin, etc....
}
pinMode(GSM_ON_PIN, OUTPUT); // sets pin 5 as output
mySerial.begin(9600);
TurnOffGsm();
TurnOnGsm("1234", 4);
This is the main difference with all the samples on the web.
If someone is searching for more info, please just leave a comment.
Thursday, November 10, 2011
Subscribe to:
Post Comments (Atom)
4 comments:
I'm using a module of SIM800L (similiar to SIM900) without a voltage regulator to connect direct to the Arduino, so I'm using a external power supply. All works fine, but I want to connect the reset pin of the module to a digital pin of the Arduino. i'm afraid to do it directly because of the difference between voltages. Do you know if I can do it? or if I need to do something first, what do I need to do? Thanks! Nice blog! =]
Great question. The answer is not so good: i don't know. I'm a developer, but if you are stuck, i can ask someone that can help you out.
Thanks for the comment
I want to SIM900 turn on Automatically after the energy on my house has come back, This tutorial works for me?
Post a Comment