Click here to Skip to main content
Click here to Skip to main content

Implementing an SMS Quiz Server Using a GSM Modem Enabled Mobile Phone

, 19 Jul 2006
Rate this:
Please Sign up or sign in to vote.
A very simple application that uses SMS to send quiz questions and receive answers and notify winners at the end of the day using a Nokia 6610i and mCore.
Sample Image - SMSQuizServer.jpg

Introduction

This is a great tool to play with SMS, especially when it comes to sending messages to your near and dear ones. Everyone loves it more or less. For years, I have been using SMS without caring much how it really works. Recently, I discovered that using this small technology, some interesting work can be done. I always wondered how SMS quiz is implemented as shown on television or in the newspaper until I found my own developed SMS server with my Nokia 6610i. I came up with an idea of a Quiz Server which is implemented using .NET and SMS.

A Very Few Words about SMS (Short Message Service)

SMS stands for Short Message Service. It is a technology that enables the sending and receiving of messages between mobile phones. SMS first appeared in Europe in 1992. It was included in the GSM (Global System for Mobile Communications) standards right at the beginning. Later it was ported to wireless technologies like CDMA and TDMA. The GSM and SMS standards were originally developed by ETSI. ETSI is the abbreviation for European Telecommunications Standards Institute. Now the 3GPP (Third Generation Partnership Project) is responsible for the development and maintenance of the GSM and SMS standards.

A Little About mCore

mCore™ SMS is a powerful and easy to use ActiveX Component that can be used in your Windows applications and ASP Web pages for mobile messaging using GSM mobile phones or GSM modems connected to serial port or infrared port. Using mCore in your applications allows you to:

  • Send text messages
  • Read incoming text messages
  • Send WAP Push
  • Set various messaging and network parameters (PIN, SMSC, Message Memory, etc.)
  • Read modem and network information (Manufacturer, IMEI, Model, Signal Strength, etc.)

A rich set of properties, methods and its compatibility with wide range of GSM mobile phones and GSM modems makes mCore™ the best choice for any type of mobile messaging application.

The Project

It is not a core project and most intellectual peoples out there will think it as a newbie project but it is really a great playing tool for beginners. In the beginning, I found that I can download photos and upload applications with the Nokia PC Suite, I wondered how I could send SMS using my own program. After several Google searches, I found Nokia PC Suite Connectivity API 1.1. I was unable to use it properly because I have very little knowledge about the development suite. However, I began searching again. I came across AT commands. I was feeling like I was in the middle of MS DOS 6.2 age. The white window was distracting me a lot. I only wanted to send or receive SMS and do some magic with it. I was searching with all my fingers and all the keywords. I was searching for a .NET compliant thing that would ease my task.

At last I found mCore from here. I fell in love with the component. It was love at first sight and I eventually knew it was the right thing for my work. It had detailed help and a wonderful demo project. I began to tweak and made my first Quiz Server that was able to process and notify winners of a Quiz session daily.

The Quiz Server scans for users who sent SMS to get a question every day. At the end of the day, a random user is chosen among all the users who have given the correct answer.

The Ingredients

  • Nokia phone with GSM modem
  • Serial Cable
  • mCore from here

The Procedure

  1. Start/Run the project by pressing F5 and wait infinitely after connecting.
  2. A user sends a SMS with QUES.
  3. The server scans each message and parses to find the request of question and sends the question of the day.
  4. If the user sends SMS with ANS A.
  5. The server records the answer. User cannot send several answers.
  6. At the end of the day, a random user is chosen and a prize SMS is sent to him/her.

The admin of the server can change the question of the day very easily.

Sample screenshot

The Core Code

In the following code, the server scans for all messages in the inbox and sends them to ProcessSMS to parse and save the data. After the message has been parsed, the message is deleted.

private void GetMessageFromMobile() 
 { 
     objSMS.MessageMemory = SMS.EnumMessageMemory.SM; 
 
     mCore.Inbox objInbox = objSMS.Inbox(); 
 
     for (int i = 1; i <= objInbox.Count ; i++) 
     { 
         txtNumber.Text = objInbox.Message(i).Phone.ToString(); 
         txtMessage.Text = objInbox.Message(i).Text.ToString(); 
         bool status = ProcessSMS(txtNumber.Text, txtMessage.Text); 
         if (status == true) 
         { 
             // Delete the Message that has already being parsed 
             objSMS.Inbox().Message(i).Delete(); 
         } 
     } 
 }

This part connects the application with the mobile. Make sure you know the Port number and the SMSC numbers. If you do not know the port name, go to the device manager in My Computer and see the properties in the GSM modem of your mobile phone.

private void btnConnect_Click(object sender, EventArgs e) 
 { 
     try 
     { 
         btnConnect.Enabled = false; 
         objSMS.Port = "COM7"; 
         objSMS.BaudRate = SMS.EnumBaudRate.BaudRate_115200; 
         objSMS.DataBits = SMS.EnumDataBits.Eight; 
         objSMS.Parity = SMS.EnumParity.None; 
         objSMS.StopBits = SMS.EnumStopBits.One; 
         objSMS.FlowControl = SMS.EnumFlowControl.None; 
         objSMS.PIN = "1234"; 
         objSMS.SMSC = "+880150159999"; 
 
         objSMS.Connect(); 
         lbxStatus.Items.Add(objSMS.Model + " Connected "); 
         MyTimer.Interval = 10000; 
         MyTimer.Start(); 
 
         btnDisconnect.Enabled = true; 
     } 
     catch (Exception ex) 
     { 
         btnConnect.Enabled = true; 
         MessageBox.Show(ex.ToString()); 
     } 
 }

This timer scans for messages and processes the winner for the previous day. It also refreshes the inbox. Without refreshing the inbox, new messages will not be detected.

private void MyTimer_Tick(object sender, EventArgs e) 
 { 
     Application.DoEvents(); 
     if(objSMS.Inbox().Count > 0) 
     { 
         GetMessageFromMobile(); 
     } 
     ProcessWinner(); 
     objSMS.Inbox().Refresh(); 
 }

The Server in Action

Sample screenshot

Pitfalls

Good things do not always come for free. I have used mCore which is not free of cost. It sends a message at the bottom of the real message with Powered by logixmobile.com at the end of each message sent. So if you don't want the message, please buy the component from logixmobile.com. You can also write the component by communicating with the serial port with any programming language. Well, that is another story. And, most important is, why invent wheels when it's already there.

Lastly, 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 is about the same no matter whether the mobile phone or GSM/GPRS modem is connected to the computer through a serial cable, USB cable, Bluetooth link or infrared link) and does not depend on whether a mobile phone or GSM/GPRS modem is used (i.e. the SMS sending rate is about the same no matter if a mobile phone or a GSM/GPRS modem is used). The determining factor for the SMS sending rate is the wireless network.

Conclusion

This project will inspire people who have limited components to test and who want to use a SMS based server at home. This project will eventually lead novice programmers to build more useful and robust SMS based applications. I will refine the code or sort out the buggy things if someone wants to learn or share more of it. Till then, Ba-Bye.

History

  • 19th July, 2006: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Zakaria Bin Abdur Rouf
Web Developer
Bangladesh Bangladesh
Zakaria has a keen interest in developing new solutions and exploring new technologies. He has a wide experience in web technologies and business solutions.
 
His latest project includes Library Management System for University of Dhaka using ASP.NET and Sql Server.
 
Zakaria completed Masters in Information Technology from Institute of Information Technology http://iit.univdhaka.edu/,
University of Dhaka, had his BSc in Computer Science from AIUB (www.aiub.edu).
School and college from SKBZBIS (www.skbzbis.com)
 
Latest Project : www.alamgroupae.com
for Alam Group of Companies, Abu Dhabi
 
Some of his Completed projects:
 
www.zakasoft.com
www.musaffah.info
www.shonpapri.com
www.skbzbis.com
www.bdembuae.org (The official website of Embassy of the People's Republic of Bangladesh, Abu Dhabi, United Arab Emirates)
 
Bangla Translation of the Holy Quran (C#/Access)
Library Management System (ASP.NET/C#/SQLServer)
Seat Reservation System (ASP.NET/C#/SQLServer)
 
Besides programming, he has published his first poetry book (na bola kothamala/Unspoken Words) and in the process of writing several new novels.
 
Founded ZakaSoft, a division of ZCom, Providing state-of-the-art solutions in United Arab Emirates.
 
Zakaria Lives in Abu Dhabi and enjoys his spare time in writing and music.

Comments and Discussions

 
Questionvb.net application PinmemberGary Roland23-Jan-13 9:38 
GeneralMy vote of 5 PinmemberMember 43208441-Mar-12 9:29 
QuestionmCore Error Msg Pinmemberseagun2-Jul-11 9:06 
GeneralMake calls and send sms with usb modem Pinmember4x2bit29-Apr-11 0:32 
Questioncan any one help Pinmemberhaider_IT8-Jun-10 19:15 
GeneralQuestion regarding getting the status report whether a message is read or not Pinmembersabarslan18-Sep-09 10:22 
GeneralHelp PinmemberJeffreychou4-May-09 15:51 
Generalserver sms Pinmemberkhadija_y_2123-Apr-09 6:40 
GeneralSend SMS using CDMA Modem PinmemberAsutosha6-Apr-09 0:06 
Generalurgent Pinmemberjo_77729-Jan-09 3:24 
Generalhelp Pinmemberjo_77729-Jan-09 2:46 
GeneralERROR !! Pinmemberanilbpai17-Jan-09 4:28 
GeneralRe: ERROR !! Pinmembertempdoc8-Apr-12 10:40 
GeneralNice one !!! Pinmemberdnpro3-Jun-08 0:48 
GeneralERROR 2002: Error setting selected message memory PinmemberMs. Payal15-May-08 2:19 
GeneralRe: ERROR 2002: Error setting selected message memory Pinmembersensisoft14-Aug-08 13:01 
QuestionConnecting to USB modem Pinmemberabbas layeghi4-Nov-07 3:11 
QuestionRe: Connecting to USB modem PinmemberAram Azhari13-Apr-08 20:34 
QuestionProblem with PIN PinmemberMember #235613511-Feb-07 22:15 
AnswerRe: Problem with PIN PinmemberZakaria Bin Abdur Rouf12-Feb-07 6:15 
GeneralRunning without a connected mobile phone Pinmemberxaml.net13-Jan-07 2:08 
Questionwhat s PIN Pinmemberhamid_m21-Oct-06 1:32 
AnswerRe: what s PIN PinmemberColin Angus Mackay21-Oct-06 1:51 
GeneralNewMessageReceived Event instead of Inbox.Refresh method PinmemberSantanu Biswas7-Aug-06 4:42 
GeneralRe: NewMessageReceived Event instead of Inbox.Refresh method PinmemberZakaria Bin Abdur Rouf12-Aug-06 9:33 
GeneralReal world SMS services PinmemberTili3-Aug-06 3:01 
GeneralRe: Real world SMS services PinmemberSantanu Biswas7-Aug-06 4:29 
GeneralRe: Real world SMS services PinmemberTili9-Aug-06 8:25 
GeneralRe: Real world SMS services PinmemberNewB0724-May-07 17:43 
GeneralRe: Real world SMS services PinmemberTili27-May-07 23:21 
GeneralComments are welcome! PinmemberZakaria Bin Abdur Rouf19-Jul-06 22:24 
GeneralRe: Comments are welcome! Pinmemberabhishek38521-Sep-06 8:16 
GeneralPlease Help Pinmemberkamleshv31-Oct-06 6:51 
GeneralRe: Please Help Pinmemberdungil10122-Mar-07 8:31 
GeneralRe: Comments are welcome! PinmemberManoranjini15-Jan-09 23:50 
GeneralRe: Comments are welcome! Pinmemberhaider_IT8-Jun-10 19:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 19 Jul 2006
Article Copyright 2006 by Zakaria Bin Abdur Rouf
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid