Finally I found solution to this problem:
My Pins connections were wrong, it should not be: 0
and 1
it should be 2
& 3
:
2 - RX Arduino
3 - TX Arduino
also SoftwareSerial.h
is not working with SIM900A
Pins:
All connections should be like this:
SIM900A - Arduino
=================
VCC - VDC (+5V)
GND - GND
5VR - Connect to Arduino TX (Pin 3)
5VT - Connect to Arduino RX (Pin 2)
As discussed here.
Very important:
Any program with header/library: #include <SoftwareSerial.h>
is not working but #include <GSM.h>
is working fine. As SoftwareSerial.h
only work with GSM Shield
and SIM900A
isn't a shield.
Program/Sketch to Upload:
/*
SMS sender
created 25 Feb 2012
Originally written by Tom Igoe
But this is modified version
*/
// Include the GSM library
#include <GSM.h>
#define PINNUMBER ""
// initialize the library instance
GSM gsmAccess;
GSM_SMS sms;
void setup(){
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial){
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println("SMS Messages Sender");
// connection state
boolean notConnected = true;
// Start SIM900A GSM
while (notConnected){
Serial.println("Status 1: Please wait a while, If it taking lot of time, \nmeans you have wrong pin connections.");
// If your SIM has PIN, pass it as a parameter of begin() in quotes
if (gsmAccess.begin(PINNUMBER) == GSM_READY){
Serial.println("Status 2: GSM is ready.");
notConnected = false;
}else{
Serial.println("Status 3: Not connected");
delay(1000);
}
}
Serial.println("Status 4: GSM initialized. " );
// calling function to send message
sendMessage();
}
void loop(){
// empty loop
}
// method to send message to specific number just once.
void sendMessage(){
Serial.print("Message is sending...: ");
// send the message
sms.beginSMS("03XXXXXXX "); // Replace XXXXXXX with your mobile number.
sms.print("This is just some message"); // Message content, replace with your's.
sms.endSMS();
Serial.println("COMPLETE!\n");
Serial.println("Message Sent...!\n");
}
Bam, It is working, and it successfully can send message.
Things to remember:
As everywhere being said you need to supply external power supply to SIM900A it requires 5 Volts
and 2 Amphs
.
Connect GND
of SIM900A to Arduino GND
.
Connect VCC+
(above photo connection 2) to 5V
pin of Arduino.
One Problem:
When I upload sketch of:
Example > GSM > TestModem:
to Arduino, I got this output from Serial Monitor:
Starting modem test...ERROR, no modem answer.
Checking IMEI...Modem's IMEI: 0
Reseting Modem... Modem is functioning properly: IMEI: 0
I cannot get IMEI from SIM900A but I can send message.