Cell Phone Communication

illnurturedtownvilleMobile - Wireless

Nov 21, 2013 (3 years and 10 months ago)

93 views

Cell Phone Communication

Sam Javner

Spring 2007

http://compsci.snc.edu/cs460/javnsp/

Project Abstract


Usually when we want to share information
between two computers we just use the
internet. But what if one of these computers is
on the move? If we want to get information
such as GPS from a lawn mower, running a cord
is not going to work too well. Many of us already
use cell phones and text messaging to
communicate when we are on the move, so why
not apply this technology to computers?

Project Definition


The current Ariens data acquisition
module captures binary data including:


GPS latitude and longitude


Engine and hydraulic temperatures


Current unit mileage


Last time the unit was run


Last oil change date

Project Definition


The client computer is a PC and the server
computer is an Eye
-
Q

. The client and
server communicate using wireless
modems


Develop a wireless modem protocol and
an API so the wireless communication is
decoupled from the application

Project Definition


Implement an "auto
-
send" option where
either the PC pulls data and/or the Eye
-
Q


pushes the data


Investigate replacing the client PC and
wireless modem with any cell phone


Investigate replacing the client PC with
any landline (Touch
-
Tone) phone

Short Message Service (SMS)


Messages can be up to 140 bytes long


160 7
-
bit Characters (Default)


140 8
-
bit Characters (Useful for Binary)


70 16
-
bit Characters (Unicode)


Messages are queued at a Short Message
Service Center until the receiving phone is
on and has reception


For a GSM/GPRS phone or modem,
messages are stored on a SIM Card

Communication With the Modem


Works like any other
modem


Communicates using a
Serial Port


Uses “AT Commands”


AT Commands are used to
send SMS messages,
along with anything else
we might ask the modem
to do.


About the Eye
-
Q



http://www.gravelyeye
-
q.com/


Used as an embedded
microcomputer on lawnmowers


It can be programmed in C
using CodeWarrior and can do
much the same things as an
ordinary computer even if the
I/O is less “sophisticated.”


Can communicate with the
wireless modem using a serial
port


Can communicate with various
other sensors (GPS,
temperature, etc.)


Methodology


Began with “Proof of Concept” type
programs


Began by creating a Visual Basic program with
the ability to talk back and forth with the
modem


From this starting point, began growing
the project


Serial Port Communication


Communication with the MSComm control
in Visual Basic 6, the SerialPort class in
Visual Basic 2005, and serial
communication as programmed on the
Eye
-
Q
™ device all work similarly


Ideas for communication with the
MultiModem in one of these environments
ought to easily work in any of these
environments

Serial Port Communication


When we want to issue a command to the
modem we simply write to the port


When the modem wants to give us
information, it will interrupt us


OnComm Event in Visual Basic 6


DataReceived Event in Visual Basic 2005


Interrupt handler on the Eye
-
Q


The Importance of Flexibility


Solution had to be flexible.


Because SMS messages are received
unsolicited, responses from user queries to
the modem might be interrupted by a New
Message Indication.


Also, there are other unsolicited messages.
(“RING” if the modem were to receive a call,
random “OK” messages, etc.)

Breaking into Messages

<CR><LF>

ERROR<CR><LF>

<CR><LF>

+CSCS: "PCCP437"<CR><LF>

<CR><LF>

OK<CR><LF>

<CR><LF>

010438000008847<CR><LF>

<CR><LF>

OK<CR><LF>

<CR><LF>

+CNUM: "","19203287458",129<CR><LF>

<CR><LF>

OK<CR><LF>

<CR><LF>

+CMGF: 1<CR><LF>

<CR><LF>

OK<CR><LF>

Taking a stream of data
from the serial port such
as this:

And turning it into
something like this:

ERROR

+CSCS: “PCCP437”

OK

010438000008847

OK

+CNUM: “”,”19203287458”,129

OK

+CMGF: 1

OK

Classification of Messages


Solution involves the classifying of
messages


When I say “message” this is not to be
confused with an SMS “text message”. What I
mean here by “message” is anything the
wireless modem sends to the computer
through the serial port.

Types of Messages


New Message Indication for a newly received text
message


Responses to a user
-
solicited question


Perhaps I asked the modem “What is your serial number?” or
“What is your phone number?” and it is now giving me the
answer.


Response to the question “What messages are stored on
the SIM card?”


This turns out to be a very important question. However, the
answer to this question comes back as multiple responses, which
may be interrupted by other messages.


Other unforeseen messages


We may not care what these messages say, but we can’t let
them crash the system.

Algorithm Using Multiple Queues


Use multiple queues to classify incoming
messages


If we only use one queue, it gets messy. One
message gets interrupted by another message and
soon we’re lost.


If we use multiple queues, we are set. If we asked
the modem a question and we want an answer, we
look in one queue. If we want to check for incoming
messages, we look in another queue, etc. We simply
just have to know which queue to look in.

SIM Card
Message List
Queue

Incoming
Message
Queue

User Response
Queue

Wireless
Modem

OnComm
Event or
Interrupt
Handler

Requests for
Info (Serial #,
Phone #, etc.)

Incoming
SMS
Messages

Request for
SIM Message
List

SIM Card
Message List
Queue

Incoming
Message
Queue

User Response
Queue

What is the answer
to my user solicited
question? (What is
the serial number?,
What is the phone
number?, etc.)

Do I have any new
messages?

What messages are
saved on the SIM
card?

Solutions


Ability to view saved SMS messages (In text
form or hexadecimal form)


Ability to delete saved SMS messages


Ability to create and send SMS messages


Text


Binary, using Hexadecimal representation


Ability to set and retrieve the modem’s internal
clock


Uses polling to check the incoming message
queue for new messages


Auto
-
Reply & Auto
-
Send

Exceptions


Was not able to fully replace a computer with a cell
phone


With many cell phones, including my own, the modem was able
to receive SMS messages from the phone, but the phone was
not able to receive SMS messages from the modem


Perhaps due to differences between GSM/GPRS and CDMA ?????


Was not able to replace a computer with a landline
phone


Harder problem requiring the ability for the computer to
recognize DTMF (Touch
-
Tone) tones. An algorithm exists for
this. There are AT Commands for sending DTMF tones but not
recognizing them.


Did not fully implement solution on the Eye
-
Q


Only “proof of concept” type programs for the Eye
-
Q so far

Demonstrations

Strategies & Learning Techniques


Reading


There’s a reason why others have (hopefully)
documented their creations. It’s a whole lot easier
(and a whole lot less frustrating) to utilize a
technology when you have an in
-
depth manual to
work from.


Other People


Teachers, classmates, and other people have
experience in areas I might not. They also have
working examples to learn from and build from.

Strategies & Learning Techniques


Tech Support


Multitech’s tech support turned out to be of great
help when we were trying to communicate between
it’s wireless modem and the Eye
-
Q



Internet


Great resource for help and examples. Also, here is
where I was able to learn about how SMS messaging
works. As well, I was able to find hundreds of pages
of technical standards concerning SMS. Buried (deep)
inside was some useful information, but it took a bit
of searching.

Knowledge


Certain CS concepts and skills came in
particularly useful for this project, such as


The ability to write flexible, robust code


Important given the nature of the serial port communication
involved.


Generality in designing a solution


Coming up with a solution that can be applied in many
environments.


Knowledge of data structures


In choosing what kinds of data structures might help make
the problem easier.

Possible Extensions


Use the binary capabilites of SMS to transmit GPS data,
temperature data, etc.


Develop a specific protocol for doing so


Develop a protocol for a user to “ask” the Eye
-
Q


unit
for specific information using a cell phone


Perhaps scan the text for specific keywords?


Send longer messages using multiple SMS messages


Generalize application to work with other cell phones,
not just the wireless modem


I can talk to my own cell phone with AT Commands


Other applications of SMS Messaging

Advice


Secure possession of equipment, software,
licenses, books, etc. as soon as possible


Start small and build up from there


Keep up to date with the website


Be creative with and have some fun with
your projects


Questions?