Send Sms Using Gsm Modem



In this article we are going to learn, how to send and receive SMS using GSM modem which is controlled by Arduino. Let us see, what GSM modem is, how to interface it with Arduino, how to send SMS with the setup.

  1. Send Sms Using Gsm Modem Ip
  2. Send Sms With Gsm Modem In C#
  3. Send Sms Using Gsm Modem Settings
  4. Send Sms Using Gsm Modem With C#
  5. Send Sms Using Gsm Modem
  1. The GSM modem indeed sends a SMS using at commands but the message received is always empty/blank or shows unreadable signs.Please help me to receive correct send SMS.
  2. Using a mobile phone or GSM/GPRS modem to send SMS messages has a major drawback, that is the SMS sending rate is too low. Only 6-10 SMS messages can be sent per minute (when the 'SMS over GSM' mode is used). The performance is not affected by the connection between the computer and the mobile phone or GSM/GPRS modem (i.e. The SMS sending rate.
  3. Use Android phone as modem to send SMS and MMS: Why use Android phone instead of USB modem? Older GSM phones often allowed external software to send and receive SMS messages with a serial port interface, but most modern phones do not support this functionality anymore. Purchase USB modem need additional cost.

We are also going to explore what are all applications we can achieve with GSM modem other than sending text message by a human.

Then use the computer / PC and AT commands to instruct the mobile phone or GSM /GPRS modem to send SMS messages. Connect the computer / PC to the SMS center ( SMS C ) or SMS gateway of a wireless carrier or SMS service provider.

What is GSM modem?

GSM stands for Global System for Mobile communications; it is a standard which was developed by ETSI (European Telecommunications Standard Institute) who described the protocols for 2G communication.

It is the first digital protocol for mobile communication which is optimized for full duplex voice communication. In a nutshell full duplex communication means both the parties can send/receive data (or voice) simultaneously.

The GSM protocol also allows transfer of packet data, such as GPRS and EDGE.

SIM800 GSM modem:

GSM modem is a hardware which accepts a valid SIM card (Subscriber Identity Module), basically any SIM will work, which supports GSM protocol and with a network subscription.

It is like a mobile phone without Screen and keypad. It has four I/O pins depending on the model you choose.

Two for TX and RX (transmit and receive), another two pins for VCC and GND, which is common in all.

It also consist of RS232 port for serial communication between the modem and computer, however we are not going to use in this project.

It has standard DC power jack, which can be powered from external power sources such as voltage adapters.

It has working voltage ranging from 5 to 12V on DC jack, depending on the model. It has 3 LED indicators, for power, status, and network.

The power LED indicates the presence of power, status LED indicates whether the GSM modem is operating or not, the Network LED indicates the establishment of mobile network.

Initially network LED blinks every one second while searching for network, once it establishes the mobile network it blinks every 3 seconds.

You need to press power button for 2 to 3 seconds for activating the GSM modem, once you done, it latch to the mobile network.

To verify that your GSM modem works, just call the number of which you have inserted the SIM card. You should get ring back tone. If it does, then your module is working fine.

We are going to use SIM800 GSM modem which supports quad-band 850/900/1800/1900 MHz. if you own a SIM900 modem, need not to worry, the program and circuit is compatible in this project.

Now, you would have gained some idea about GSM modem, now let’s learn how to interface it with arduino.

Circuit Diagram:

As you can infer form the diagram, the circuit connection is dead easy. You just need 3 male to female header pins. A USB cable is mandatory in this project, as we are going to communicate via serial monitor.

Always, power the GSM modem with external adaptor. The power from arduino is insufficient for the GSM modem; it could even overload the voltage regulator of the arduino.

That’s all about hardware part. Now, let’s move to coding.

Program:

//-------------Program developed by R.Girish---------------//
#include <SoftwareSerial.h>
#define rxPin 9 // gsm TX------> arduino 9
#define txPin 8 //gsm RX--------> arduino 8
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
char text[150];
String message=';
int x;
void setup()
{
Serial.begin(9600);
while (!Serial){}
mySerial.begin(9600);
delay(1000);
Serial.println('Write your message (with dot at end):');
}
void loop()
{
x=0;
while( Serial.available()>0 )
{
text[x] = Serial.read();
message += text[x];
x++;
if (text[x-1]46)
{
Serial.println('Your message is sending......');
SendTextMessage();
ShowSerialData();
delay(1000);
Serial.println('r');
Serial.println('Success');
message=';
x=0;
}}}
void SendTextMessage()
{
mySerial.print('AT+CMGF=1r');
delay(1000);
mySerial.print('AT+CMGS='+91xxxxxxxxxx'r'); // Replace x with your 10 digit phone number
delay(1000);
mySerial.println(message);
mySerial.print('r');
delay(1000);
mySerial.println((char)26);
mySerial.println();
}
void ShowSerialData()
{
while(mySerial.available()!=0)
Serial.write(mySerial.read());
}
//-------------Program developed by R.Girish---------------//

Don’t forget the dot (.) at every end of the message, otherwise it won’t sent the message to prescribed number in the program. Replace x with your 10 digital phone number in the program. Make sure you have a working SMS plan on your SIM card.

If you are not from India, please change the country code in the program.

For example:

For UK: +44
For US: +1
For Canada: +1
For Russia: +7

You can also automate the message which is sent by GSM modem by coding Arduino appropriately. You can receive automated message alerts on your phone such as: anti-theft alert, fire alarm alert, weather alert on your local area etc.

You can even connect to internet with GPRS in GSM modem, but it is subject of another article.

In one of the forth coming articles we will learn How to Receive SMS Using GSM Modem and Arduino

If you have further questions regarding how to send SMS using GSM Modem , feel free to ask in the comment section.

How to Receive SMS Using GSM Modem

In the above discussion we learned how to send a text message using GSM modem and also discussed the basics the GSM modem.

In this section we will discuss regarding how to receive SMS via serial monitor of the arduino IDE. We are not only going to receive SMS but, also send text message by pressing different keys. For an instant, pressing “s” will send pre-enter text message, pressing “r” will receive real time SMS.

Here is author’s prototype:

How it Works

The circuit for receiving SMS using a GSM moden is very simple, you just need 3 male to female header pins. The TX of GSM modem is connected to pin #9 of arduino and RX of GSM modem is connected to pin #8 of arduino and the ground to ground connection is also given between GSM and arduino.

Always use external power supply for GSM modem, don’t connect 5Vcc from arduino to GSM modem, as there is good chance of overloading the voltage regulator of arduino.

Don’t forget to implement SMS rate cutter or something similar on your SMS subscription for reduction on your SMS expenses.

Otherwise you will end up empty account balance after sending several SMS, since there won’t be any acknowledgement from your cellular provider after every sent SMS, as the SIM card is in the GSM modem.

The only acknowledgement you get is warning SMS, regarding your empty account, so be cautious about you expenses. Now let’s move to coding part this project.

Program:

//-----------------Program developed by R.Girish-------------//
#include <SoftwareSerial.h>
SoftwareSerial gsm(9,8);
void setup()
{
gsm.begin(9600); // Setting the baud rate of GSM Module
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
delay(100);
}
void loop()
{
if (Serial.available()>0)
switch(Serial.read())
{
case 's':
Send();
break;
case 'r':
Recieve();
break;
case 'S':
Send();
break;
case 'R':
Recieve();
break;
}
if (gsm.available()>0)
Serial.write(gsm.read());
}
void Send()
{
gsm.println('AT+CMGF=1');
delay(1000);
gsm.println('AT+CMGS='+91xxxxxxxxxx'r'); // Replace x with mobile number
delay(1000);
gsm.println('Hello I am GSM modem!!!');// The SMS text you want to send
delay(100);
gsm.println((char)26); // ASCII code of CTRL+Z
delay(1000);
}
void Recieve()
{
gsm.println('AT+CNMI=2,2,0,0,0'); // AT Command to receive a live SMS
delay(1000);
}
//-----------------Program developed by R.Girish-------------//

Entering the Phone Numbers

Enter the recipient phone number on “xxxxxxxxxxx” in the program with your country code at the beginning.

Enter the text that you want to send in the program within the quotation mark: gsm.println('Hello I am GSM modem!!!'); // The SMS text you want to send

Send Sms Using Gsm Modem Ip

Compile the program and upload to arduino.

Send Sms With Gsm Modem In C#

Insert the SIM card and power the GSM modem with external power supply and press the power button for 3 seconds (depending the model), wait for 10 to 20 seconds to establish mobile network, the network LED should blink once in every 3 seconds. If everything is stated above is done, we are ready to go for next step.

Now open serial monitor and press “r” the GSM modem is ready to receive SMS. Now send a text message from any mobile phone to number of the SIM which is inserted on GSM modem.
The text message should pop up on the serial monitor, something similar to illustrated below:

The “Hello world” is the message sent to GSM modem and the number from which the text message is sent also displayed.

Now, let send SMS to the pre-entered number in the program with pre-entered message. Press “s” and you will see something similar illustrated below: The sent SMS is “Hello I am GSM modem”.

Now, you know how to send and how to receive SMS using GSM modem.

I would like to use a mobile phone or a modem to send short text messages with the PRTG notification system. This way, my messages can also be sent when there is no internet connection available.

How can I do this? What third-party software do I need?


Votes:

0

Your Vote:

This article applies to PRTG Network Monitor 19 or later

PRTG Network Monitor offers multiple methods to relay notifications, including SMTP mail relay, SMS, and pager. This ensures that users are informed in various ways if an issue (such as an outage or a slow server) needs to be brought to their attention.

However, there are times when the normal relay means do not suffice, particularly if the main leased line used to connect to the network (for example the internet) is interrupted. For these purposes, PRTG includes the option to trigger executable notifications which, combined with the proper external software, can overcome this issue with ease. Using an HTTP-enabled GSM modem is another alternative.

See the other answers in this post for examples of third-party software or external devices you could use:

  • PageGate (Support)
  • HWg-SMS-GW3 (guide by HW group)

More

For a link to video instructions for PageGate, see also
Paessler Blog: How to Send SMS and Pager Messages from PRTG—Even Without an Internet Connection

This article applies to PRTG Network Monitor 12 or later, as well as to previous (deprecated) versions

One software we have been recommending a while is PageGate from NotePage.

The following article provides a quick and easy overview of how to define and configure a PageGate notification under PRTG Network Monitor.

  • Install PageGate.
  • Create a carrier (e.g. PRTGCARRIER). Specify the protocol settings according to your needs.
  • Add a recipient: In the example below we used a SMTP recipient for simplicity's sake.
  • Make sure the PageGate service is running.
  • Create a .BAT batch file (e.g. PageGate.bat) within the NotificationsEXE subfolder of your PRTG installation directory.
  • Input the following text (please ensure the path definition matches the directory used):

Note: The path must match the path specified in Interfaces | GetAscii | Settings in the PageGate Admin tool.

(In this example, prtg_admin is the specified recipient. %1,%2 will be replaced with the notification.)

  • Define a new notification within PRTG: Choose Setup | Account Settings | Notifications from the main menu bar and click on Add new notification.
  • Select Execute Program from the notification options by marking the according checkbox.
  • Add the necessary parameters (ensure that the parameters are encapsulated with quotation marks ' ' because otherwise the individual parameter chains might contain empty spaces).
    Example: '[%sitename]' '%device %name %status %down (%message)'
Gsm
  • Save and test.

This method is particularly useful if you wish to ensure the possibility of relaying crucial SMS messages even at times that the main leased line is down and, as such, PRTG Network Monitor is unable to access normal messaging method, such as SMTP servers or SMS gateway.

For the specific steps on how to install PageGate, you'll want to have a look at either of these Video tutorials:

How to install PageGate on Windows XP, Server 2000, and Server 2003:http://www.notepage.net/videos/pagegate-xp-installation.htm

How to install PageGate on Windows Vista, Windows 7, and Server 2008:http://www.notepage.net/videos/pagegate-vista-installation.htm

Once you have PageGate installed, you'll need to configure carriers and recipients. A carrier is a messaging host such as Alltel, Nextel, Sprint, Verizon, etc. Recipients are individuals that receive messages on the carrier's device, such as a Sprint Cel phone or a USA Mobility pager.

Since the setup for the carriers and recipients can be a little complicated for first time users, feel free to email any questions you have to support at notepage dot com

After you have the carriers and recipients configured, you'll need to configure PageGate's GetAscii module as referenced in PRTG's configuration steps above. For a more detailed look at the PageGate side of those steps, please have a look at this video tutorial:

After the GetAscii module has been configured, the final step is to switch PageGate's run style to a Windows Service. To do so, please have a look at this video tutorial:

Again, if you have any questions or run into any difficulties, please contact us at http://www.notepage.net or email us directly at support at notepage dot com

Votes:

0

Your Vote:

This article applies to PRTG Network Monitor 19 or later

PRTG Network Monitor offers multiple methods to relay notifications, including SMTP mail relay, SMS, and pager. This ensures that users are informed in various ways if an issue (such as an outage or a slow server) needs to be brought to their attention.

However, there are times when the normal relay means do not suffice, particularly if the main leased line used to connect to the network (for example the internet) is interrupted. For these purposes, PRTG includes the option to trigger executable notifications which, combined with the proper external software, can overcome this issue with ease. Using an HTTP-enabled GSM modem is another alternative.

See the other answers in this post for examples of third-party software or external devices you could use:

  • PageGate (Support)
  • HWg-SMS-GW3 (guide by HW group)

Send Sms Using Gsm Modem Settings

More

For a link to video instructions for PageGate, see also
Paessler Blog: How to Send SMS and Pager Messages from PRTG—Even Without an Internet Connection

Some users reported they successfully use the software Mobile Master by vendor Jumping Bytes in combination with inexpensive GSM modems. Using the 'Corporate Edition' of this product with the additional option 'SMS Servant' you can send SMS messages on Windows command line, simply withSMS number messageUsing this functionality, they send SMS messages via PRTG's Execute Program notifications. You should be able to set up such a solution for 100 EUR incl. GSM modem.

Using the MWconn Freeware you can realize the transmission of IP-independent notifications from PRTG to your mobile phone both easy and cheap.

PRTG drops text files to a specific folder, and MWconn automatically collects them and sends the content to your mobile phone, using a GSM modem.

We successfully tested this with inexpensive hardware. For a very detailed example, including screenshots and a link to a list of supported hardware, please see the Paessler blog:

The Kentix AlarmManager-PRO has an embedded GSM modem which can send text messages via the mobile network. It is controlled by an HTTP interface. Using this device, SMS text message functionality via GSM can be integrated easily with PRTG.

The big advantage of this solution: You will not need to configure an executable notification, but the Kentix box will integrate directly with the existing HTTP SMS functionality of PRTG! Nevertheless, messages are sent natively (and reliably) via the GSM network (and not via an SMS provider on the internet).

For details, please see:

With the Braintower SMS Gateway you can send notifications as SMS text messages from PRTG. For this, PRTG uses an HTTP API call to the gateway. You can set up this functionality in a quick and easy way.

You will not have to configure an executable notification, but the Braintower SMS Gateway will integrate directly with the existing HTTP SMS functionality of PRTG. So, even if the internet connection is interrupted, you will be able to receive notifications nevertheless.

For details and further instructions, please see this article:

I have found another way.

You can use a Mikrotik RB411U which has a built in Sim card slot.The Mikrotik itself can use netwatch to monitor your PRTG servers and if the server goes down, it will send an SMS.

PRTG can use Powershell and the SSH.NET library found here:http://www.powershelladmin.com/wiki/SSH_from_PowerShell_using_the_SSH.NET_library

Send Sms Using Gsm Modem With C#

The script will use SSH to communicate to the Mikrotik and forward variables generated in the notification section to the Mikrotik.

You can then create a central SMS gateway within your network that multiple PRTG servers can reach and in turn will alert you if connectivity to the PRTG server goes down.

To get notifications even if your internet connection fails, you can use the SMSEagle hardware SMS gateway as a perfect add-on for PRTG. Just set up SMSEagle in your network and provide the corresponding HTTP API call in the SMS notification delivery settings of PRTG. You can also integrate the SMSEagle hardware device into your monitoring to ensure your notification system works.

Send Sms Using Gsm Modem

For details about SMSEagle and further instructions for using it with PRTG, please see this article:

I understand PageGate works, but has anyone used Notepager Pro? For $35. us it is MUCH cheaper than having to buy 5 licenses for PageGate @ $250.00 US.

Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.