# Signal the MCU using GPRS

I am working on a project with a GPRS and MCU. I am feeding the data to my server via GPRS, it's socket server. I was wondering if there is a way ( AT Command ) to do the reverse, I mean I like to send a command to the GPRS from my laptop, then GPRS feed that to the MCU and MCU take it as a signal, for ex. Turn pin 5 high, or anything.

I was thinking to have a case statement in the MCU so it can translate an incoming signal into a MCU command. Is there a way to do that? Or is it too much of hassle?

In principle an GPRS modem can listen to a socket for incoming connections but there are a few problems in practice:

• Most network providers don't give you an externally routable IP address and if they do they are often firewalled. Depending on the provider getting a routable address may be a free option, a paid extra or not available at all.

• If you get a routable address the IP address will normally be dynamic so you need to take care of keeping track of the external address, maybe say using a dynamic DNS providers which then you must write software for (although fairly simple) to keep it updated.

I find that the most reliable method that works across all networks is to poll the server (in this case your laptop) and retrieve any messages.You seem to have communications sorted out in that direction and many modems have varying AT enhancements to make it easier so I'll stick with a broad description of a system I did a while back:

Every 5 minutes the remote unit sends an HTTP POST to the server that sends any outstanding data (even if there is none). The server sends back an HTTP response to indicate that the data was received that also includes any messages destined for the unit. Part of that response also includes a last message sequence number that is sent in the next POST so that the server knows what messages have been previously received and processed OK by the remote unit.

You could also take a look at GSM push notifications, I've never used them myself but believe they are SMS based and their configuration is somewhat network dependent.

• Thanks peter, for your great comment, I'll surly look into it. – David Cameron Jun 11 '13 at 0:04