Hello !
I had already created a topic on this subject a few weeks ago, but I just realized that the tutorial link I sent had nothing to do with the topic. I am so sorry, so here is the fixed version.
I would like to test the GSM SIM900 module as part of my internship project.
Here is the tutorial I followed:
To help me, my internship supervisor sent me the same module, and I also bought a Things.mobile SIM card which is compatible with multiple carriers for my project. I then created an account on thingsmobile.com in order to activate the package of my card.
In addition, I made sure to deactivate it by integrating it into my mobile phone, so that the GSM module program could reactivate it afterwards once inserted.
So, I placed it in the SIM card holder, then I turned the SIM900 up / down programmatically by making its connections with an Arduino UNO. I reproduced the assembly below with 4 wires, and supplied the module with a 5V Adapter.
First, I tested the "Arduino Code - Testing AT Commands" program from the tutorial in question.
Here is the program I used:
#include <SoftwareSerial.h>
//Create software serial object to communicate with SIM900
SoftwareSerial mySerial(7, 8); //SIM900 Tx & Rx is connected to Arduino #7 & #8
void setup()
{
SIM900power();
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
//Begin serial communication with Arduino and SIM900
mySerial.begin(9600);
Serial.println("Initializing...");
delay(1000);
mySerial.println("AT"); //Handshaking with SIM900
updateSerial();
mySerial.println("AT+CSQ"); //Signal quality test, value range is 0-31 , 31 is the best
updateSerial();
mySerial.println("AT+CCID"); //Read SIM information to confirm whether the SIM is plugged
updateSerial();
mySerial.println("AT+CREG?"); //Check whether it has registered in the network
updateSerial();
}
void loop()
{
updateSerial();
}
void updateSerial()
{
delay(500);
while (Serial.available())
{
mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
}
while(mySerial.available())
{
Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
}
}
void SIM900power()
{
pinMode(9, OUTPUT);
digitalWrite(9,LOW);
delay(1000);
digitalWrite(9,HIGH);
delay(2000);
digitalWrite(9,LOW);
delay(3000);
}
First of all, we observe that in the output concerning the AT + CSQ line, the signal strength corresponds to 0dB. However, it should be equal to or greater than 5 according to the tutorial.
Then, concerning the AT + CREG line? to connect to the NETWORK, the first answer displays as the second number "2". However, it is different from 1 and 5 and this means that we would not be connected to a network even though the netlight LED flashes every 3 seconds.
However, we observe another response from CREG displaying only the number "5". Does this mean that I am connected to a foreign network (I live in France by the way)?
Now I want to realize the program to send an SMS to my cell phone. Here then is the 2nd program that I use:
#include <SoftwareSerial.h>
//Create software serial object to communicate with SIM900
SoftwareSerial mySerial(7, 8); //SIM900 Tx & Rx is connected to Arduino #7 & #8
void setup()
{
SIM900power();
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
//Begin serial communication with Arduino and SIM900
mySerial.begin(9600);
Serial.println("Initializing...");
delay(1000);
mySerial.println("AT"); //Handshaking with SIM900
updateSerial();
mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
updateSerial();
mySerial.println("AT+CMGS=\"+330686920417\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms
updateSerial();
mySerial.print("Bonjour"); //text content
updateSerial();
mySerial.write(26);
}
void loop()
{
}
void updateSerial()
{
delay(500);
while (Serial.available())
{
mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
}
while(mySerial.available())
{
Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
}
}
void SIM900power()
{
pinMode(9, OUTPUT);
digitalWrite(9,LOW);
delay(1000);
digitalWrite(9,HIGH);
delay(2000);
digitalWrite(9,LOW);
delay(3000);
}
Then I uploaded it: there is indeed LED D6 which ends up finding the network by flashing every 3 seconds. But by displaying the serial monitor, I only get part of the expected results and I am not receiving text messages on my cell phone.
I have also tried replacing "+3306 ..." with "+336 ..." (because displaying phone number in that way is different in France), but I got the same problem.
But as we can see:
-Command "T" is displayed instead of "AT" at the start of the serial monitor
-The results of the "+ CMGS" command are missing immediately after the display of the message to be sent on the serial monitor. I think the problem would come from there.
I also suppose that the first AT commands test's results could be related to the reason why I can't send SMS to my cellphone.
Could someone help me solve the problem please? How to fix the number issues for the AT+CSQ and AT+CREG? lines ?
Thank you for responding to me quickly.