Saturday, September 26, 2009

Sample projects using C#.Net , Communication GSM modem with PC

In this blog I like to tell you about the communication between the PC and GSM modem in mobile phone. Iam creating this sample application in C#.Net and SQL Server , for communicating with GSM mobile phone we need to know how to execute AT commands in Windows Hyper-terminal.

Microsoft HyperTerminal

Microsoft HyperTerminal is a small program that comes with Microsoft Windows. You can use it to send AT commands to your mobile phone or GSM/GPRS modem. It can be found at Start -> Programs -> Accessories -> Communications -> HyperTerminal. If you cannot find it and you are using Windows 98, then probably you have not installed it. You can go to Control Panel -> Add/Remove Programs -> Windows Setup tab -> Communications list box item -> Details button to install MS HyperTerminal.
for more details follow this web site :

Hypertreminal communicates directly with the modem /mobile connected and instructs the modem. It also gives responses back as OK or error etc. But if we have a application where we need to send SMS after a specific set of actions, then hypertreminal is not useful, since it requiers manual typing. You need to select the COM port on which modem/mobile is connected.(port can be serial port for modem or USB port for mobile).

Sending through hyper-terminal

AT+CMGW="+cell number",129
> Your sms message content [
press ctrl Z ]

Sending SMS through GSM modem.

First let us examine how to send SMS through a GSM mobile phone in C#.Net.

1. Connect the phone to the PC and Install modem driver software , for eg Nokia pc suite
2. Refer the AT commands for communicating with GSM Modem.
3. Test these commands through windows hyperterminal.
4. Find the port address of the COM port of the modem from device manager.
5. Use these port address in our application for sending SMS.

Creating code in C#

Create new project and add new class SMSCOMMS.cs .
In the class import class library Threading, ComponentModel, IO.Ports

Click here to view the whole class file.

Iam now try to develop the receiving the list of inbox items , sent items and trash in a mobile phone.


AT Commands