Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


GPRS / PC Communications

Posted on 2004-04-16
Medium Priority
Last Modified: 2007-11-27
Hi. I have a device that will transmit text data (engine temperature, oil pressure, etc.) via the GPRS network to a PC. My job is to recieve this data on the PC and show the information graphically. How would I actually access the GPRS network from this PC (which has a constant Internet connection) to read this data that is streaming through? Once I can read it, the rest (decoding, displaying the data, etc.) is no problem. I just need access to the GPRS network to read the data that this device is transmitting. Can this be done via the Internet (through a standard internet connection) or do I have to use a GSM modem connected to the PC? If it can be done through a standard internet connection, how would I go about doing this? What information do I need to know? Any help will be greatly appreciated. Thanks
Question by:f_rodriguez
  • 3
  • 3

Expert Comment

ID: 10868036

how does the device sends it sata? is it a SMS message? Is the device e-mail capable?

Most of the mobile provider offers the possibility to send email on reception of a sms. That could be an easy way as receiving a mail is easier than a sms.

Just an idea I tought could help...


Expert Comment

ID: 10904194
GPRS and GSM  typically will support TCP/IP and/or UDP packets.  Many of the unist also support serial interface etc.   You need to aqcuire some protocol specs here on the device that will be sending the message to you.  After doing that you will need to more than likely write a service of some nature that sits on the packet receiving pc and listens in for the data.  I'm currently developing something very similar (this weekend).  

>How would I actually access the GPRS network from this PC (which has a constant Internet connection) to read this data that is streaming through?

All you will need to do is get the specs on the GPRS device you are using and find in there how to configure the "host ip address" and "host port".  That will be your pcs IP address and port of your service running.  You may need to spend some more time configuring the device too based upon your needs.

>Can this be done via the Internet (through a standard internet connection) or do I have to use a GSM modem connected to the PC?

All you need is a good old friendly connection to the internet.

>If it can be done through a standard internet connection, how would I go about doing this? What information do I need to know?

All you need is an internet connection, the devices protocol specification, more than likely a serial port to initially configure your device to tell it where to send it's data and configure it.

That should be about it.  Hope all is going well.

Accepted Solution

danielsonchris earned 1000 total points
ID: 10943889
Seems like you are really on track here.  To change the port and ip use the following as you're more than likely already on top of.  :)

AT#SKTSET = 0,<your port>,"<your ip or domain name>"

Honestly, I think you should write a socket server and collect the data from that point using good old TCP/IP.  IMHO, email messaging seems really tacky.  I've been doing a lot of work on a satellite network that uses email at the gateway level to send it's messages...  ick!

So let's say you wrote a TCP based socket server that runs on port 3000 at say ip address... 207.167.xx.xx
you would configure the GPRS/GSM unit with the correct settings such as:
1,"IP","internet.gprs","",0,0<cr>(1-GPRS context setting)
AT#USERID = "Happy User"<cr>(2-Authentication setting)
AT#PASSW = "EASY GPRS"<cr>(2-Authentication setting)
AT#SKTSET= 0,3000,"207.167.xx.xx"

At this stage you would then need to create a protocol that allows your socket server to handle requests and responses accordingly.  Because you are using GPRS and speed is a factor (of course UDP will be faster than TCP/IP, but no guarrantees that your packet will get where it was supposed to go) you more than likely will want to keep your query (request) packets down to the size of no more than 10 bytes.  Your response can then be parsed by the embedded C code and acted upon accordingly.  The whole gist of this is fairly simple.  But really the way to do this is by writing a socket server.  Either way, the embedded C programmer is going to have to code out some sort of protocol in order to allow your communications to be understood by the device.  
I hope I haven't gone off on too much of a tangeant.  What is funny is I have the very same deadline as you.. this friday for a gprs device.
Good luck,
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 10947641
Hi Chris

Thank you very much for your support. As you can see, I have accepted your answer and awarded you 250 points. I just want to know a few more things if possible:

Could you please explain the parameters in the first line of the AT connection string (AT+CGDCONT = 1,"IP","internet.gprs","",0,0<cr>)? The second and third lines look easy enough (username and password) and the fourth line, as you confirmed, was just as I suspected - the IP address and port on which to transmit/receive. Obviously the first line is connection information. The "IP" string I'm guessing just states the protocol which will be used. What would "internet.gprs" be? Then "" I'm guessing would be the IP address of my GSM Service Provider? I don't know what the last two parameters are either (0, 0).

Secondly, if I wanted to use UDP instead of TCP, which I know is a connectionless protocol and has less overhead, wold it be very different? Could you maybe show me the AT commands required in this case?

Thirdly, once connected, can the unit simply transmit data to the GSM/GPRS modem as though we had a direct connection (such as a dial-up)? In other words, once the connection has been made, can the unit simply stream text data through its serial port to the GPRS modem and it will get streamed through the Internet to the specified IP address and port so that on my side, I can receive this stream of data by listening on that same port?

And last question, how can we know (from the unit side or from my side) when the connection has been established and when the connection drops? I read somewhere that if you lose the connection, the GSM/GPRS modem will generate the message "NO CARRIER", just like when you lose the connection in a standard dial-up connection. Is this true? Is it safe to assume that when we connect it will also generate a similar message, like the dial-up "CONNECT 9600" message?

I have 170 points left which I can award, although I'm not sure how I would do this since I seem to have closed the question by accepting your previous question. I'll ask the moderator....

Again, thanks for all your help Chris. If there is anything I can assist you in, please let me know. I've got lots of experience in serial port communications, SMS/Dial-Up connections, GPS and GIS (digital mapping).


Author Comment

ID: 10947825
Oh, by the way, it interesting that both our deadlines for our GPRS projects is on Friday. Luckily, mine is going to be extended because the developer developing the unit is having problems. Isn't it wonderful when your deadline gets extended because of someone elses fault? :)

Funny enough, I seem to have struck another coincidence with Dan Rollins - the editor of this page. It appears we both began our programming careers on a Radio Shack TRS-80. Small world.... ;)

Expert Comment

ID: 10954428
Sorry about the delay in response.  
I was going to start typing a ton for the AT+CGDCONT cmd, but lookie here..
--or-- C & P

AT+CGDCONT=<cid>, <PDP_Type>, <APN>, <PDP_Addr>

This command specifies PDP context parameter values for a PDP context
identified by  the (local) context identification parameter, <cid>.  A special
form of the set command, +CGDCONT= <cid> causes the values for con-
text number <cid> to become undefined.

This PDP Context Identifier is a numeric parameter
which specifies a particular PDP context definition.
The parameter is local to the TE-MT interface and is
also used in other PDP context-related commands. If
no cid is given, nothing will be changed (neither
context definition nor undefinition)

Packet Data Protocol type is a string parameter which
specifies the type of packet data protocol:

IP    Internet Protocol (IETF STD 5)

Access Point Name is a string parameter (framed by
quotation marks) which is a logical name that is used
to select the GGSN or the external packet data net-
work. If the value is null or omitted, then the subscrip-
tion value will be requested.

String parameter that identifies the MT in the address
space applicable to the PDP (e.g. IP V4 address for
PDP type IP). If the value is null or omitted, then a
value may be provided by the TE during the PDP
startup procedure or, failing that, a dynamic address
will be requested.

>Secondly, if I wanted to use UDP instead of TCP, which I know is a connectionless protocol and has less overhead, wold it >be very different? Could you maybe show me the AT commands required in this case?

In my current circumstance using UDP is something that is handled in my configuration string per the IntelliTrac X8 unit.  Other than that... I would think it really depends on the modem you're using.  Mine is literally flipping a bit to 0 or 1 for UDP or TCP/IP.  And it's in a non-AT command that get's filtered by a Toshiba micro-controller.

When you connect you should be able to query that you are in fact connected.  The best thing you can do is find out which modem you are focusing on and go download the manual for it.  There you will find all the commands that you need.  
Here are a few to start:
AT+CREG?     check to see if the GSM network is registered (result should be +CREG: 0,5)

AT+CGATT?    check to see if GPRS is ready and available (result should be +CGATT:1)

Well, sorry gotta run and get my project up and running!
Interesting coincidences you were mentioning.
Take care,

Author Comment

ID: 10979908
Thank you very much for all your support Chris. To be honest, didn't understand too much the above reply, but not because you didn't explain it properly, but simply because I am very new in this field and my terminology is limited. However, I'm sure it will help me. Also thanks for the suggestion of downloading the manual for the modem I'm using. I will do that immediately. I can't believe it never occured to me to do so before. For interests sake, I'm using a Falcom Tango GSM/GPRS modem (www.falcom.de).


Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Loops Section Overview

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question