Saturday, June 25, 2011

Using AT commands to send SMS and receive SMS from a GSM modem using a computer - Philippines or anywhere else. PART 2


In my previews post we have learned to link our mobile phone which serves as our GSM modem and used AT commands in the Hyper Terminal to send our SMS. This post will discuss the second function which is to receive SMS using AT commands. The GSM modem can be configured to receive SMS in different ways. It can be Immediate or through a Notification. I will be discussing to you these two modes shortly.


2. Receiving SMS 

Immediate -  The details of the SMS received from the GSM modem is immediately sent to the computer.

AT+CMGF=1
-formatSMS message as text
AT+CNMI=1,2,0,0,0
-sets the mode of the GSM modem to immediately respond when the SMS is received.
-this command should return something like:
+CMT :  "+63xxxxxxxxxx" , , "06/26/11,23:20:00+40"
Hello World!
-the mode we have set will continuously monitor the COM port for messages received from the GSM modem and immediately  send it to the computer.

Notification - A notification is sent to the computer indicating that the GSM modem received an SMS message. The notification contains the memory location of the message which is accessed using an AT command to be displayed in the computer. 

AT+CMGF=1
-formatSMS message as text
AT+CNMI=1,1,0,0,0
-sets the mode of the GSM modem to notify the computer that an SMS is received.
-this command should return something like (SIM Memory):

 +CMTI: "SM",3 
-the notification means that a message is received and stored in location 3 in SIM memory.
-or something like (Memory Card):
+CMTI: "ME",64
-the notification means that a message is received and stored in location 64 in extended memory.
AT+CMGR=3 <Enter>
-the command to read the received SMS from the GSM modem.
-details of the SMS from memory location 3 is then sent to the computer.
-this command should return something like:

+CMT :  "+63xxxxxxxxxx" , , "06/26/11,23:20:00+40"
Hello World!


That shows you how to receive and read the SMS from your GSM modem. After we receive the message its just right to delete the message from our phone memory or memory card. We don't want our mobile phone to be flooded with SMS right?
AT+CPMS=
AT+CMGD=3 <Enter>
-this AT command delete the SMS received stored in location 3 of the GSM modem.
-this command should return "OK" if the message is deleted successfully or an error if the specified memory location is empty.




Great job! We've just learned using AT commands in sending and receiving SMS message from our computer. If you were not able to get it then post a comment and we will discuss your problem. The next post is about getting the codes doing the job for you. Using the AT command you have now the idea on how to integrate it to your application. You can now use a higher level of programming to execute the commands. Try it out for your self. It is free and would not cost you that much of purchasing an SMS gateway software. Watch out for the next post. I'll be using VB.NET window forms to create a sample SMS application. 

Using AT commands to send SMS and receive SMS from a GSM modem using a computer - Philippines or anywhere else. PART 2


In my previews post we have learned to link our mobile phone which serves as our GSM modem and used AT commands in the Hyper Terminal to send our SMS. This post will discuss the second function which is to receive SMS using AT commands. The GSM modem can be configured to receive SMS in different ways. It can be Immediate or through a Notification. I will be discussing to you these two modes shortly.


2. Receiving SMS 

Immediate -  The details of the SMS received from the GSM modem is immediately sent to the computer.

AT+CMGF=1
-formatSMS message as text
AT+CNMI=1,2,0,0,0
-sets the mode of the GSM modem to immediately respond when the SMS is received.
-this command should return something like:

Friday, June 24, 2011

Using AT commands to send SMS and receive SMS from a GSM modem using a computer - Philippines or anywhere else. PART 1


I have recently thought of enabling my application to send SMS to local mobile phones. Have you ever wonder how its being done? In this article I might be showing you how to make your own application capable of sending and receiving SMS. 

The idea was from my instructor in college who developed a software capable of voice messaging and SMS. my instructors design was quite similar to that of OzekiSMS. It is an SMS gateway software widely used for applications with SMS capabilities. The illustration below, from  http://www.ozekisms.com  show you how it is done. 


If you have the money to buy this software, then it will provide everything you need to enable your application to send SMS. It provides API for different programming languages such as ASPPHPC#JAVAVB.NET and more. Sample codes are also provides in the documentation. Okey, so drop off and buy it now. 

Some of you might think of buying the SMS gateway software. But for those of you who don't have much of the money to buy the software, then make your own. Sounds great! And yes you can!

GSM Modem for SMS

I stumbled upon the available resources that I have and found myself looking for a perfect GSM Modem. Here it is! An imitated product of BlackBerry which is commonly called a China Mobile/Phone and a Nokia C3 (now an authentic one) owned by my mother. The mobile phone will serve as our GSM Modem connected to  a work station through a USB connector or Bluetooth. In my case I used Bluetooth to connect my China Phone to the computer.

Serial port connection

The phone connected to the computer will map itself to the COM serial port of the computer. Shown in the screenshot you can see this in the properties of your device. Notice COM6 which is labeled with Standard Parallel Port (SPP). This is the interface that we are going to use to connect to the device.

The next step is using the Hyper Terminal.
Windows XP: Go to START\Programs\Accessories\Communications\HyperTerminal
Vista or 7: Copy the HyperTerminal files from XP.

Connecting to Hyper Terminal

Create a new connection and connect using COM6. Once you have configured your Hyper Terminal you are now ready to work with "AT Commands".


Okey, well said. Lets discuss two basic functions. (Sending and Receiving SMS)

1. Sending SMS
AT
-this command should return "OK" which means that you are connected to your GSM Modem
AT+CMGF=1
-format SMS message as text
AT+CMGS="+63xxxxxxxxxx" <enter>
> Your Message <ctrl+z>
-this is the command to send text message where "+63xxxxxxxxx" is the mobile number of the recipient.
- the " >" indicates the area where you type your message and <ctrl+z> is the key to execute the command.
-this command will return "OK" which means that the message is sent.

Using AT commands in Hyper Terminal


That was quick and easy right? The next part of my post is about receiving the text message with AT commands. Keep in touch for more of these topic which is to make an application to send SMS. I will be using VB.NET in the next post to execute this AT commands and maybe integrate it to ASP.NET. Lets see how thing are done and of course you could also make your own. 

Using AT commands to send SMS and receive SMS from a GSM modem using a computer - Philippines or anywhere else. PART 1


I have recently thought of enabling my application to send SMS to local mobile phones. Have you ever wonder how its being done? In this article I might be showing you how to make your own application capable of sending and receiving SMS. 

The idea was from my instructor in college who developed a software capable of voice messaging and SMS. my instructors design was quite similar to that of OzekiSMS. It is an SMS gateway software widely used for applications with SMS capabilities. The illustration below, from  http://www.ozekisms.com  show you how it is done. 


Thursday, June 23, 2011

a good day to start

Welcome to my programming blog.

This blog is a place for me to share some of my thoughts in programming. My current projects focuses on Microsoft .NET Framework framework using C# and VB as a programming language. Its been 8 months since I have started my journey in developing a web based application using these technologies. The project manager requires the use of PostgreSql as back-end for this project. Also the use of ASP.NET Web Forms is encourage as a starting tool for a beginner like me. After this project I am planning to move through ASP.NET MVC 3. This powerful architecture reminds me of CodeIgniter and other PHP frameworks which I have been working with in my college years. 

Join me through this quest. God Bless! 

a good day to start

Welcome to my programming blog.

This blog is a place for me to share some of my thoughts in programming. My current projects focuses on Microsoft .NET Framework framework using C# and VB as a programming language. Its been 8 months since I have started my journey in developing a web based application using these technologies. The project manager requires the use of PostgreSql as back-end for this project. Also the use of ASP.NET Web Forms is encourage as a starting tool for a beginner like me. After this project I am planning to move through ASP.NET MVC 3. This powerful architecture reminds me of CodeIgniter and other PHP frameworks which I have been working with in my college years. 

Join me through this quest. God Bless! 

You might also like:

Related Posts Plugin for WordPress, Blogger...