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


  1. Nice joseph....
    Its good u r still @ same trade...
    good job..
    take care..

  2. Hi Joseph..

    Best of luck for your blog..

    Keep posting...

    When did u start this one? anyway nice to see u hear for blogging.. :)

    Govt employees News

  3. Thanks for adding my site in the reference list

  4. Thanks for adding my site in the reference list...nice post too....enjoy blogging..all the best

  5. hi, with me its not working.. i m checking to all available Com ports but not going well... All available port say "not open"...

  6. Thanks, But I when i connect phone it will automatically shows mobile as removable usb disk and copy all contacts from mobile addressbook
    is it posiible please Help
    Thanks Regards

  7. hi i am developing c# windows application form. here i tried lot of time to send sms through pc to my mobile.but i cant get any idea. pls send the details about that code

  8. Hi. ...can you send to me the code of the program.... this is my email address. . .

  9. I like the article on the topic due to this reason it is seen that other readers are showing their interest by commenting on it.
    send sms from pc


Thanks for your valuable comments.