Posts Tagged “modem”

If you make applications with GPRS modems, a lot of the time you will encounter the problem that IP addresses, which are assigned by the network operator, are dynamic.

What’s a dynamic IP? It means that every time one of your modems connects to the GPRS network, the operator will give it a different IP address.

For a lot of applications it won’t matter. For example if I have a modem that collects data from a datalogger and the modem sends the data to a central server via GPRS at the end of the day, it doesn’t matter if the modem’s IP address is dynamic. So in this case it’s the modem that makes the connection to the central server (which must have a fixed IP address or a DNS at least).

dyndns

 

The problem arrives when we want to work with GPRS modems in server mode i.e. with modems that are permanently connected to GPRS and are listening to a specific TCP port waiting for incoming connections (typical remote maintenance). In this situation you need to know the modem’s IP address. There are various solutions to resolve this problem. I will talk about one of them today – DynDns service.

With DynDns you can assign a specific IP address to a DNS for free. To do this, you just have to open an account ww.dyndns.org.

Let’s look at a concrete example.

I’m not going to give you an example with Java instead we are going to look at it with AT commands. Doing it with Java (from the following) is practically that same as using the ATCommand class.

Imagine that we have created our own account in DynDns.org with the following data:

DNS server: members.dyndns.org
Host: blogelectronica.dyndns.org
Login: mylogin
Password: myPassword
Current IP: 80,100,101,102 (the IP assigned by the operator)

What I want to achieve with the modem is that the blogelectronica.dyndns.org address points to the IP address 80.100.101.102 (which was assigned by my operator at a given time). This means that if do a ping from my PC to blogelectronica.dyndns.org it will have the same response if I do a ping to 80.100.101.102.

Which AT commands are required to make blogelectronica.dyndns.org point to the IP 80.100.101.102? 

Well to configure the GPRS connection profile (with Movistar) use the following:

AT^sics=0,conType,GPRS0
OK
AT^sics=0,inactTO,20
OK
AT^sics=0,user,MOVISTAR
OK
AT^sics=0,passwd,MOVISTAR
OK
AT^sics=0,apn,movistar.es
OK
AT^sics=0,dns1,80.58.0.33
OK

To configure the http service profile use the following (note that for DynDns you need to use basic authentication protocol with login and password, therefore we turn on hcAuth):

AT^siss=0,srvType,Http
OK
AT^siss=0,conID,0
OK
at^siss=0,user,miLogin
OK
at^siss=0,passwd,miPassword
OK
at^siss=0,hcMethod,0
OK
at^siss=0,hcAuth,1
OK
AT^siss=0,address,http://members.dyndns.org/nic/update?hostname=blogelectronica.dyndns.org&myIP=80.100.101.102&
wildcard=NOCHG&mx=NOCHG&backmx=NOCHG
OK

Finally we keep the socket open to initiate the HTTP connection:

AT^siso=0
OK
^SIS: 0, 0, 2201, “HTTP/1.1 401 Unauthorized”
^SIS: 0, 0, 2200, “HTTP Redirect to:members.dyndns.org:80/nic/update?hostname=blogelectronica.dyndns.org&myIP=80.100.101.102&
wildcard=NOCHG&mx=NOCHG&backmx=NOCHG”
^SIS: 0, 0, 2201, “HTTP/1.1 200 OK”
^SISR: 0, 1
Este último evento ^SISR: 0,1 indica que han llegado datos al socket “0″ y tenemos que leerlos con AT^SISR:
AT^sisr=0,1500
^SISR: 0, 17
good 80.100.101.102
OK

 

By only doing this, we have associated the DNS blogelectronica.dyndns.org to the IP 80.100.101.102 for free and without having to pay a monthly fee to the operator. If I remember correctly they charge around 12 Euros + VAT for each fixed IP address. This is something that we will later incorporate into MTXTunnel, although possibly we may only do it in the advanced version.

Well, I hope that this post has been interesting for you and useful for your Siemens / Cinterion GPRS modem applications, as you can see you can do everything with them they are marvellous. ;)


Puedes comentar este post en el nuevo Foro (click aquí)

- (10) Posts
Tags: , , ,

Comments Comments Off

If you’ve ever worked with GPIOs from Cinterion TC65 or XT65 (or their MTX terminals), you will have realized that there are different ways to work with them. There are AT commands that allow us to set a specific GPIO as an input/output and there are other AT commands that let us know the status of the GPIO set as an input (1 or 0) or even allow us to change an output status.

In one of the Java examples that I have been posting on this blog, specifically in the GPIO EXAMPLE, I simply used the command AT^SGIO which returns the pin status at that point in time. So it depends on the application that you want to run as this AT command could suffice, but this system isn’t usually used as we obtain a very low “sweep frequency” (in addition to loading the system) and therefore it’s very complicated to detect very small changes in the input pin status. If for example you have to detect a volumetric detection pulse, you might not catch it.

modem-entrada-digital

The best thing to do to detect GPIO status changes is to use polling. This way the modem sends you a URC message each time a GPIO change is detected.

Let’s look at an example. Imagine that you want to control GPIO1, GPIO2, GPIO3 and GPIO4 inputs. How do we do it?

Well the first thing you need to do is enable the GPIOs, to do this send:

AT^SPIO=1

Then, configure the pins GPIO1, GPIO2, GPIO3 and GPIO4 as inputs, to do this:

AT^SCPIN=1,0,0

AT^SCPIN=1,1,0

AT^SCPIN=1,2,0

AT^SCPIN=1,3,0

After that we create a port, i.e. a port with all of the GPIOs that we want to involve in the polling process:

AT^SCPORT=0,1,2,3

By sending this command, the AT command will return an IDPort (port identifier) e.g. it will response with IDPort = 112

And now we have everything ready to activate polling. We activate doing this:

AT^SCPOL=1,112

This way whenever there is a change in one of the GPIOs, the modem will send us a URC in this style:

^SCPOL: 112, x

X can be worth 0-1024 i.e. it returns the status of the 10 possible GPIOs that you can control with the TC65 modem.

Well I’ll be back another day, I’m going to go and make dinner now as today CSI Las Vegas is on and it’s the only bit of TV I watch all week. The truth is every time I watch the TV I realize that I like is less and less. Am I getting old?! :S

Tags: , , ,

Comments 9 Comments »

On several occasions I have been asked how to create a dial-up network connection with an MTX63 GPRS modem or an MTX-HC25 UMTS/ HSDPA modem. Sure it’s obvious for most of us, but not for people who are less accustomed to using modems (this is normal as nobody is born with this knowledge, but throughout my life I have met people who strangely seem to think otherwise…).

So for those of you who don’t know how to do it, here are the steps for how to create a dial-up network connection via USB for the MTX63 and MTX-HC25. Actually the following applies to any modem, either for the modems mentioned before, for the MTX65 or the MTX65+G or even mobiles if you can connect them via USB so that they act as a gprs or umts modem.

Acecso telefónico a redes
How to create a dial-up network connection with a GPRS/UMTS modem (with Windows XP):
1.-Install the modem’s USB driver.
2.-Click on the “Start” menu -> Connect to -> Show all connections
3.-Go on the left hand menu -> click on “Create a new connection”.
4.-Click on the button “Next”
5.-Select “Connect to the Internet”. Click the “Next” button.
6.-Select “Set up my Connection Manually”. Click the “Next” button.
7.-Select “Connect Using a Dial-Up Modem”. Click the “Next” button.
8.-Select the modem from the list (Siemens AG WM USM… or whatever is it). Click “Next”.
9.-Give the connection a name e.g. “SIEMENS Connection”. Click “Next”.
10.-Put *99***1# in the telephone number. Click “Next”.
11.- Select “Used by Anyone”. Click “Next”
12.-In the username put MOVISTAR, vodafone or CUSTOMER depending on whether it’s Telefónica, Vodafone or Orange respectively. You will have to consult other operators. In the password put MOVISTAR, Vodafone, AMENA depending on whether it’s Telefónica, Vodafone or Orange. You will have to consult other operators. Take care with the capital letters in the login and password. Click “Next”.
13.- Press the “Finish” button.
14.- Now open the Windows “Control Panel” -> Select System -> Hardware Tab –> Device Manager -> Select modem -> Right click Modem Properties (The Siemens/Cinterion one or the one that you are configuring) -> Advanced Options. In Additional Initialization Commands put:
If it’s Telefónica:
+CGDCONT=1,”IP”,”movistar.es”
If it’s Vodafone:
+CGDCONT=1,”IP”,”airtelnet.es”
If it’s Orange:
+CGDCONT=1,”IP”,”internet”
Press the Accept button.

15.-The button is now ready for the connection. Just double click on the network’s connection icon in network connections to start the connection.

I hope that is will help someone. ;)  

P.S. I am making some very important changes to the blog so sorry if you ever can’t read the posts properly, if the image isn’t in the centre or if there are problems with accents (I’m fighting with the UTF-8 and the ISO-8859-1). I hope that the changes will be positive in the end.

Tags: , , , , ,

Comments 2 Comments »