KMB systems, s.r.o. Dr. M. Horákové 559, 460 06 Liberec 7, Czech Republic tel. +420 485 130 314, fax +420 482 736 896 email : [email protected], internet : www.kmbsystems.eu

GSM/GPRS Modem

KM GPRS 101 Operating Manual Version 1.0

12/2012

KM GPRS 101

KMB systems

LIST OF CONTENTS 1. INTRODUCTION .............................................................. 3 2. DESCRIPTION.................................................................. 3 2.1

Hardware................................................................................................................................................3

2.2

Function.................................................................................................................................................3

3. CHOICE OF CONNECTION MODE................................. 4 4. INSTALLATION................................................................ 4 4.1

SIM-card insertion.................................................................................................................................4

4.2 Modem connection ...............................................................................................................................5 4.2.1 Power Supply Voltage Connection.................................................................................................5 4.2.2 Communication Link Connection....................................................................................................5 4.2.2.1 RS-485 Communication Interface..............................................................................................5 4.2.2.2 RS-232 Communication Interface..............................................................................................6 4.3

Antenna Instalation...............................................................................................................................6

4.4 Modem Setup ........................................................................................................................................7 4.4.1 Setup PC Connecting to the Modem with RS-485 Interface ..........................................................7 4.4.2 Setup PC Connecting to the Modem with RS-232 Interface ..........................................................7 4.4.3 GPRS Mode with a fixed IP-address Setting..................................................................................7 4.4.3.1 Setting Preparation ....................................................................................................................7 4.4.3.2 Modem Setting...........................................................................................................................9 4.4.3.3 Setup Accuracy Test................................................................................................................12 4.4.4 GPRS Mode with a Dynamically Allocated IP-address Setting ....................................................14 4.4.4.1 Setting Preparation ..................................................................................................................14 4.4.4.1.1 Host DNS-Server Domain Creation ...................................................................................14 4.4.4.1.2 Setting Preparation ............................................................................................................17 4.4.4.2 Modem Setting.........................................................................................................................20 4.4.4.3 Setup Accuracy Test................................................................................................................20 4.4.5 GSM Mode Setting .......................................................................................................................22 4.4.6 Modbus Protocol Communication Support...................................................................................23 4.4.6.1 Modbus-TCP / Modbus-RTU Protocol Conversion ..................................................................24

5. LITERATURE ................................................................. 25 6. TECHNICAL SPECIFICATIONS .................................... 25 7. MAINTENANCE, SERVICE............................................ 26 2

KM GPRS 101

KMB systems

1. Introduction The KM GPRS 101 modem is communication device for point-to-point interconnection, especially for remote management and monitoring of instruments and controllers of the KMB systems company. It provides either a GSM-connection ( standard modem) or a GPRS-connection with both TCP and UDP protocols, using either fixed or dynamic IP-addressing. Devices with firmware 1.0 or higher support the Modbus protocol communication too. The modem is equipped with either RS-485 or RS-232 type interface. For the RS-485 models, up to 32 instruments with appropriate interface can be connected to.

2. Description 2.1 Hardware „The heart“ of the modem is GC864-QUAD communication module (Telit company). Detailed descriprion of the module can be found in lit. [1]. The modem requires to be set to operate properly before use. Parameters of the module are set with so called AT-commands. Some of the parameters can be set only once during the modem installation (are kept in the module non-volatile memory), others need to be set again after power up. This is main task of the modem controller (auxiliary processor) that is built in the modem togethet with the module . So the controller has its own non-volatile memory and needs to be set during installation too. The controller performs another tasks too such like modem supervision (function checking, watchdog) and optionally autonomous communication cycle for connected instruments on-line monitoring. Both the module and the controller are connected to the modem communication interface (RS-485 or RS-232). Via the interface the modem can be set first of all and then various instruments can be connected and monitored.

2.2 Function After the modem being power up, the LED-diode MODEM starts flashing quickly (approx. 4 times per second) signalling the modem has entered a setup state. In the mode only the controller runs, the module stays switched off. It is possible to set modem parameters in this state (see below). If no valid command comes from communication interface into the modem, during approx. 10 seconds the modem gets into the ready state. First of all, the controller sets interface baud rate according preset value and then switches the module on a sets it up – this phase can last up to several tens of seconds and the MODEM LED-diode is off while this. As soon as the communicatiom module is set, so called ready state starts which is inicated with slowly flashing (approx. once per 2 seconds) MODEM LED-diode. At this state the modem is ready to accept a call. If the controller fails to set the module properly the modem comes to an error state, being indicated with flashing MODEM LED-diode at speed approx. twice per second. At this state the modem controller tries to set the module again each minute in order to get into the ready state; but usually it is necessary to check and to correct the modem setting. A connection is established by supervising computer call via a GSM network. The modem accepts the call and comes into a the connection state ; it gets transparent and data can flow freely from the GSM network to the modem communication interface and vice versa. Permanently lit MODEM LED-diode indicates this state. 3

KM GPRS 101

KMB systems

If no data flow, the modem controller resets the module periodically each 15 minutes for safety purpose.

3. Choice of Connection Mode In terms of simplicity and consequent reliability of the connection the GPRS mode with a fixed IPaddress is best solution. This requires to order adequate SIM-card with a suitably chosen tariff from a GSM network operator. Usually it is best to choose a tariff with unlimited amount of data transferred but the situation may be different for different operators. Operation of such SIM-card is often charged a fixed monthly rate. The advantage is that the supervising system communicates with the modem through once defined and fixed IP-address and the connection is thus dependent only on the quality and throughput of used GSM network. The second option is GPRS mode with dynamically allocated IP-address. Operation of corresponding SIM-card usually comes out cheaper, but you need to verify that the SIM-card access even in direction from the Internet is possible ( some SIM-cards access can be blocked in this direction) and eventually to activate this feature ( activation fee may be asked ). The disadvantage of this option is that the supervising system cannot link to the modem through a particular IP-address (because it doesn’t know it), but it must use so-called domain name so that access to the modem is mediated by so called DNSserver. To ensure this, it is necessary to open and maintain an account with chosen domain name on selected server and to set the modem in order to foward and update a dynamically allocated IPaddress to the server. Therefore, the modem operation is dependent on "the third party" - the DNSserver operator. The third option is a classical GSM-mode connection. Any usual SIM-card can be used for this mode, but as its operation is charged by duration of connection, it is usually unusable because of the price.

4. Installation 4.1 SIM-card insertion Depending on the type of connection chosen relevant SIM-card needs to be ordered from a GSM network operator and inserted into the modem. The procedure is as follows: 1. Attention ! If the SIM-card is protected by the so-called PIN, you must first disable this protection. 2. Disconnect the modem from the power supply voltage! Otherwise danger of electric shock !!! 3. Lever in the front panel slot using a small screwdriver and release the cover lid.

4

KM GPRS 101

KMB systems

4. Insert the SIM-card into a slot below the LEDs; the card must be oriented with its bevelled corner down as shown.

5. Push the SIM-card fully into the slot and release - the card remains in a slot in the locked position ( by re-pushing the card gets released and can be removed ).

6. Finally, snap the cover lid back.

4.2 Modem connection 4.2.1 Power Supply Voltage Connection Connect the power supply voltage (in range according the technical parameters, see below) to terminals AV1 and AV2 ( usually the wires L and N, polarity free ). The supply voltage must be secured with a 1 A breaker or with a fuse of rating T 0.5 L. If connected properly, the LED-diode MODEM starts flashing after the supply voltage is applied.

4.2.2 Communication Link Connection For interconnection with instruments, the modem is equipped with a communication interface according to the standard RS-485 or RS-232.

4.2.2.1 RS-485 Communication Interface The interface consists of terminals A, B and GND. It allows connecting up to 32 instruments at a distance up to about 1 kilometre. Recommended cable is shielded twisted metallic double pair. 5

KM GPRS 101

KMB systems

RS-485 line requires impedance termination of the final nodes by installing terminating resistors for communication distances of a few tens of metres and longer. Terminating resistors matching the cable’s wave impedance should be connected between terminals A and B. The instrument has a built-in terminating resistor of 330 ohms, but it is disconnected as default ( its jumper is in the “OFF” position). To install the resistor, follow next steps : 1. Lever in the RS-485 communication interface terminals cover slot using a small screwdriver and release the cover lid.

2. Replace the „Terminator“ jumper into the „ON“ position. 3. Snap the cover lid back. If the communication cable is hundreds of meters long and in environments with electromagnetic noise it is suitable to use shielded cable. The shielding connects to terminal GND and to the PE (protection earth) wire at one end of the cable.

4.2.2.2 RS-232 Communication Interface The interface consists of terminals RxD, TxD and GND. The communication interface complies with CCITT V.28 (RS-232) recommendations, that is ± 12 V with minimum internal impedance load 3 kΩ. Signals in accordance with CCITT V.24 are used, that is 102 (GND=common wire), 103 (TxD=transmission data) and 104 (RxD=reception data). The interface can be used to connect one controller to a remote computer. Communication cable maximum length is about 30 meters (shielded cable, such as 3 x AWG24, recommended).

4.3 Antenna Instalation The modem is equipped with a the SMA-F (female) type connector for connecting the antenna. In areas with sufficient signal strength a „baton“ type antenna is sufficient usually. The signal level can be identified using the setup program MSet (see below). If the signal is too weak or lacks in the modem installation site, an antenna located separately from the modem is necessary, usually with a corresponding fixed bracket and connection cable, or with magnetic or adhesive mounting design. An antenna is not a standard part of the modem, but available as optional accessory. The specific type can be chosen from the current supplier modem offer or from a GSM network operator assortment. 6

KM GPRS 101

KMB systems

Fig. 1 : Antenna types

4.4 Modem Setup To set the modem, a class PC computer (usually portable) running Microsoft Windows XP or later and the setup program MSet are needed. The MSet program can be freely downloaded from the manufacturer's website www.kmbsystems.eu . After unpacking the installation file, run the program setup.exe and follow instructions of the installation program. Modem setup is carried out via the communication interface. Usually it is necessary adequate interface converter ( see below ).

4.4.1 Setup PC Connecting to the Modem with RS-485 Interface It is required to connect the setup PC to the RS-485 modem interface through a suitable converter, usually of USB/485 type. We recommend to use the SB-485 converter from The PaPouch company (www.papouch.com). It is sufficient to connect the converter to the modem interface terminals A and B only, the GND terminal can be left usually unconnected for the setup. You need not to disconnect any other devices connected to the interface if they don’t use address of value 250, which is reserved for modem setup. If the setup PC is equipped with a RS-232 interface, a 232/485-type converter can be used too; but note that it must support automatic data flow direction control according transmitted data and its flow direction timer shall be set to the appropriate speed transmission (baud rate). These converters can be ordered from the modem supplier as an optional accessory.

4.4.2 Setup PC Connecting to the Modem with RS-232 Interface If the setup PC is equipped with an RS-232 interface, it can be connected to the modem directly ( without any converter). For this only so-called "cross connected" or „null modem“ cable (3-wire, the signal RxD of the PC to the TxD of the modem and vice versa, and GND to GND) is required. Otherwise, you must use an "USB/232" converter, which is commonly available in computer shops. If any instrument is connected to the modem interface, it is necessary to disconnect it first.

4.4.3 GPRS Mode with a fixed IP-address Setting We recommend to prepare and store the modem settings into the setting file on the setup PC first (which need not to be connected to the modem), and then to load the settings into the modem on site.

4.4.3.1 Setting Preparation Run the MSet program. For the setup a preset configuration setting supplied with the program can be used. Load the setting into the program : click on Load and select the settings 7

KM GPRS 101

KMB systems

DEFAULT_GPRS_FIP.mst (FIP = Fixed IP). The program confirms correct reading with the message "The setting successfully loaded " - confirm by pressing OK.

The setting is composed of a set of parameters; with the exception of a single parameter, it is set of the modem controller parameters. After reading this set of parameters appears in the section Setting. The basic group of parameters is listed in subsection General: •

Object … object name. This is a text string of max length of 31 characters. It serves to marking and identification of modems in larger systems and the user may set it arbitrarily according to their needs.



Bd-rate ... communication speed of modem communication interface in units of Bd. Set in correspondence with connected instruments setting ( note : independently of this the modem communicates with fixed Bd-rate of 9600 Bd and fixed address of 250 in the setup state )



Address …modem address. A master PC can communicate via modem both with instruments connected to its communication interface and with the modem controller using this address. The address mustn‘t collide with the addresses of connected instruments – it is recommended to keep the default value of 250.



Mode ... connection mode. In this case, set the GPRS-TCP (or if necessary to GPRS-UDP, see „Advanced settings“ below).

At devices equipped with firmware 1.0 or higher you can set too : •

parity and number of stopbits at modem serial communication interface



Modbus-TCP to Modbus-RTU and vice versa protocol conversion

With the two additional parameters you can communicate with connected instruments via the Modbus protocol too. For standard communication, set none parity and one stopbit (none/1 option). For Modbus protocol communication, you must set correct parity too and if the parity is not used you must set 2 stopbits (none/2 option). Furthermore, is supervising systems uses the Modbus-TCP protocol, is is necessary to activate the protocol conversion (M.TCP/M.RTU option). Finally, it is necessary to set so called port of the TCP communication protocol. This parameter is at default hidden in the second, more detailed part of the modem controller settings; to expand the detailed part click on the ▼ on the right side of the GPRS bar.

8

KM GPRS 101

KMB systems

Now we see that the port is preset to 2101 and, if necessary, it can be changed. For now, it is not recommended to change other parameters in the Commands section; a detailed knowledge of the modem communication module function is necessary for this, so they are intended for advanced users only (a more detailed description will be given in the relevant section below). In that case, we set the name of the object to MyModemNo1, speed of communication to 19200 Bd, modem address to 250, connection mode to GPRS-TCP and port value to 2101 ( and other configuration remained in default ). Now it is advisable to save the settings to disk with the Save button – the program offers the setting name equal to the Object name which can be eventually edited. Correct storage is confirmed with the "The setting successfully saved" message, confirm by pressing OK. In addition to the above parameters which are programmed into the modem controller, a name of so called Access Point (Access Point Name, APN) will be required for complete modem setting. This name will be set into the modem communication module and you need it to receive it from used GSM network operator.

4.4.3.2 Modem Setting In this phase it is needed to connect the modem to a setup PC (see section above). Before turning on the modem, preset communication parameters in the MSet program : in the upper left window, select the COM tab and then select serial interface port number to which the modem is connected (e.g. COM1). Next, set communication speed of this interface to 9600 Bd and communication address of the modem (Device Address) to value of 250 ( corresponding to the default communication parameters of the modem in the setup state ). Now turn the power on the modem. The modem enters the setup state ( MODEM-LED flashes quickly - about 3 times per second ). At this point, press the Connect button that activates the communication interface and then press the Receive button in the Controller section. This choice must be accomplished during 10 seconds, when the modem is in the setup state, otherwise the modem switches to the ready state and the setting is not possible – in such case you must turn the modem off and start the procedure again. When properly connected, the modem actual state appears in the Controller section :

9

KM GPRS 101

KMB systems

In the Model field modem serial number appears, in the Serial N. field its seriál number does. Actual modem state is displayed in the Status field : the value SETUP says that the modem is currently in the setup state. Now load preset modem settings from the disk ( Load button ) and then send it to modem with the Send button. In the Chat History window you can see the progress of communication between the MSet program and the modem; in hexadecimal form (used for the modem controller communication checking) on the left side and in text form ( communication with the modem communication module ) on the right side. If the settings pass correctly the MSet program displays the message "The setting successfully set"; then confirm by pressing the OK button.

Now it is necessary to set the modem communication module too – only a single parameter - the name of the access point, called APN - needs to be configured. First, we check the basic function of the communication module. To read actual state of the module click on the Receive button in the the Communication Module section. After that, the warning message appears, because the module is not turned on yet and therefore its state cannot be read ( the communication module remains switched off during the modem setup state and it can be switched on with the modem controller command only ) : 10

KM GPRS 101

KMB systems

Confirm the message with the OK and switch the module on with the On / Off button. The switching process takes about 2 seconds and then the value ON would appear in the Status field of the Communication Module section. Now you can already read ( using AT-commands ) the actual module state with the Receive button :

In the Model / FW field the type of communication module and its firmware version appear. In the SIM field you can check the presence of a SIM-card: it must show the OK value. If not, a SIMcard must be inserted ( by the chapter above ) and the setup procedure started again. If the SIM-card in order, we can continue with the setup. In the Signal field a GSM network signal quality can be checked (the precise meaning of data is described in the lit. [2], the command AT+CSQ). The first number corresponds to the signal strength, the second one to the error rate. In case of signal absence the module returns values of 99 / 99. By experience, if the signal strength at least 15 the error rate is usually zero and the connection quality is sufficient. The connection at a lower signal quality should be verified by practical operation. Signal quality can be improved by using a different antenna and by its appropriate location. To search for the optimum antenna location, start cyclical module status reading with the AutoReceive button. Once you find the best place, stop cyclic reading with the Stop button. 11

KM GPRS 101

KMB systems

When sufficient signal strength, the default network access point name in the APN field and an allocated IP-address in the IP field should appear - in our case it should correspond to the fixed IPaddress corresponding to the SIM-card inserted. Now set the network access point name in the APN field and send it to the module with the Send button in the Communication Module section. You can verify the settings by reading it back with the Receive button. Now the modem setup is finished and we can test its functionality. Before that it is recomended to save the modem settings again (and overwrite the previously saved settings) with the Save button – the settings including the APN name is saved into the setting file. Note: All the above procedure should be carried out in the modem setup state. The modem gets in this state automatically after supply voltage is applied, but without external intervention it goes on to a ready state during 10 seconds; in this state it cannot be correctly set. Therefore, as stated at the beginning of this chapter, it is necessary to send any command into the modem controller during the initial 10 seconds, for example the status read command with the Receive button. By receiving of such command, the modem controller understands the modem setting process is in progress; therefore it remains in the setup state for next 10 minutes after receiving the last command. If even after this time the setting process is not finished, the modem goes into the ready state. Then you must turn the modem off ( disconnect from a power supply voltage) and restart the setup process again.

4.4.3.3 Setup Accuracy Test Unplug the modem from power supply voltage. In the MSet program, set the PC serial communication interface speed to correspond to the modem communication speed in ready state – in accordance with previous setting example, to the value of 19200 Bd – and activate the interface by clicking on the Connect button (if already enabled, you must first deactivate it with the Disconnect button). Now turn on the modem power supply and see incomming messages in the text (= right) part of the Chat History window. After 10 seconds, the modem controller terminates the setup state , switches the communication module on and starts to set it using preset commands. These commands are not visible, but responses to the individual commands from the communication module appear step by step in the window – as soon as the controller accepts such response it passes it to the modem communication interface automatically. A typical process looks like this:

Comments to the example list : 12

KM GPRS 101

KMB systems



the first 2 lines : the first AT-command (ATE0) is echoed by the module as standard, the repeated command no longer echoed; accepting of both commands confirmed with the OK



next 2 lines : 2 x OK = confirmation of the modem firewall setting AT-commands (AT#FRWL)



line No. 5 : the answer to a question about the state of the context No. 1 (AT#SGACT?) says that the context is not activated (has a value of 0)



lines 6, 7 : response to the context No.1 activating AT-command (AT # SGACT = 1,1); the first activation attempt failed (ERROR response from the module), but the repeated command was successfull and the module passed allocated IP-address to the controller ( unsuccessful activation attempts may in practice normally occur, the controller repeats the command in such cases)



last 2 lines : confirmation of the module that it went into the listen-mode ( waiting for connection requests from a master PC )

Now the modem is in the ready state ( MODEM LED flashes slowly ) ie. that it is ready to accept a connection request from a master PC. Once the connection request arrives, the communication module transmits the report "SRING: 1" (1 indicates the context No. 1) to the controller. The controller oders the module to accept the request and the successful connection establishment is confirmed by the module with the "CONNECT" message :

Then the modem enters a connection state ( connected to a master PC ) and this state is indicated with permanently lit MODEM-LED. The modem is completely transparent in this state, ie. any message sent from the master PC goes through the modem to its communication interface and vice versa - any message (= response) from a connected instrument passes through the modem back to the master PC. The connection state lasts until the master PC cancels it, or until terminated by the modem itself due to the no-communication timeout expires ( default 90 seconds, can be changed with the „AT# SCFG“ command, see lit [2]), or it can be terminated due to other reasons (loss of signal, etc.). When the connection is terminated the module sends the message "NO CARRIER" :

13

KM GPRS 101

KMB systems

After receiving the report, the modem controller resets the module to be able to accept another requests for connection ( see the last 5 lines of the list : confirmation messages from the module) and goes back to the ready state ( MODEM -LED flashes slowly ). By that the modem functionality is verified.

4.4.4 GPRS Mode with a Dynamically Allocated IP-address Setting 4.4.4.1 Setting Preparation 4.4.4.1.1 Host DNS-Server Domain Creation At this case a master PC cannot use directly a particular IP-address but it must use a domain name. For translation of the domain name to actually valid IP-address a DNS-server is used. There exist many DNS-servers such like http://www.dyndns.com , http://www.no-ip.com , http://freedns.afraid.org etc. At the following example a domain creation at the www.dyndns.com server is described. First of all, an account must be established on the server. At the homepage www. dyndns.com, click on the Create Account .

Type required data, i.e. the Username ( at the example mymodem was chosen), the Password (mymodempswd) and the Email ([email protected]) and click on the Create Account .

14

KM GPRS 101

KMB systems

The server will send an confirmation link on the preset email address. Click on it and the server will establish the account and will confirm it :

Now we can create an host domain inside the established account that we need as an access point to the modem. At the server homepage, log into the account (type the username and the password) and click on the Log in :

The account page opens :

Choose the My Services page :

15

KM GPRS 101

KMB systems

Now we will create the host domain name in the Host Services section. Click on the Add Hostname. New window opens and we will fill all required data :

In the example we have chosen domain name mymodem1.dyndns.org in the Hostname field. Follow with the Add To Cart :

Now confirm the requirement with the Next :

16

KM GPRS 101

KMB systems

In the next window click on the Activate Services . Finally, the DNS-server confirms successful creation of new host domain with :

Now the host domain is ready to use. To link the domain to our modem, it is necessary to set the modem in the way to transfer its allocated IP-address as soon as it gets it from the GSM network (DHCP-server). The metod of the transfer can be found at the Perform Update page on the www.dyndns.com . For multi-modem applications we can create other host domains, for example mymodem2.dyndns.org, mymodem3.dyndns.org etc. in the same way. 4.4.4.1.2 Setting Preparation Run the MSet program. For the setup a preset configuration setting supplied with the program can be used. Load the setting into the program : click on Load and select the settings DEFAULT_GPRS_DIP.mst (DIP = Dynamic IP). The program confirms correct reading with the message "The setting successfully loaded " - confirm by pressing OK.

The setting is composed of a set of parameters; with the exception of a single parameter, it is set of the modem controller parameters. After reading this set of parameters appears in the section Setting. The basic group of parameters is listed in subsection General: 17

KM GPRS 101

KMB systems



Object … object name. This is a text string of max length of 31 characters. It serves to marking and identification of modems in larger systems and the user may set it arbitrarily according to their needs.



Bd-rate ... communication speed of modem communication interface in units of Bd. Set in correspondence with connected instruments setting ( note : independently of this the modem communicates with fixed Bd-rate of 9600 Bd and fixed address of 250 in the setup state )



Address …modem address. A master PC can communicate via modem both with instruments connected to its communication interface and with the modem controller using this address. The address mustn‘t collide with the addresses of connected instruments – it is recommended to keep the default value of 250.



Mode ... connection mode. In this case, set the GPRS-TCP (or if necessary to GPRS-UDP, see „Advanced settings“ below).

At devices equipped with firmware 1.0 or higher you can set too : •

parity and number of stopbits at modem serial communication interface



Modbus-TCP to Modbus-RTU and vice versa protocol conversion

With the two additional parameters you can communicate with connected instruments via the Modbus protocol too. For standard communication, set none parity and one stopbit (none/1 option). For Modbus protocol communication, you must set correct parity too and if the parity is not used you must set 2 stopbits (none/2 option). Furthermore, is supervising systems uses the Modbus-TCP protocol, is is necessary to activate the protocol conversion (M.TCP/M.RTU option). Finally, it is necessary to set so called port of the TCP communication protocol. This parameter is at default hidden in the second, more detailed part of the modem controller settings; to expand the detailed part click on the ▼ on the right side of the GPRS bar.

Now we see that the port is preset to 2101 and, if necessary, it can be changed. For now, it is not recommended to change other parameters in the Commands section; a detailed knowledge of the modem communication module function is necessary for this, so they are intended for advanced users only (a more detailed description will be given in the relevant section below). Finally, the parameters concerning transmission of allocated IP-address to a DNS-server need to be set. The parametres are in the DynDNS section : 18

KM GPRS 101

KMB systems



Host … host domain name. The modem sends a dynamically allocated IP-address to this domain (created on a DNS-server) through special command / see below.



Command … command ( in http-format ) containing transmitted IP-address. Its format must be in compliance with the specification on the Perform Update page at the www.dyndns.com .



ReplyOK … assortment of the DNS-server replies ( text strings, so called return codes ) to the command above confirming correct reception of the IP-address. Individual strings are separated with a „|“ character. If the DNS-server reply contains at least one of the return codes, the modem considers the IP-address transfer to be successful.

In the Host field, type name of the „update interface“ domain members.dyndns.org , as specified on the Perform Update page at the www.dyndns.com . Prefilled text string in the Command field has following format : GET /nic/update?hostname=mymodem1.dyndns.org&myip=$IPAddr$&wildcard=NOCHG&mx=NOCHG&ba ckmx=NOCHG HTTP/1.1Host: members.dyndns.orgUser-Agent: Telit GPRS modemAuthorization: Basic bXltb2RlbTpteW1vZGVtcHN3ZA== The command needs to be modified in red marked parts as follows : 1. after the „hostname=“ substring : type the DNS-server host domain name, that will serve as access point to the modem for a master PC – in our case mymodem1.dyndns.org 2. after the „Host=“ substring : here type the DNS-server „update interface“ domain name to which the modem transfers its IP-address, i.e. the same name as in the Host field – so in our case members.dyndns.org 3. after the „Authorization=“ substring : it is necessary to enter an authorization code here. You needn’t to create the code „manually“; the MSet program includes the code generator. Simply press the Auth. button and the Authorization Code Generator window appears:

In the User Name field, type the DNS-server host domain account name, i.e. in our case mymodem , and in the Password field type appropriate account password, i.e. mymodempswd . Clicking on the Generate the program generates appropriate authorization code and fils it into the Command. field automatically. There is the $IPAddr$ substring in the command – the modem replaces this substring with an actual IP-address every time when it sends the command to the DNS-server. Attention ! This string must not exceed maximum length of 255 characters !!! 19

KM GPRS 101

KMB systems

Finally, type the return codes assortment in the ReplyOk field. In compliance with the specification on the Perform Update page at the www.dyndns.com , the DNS-server can confirm correct IP-address reception with the codes good or nochg, so type good|nochg string into the field. Now the setting is prepared and it is advisable to save the settings to disk with the Save button – the program offers the setting name equal to the Object name which can be eventually edited. Correct storage is confirmed with the "The setting successfully saved" message, confirm by pressing OK. In addition to the above parameters which are programmed into the modem controller, a name of so called Access Point (Access Point Name, APN) will be required for complete modem setting. This name will be set into the modem communication module and you need it to receive it from used GSM network operator.

4.4.4.2 Modem Setting You can perform the physical setting of the modem in the same way as when fixed IP-address connection is used – see appropriate chapter above.

4.4.4.3 Setup Accuracy Test Unplug the modem from power supply voltage. In the MSet program, set the PC serial communication interface speed to correspond to the preset modem communication speed (in ready state) – in accordance with previous setting example, to the value of 19200 Bd – and activate the interface by clicking on the Connect button (if already enabled, you must first deactivate it with the Disconnect button). Now turn on the modem power supply and see incomming messages in the text (= right) part of the Chat History window. After 10 seconds, the modem controller terminates the setup state , switches the communication module on and starts to set it using preset commands. These commands are not visible, but responses to the individual commands from the communication module appear step by step in the window – as soon as the controller accepts such response it passes it to the modem communication interface automatically. A typical process looks like this:

Comments to the example list : •

the first 2 lines : the first AT-command (ATE0) is echoed by the module as standard, the repeated command no longer echoed; accepting of both commands confirmed with the OK



next 2 lines : 2 x OK = confirmation of the modem firewall setting AT-commands (AT#FRWL)



line No. 5 : the answer to a question about the state of the context No. 1 (AT#SGACT?) says that the context is not activated (has a value of 0) 20

KM GPRS 101

KMB systems



lines 6 through 9 : response to the context No.1 activating AT-command (AT # SGACT = 1,1); the first three activation attempts failed (ERROR response from the module), but the fourth command was successfull and the module passed allocated IP-address to the controller (unsuccessful activation attempts may in practice normally occur, the controller repeats the command in such cases)



line No. 9 and next : the modem established connection with the DNS-server „upgrade interface“ domain members.dyndns.org , the module reported it with the CONNECT message; immediatelly after that, the modem sent the command with the allocated IPaddress 160.218.246.64 (you cannot see this command in the list) and the DNS-server confirmed the command reception with the confirmation message (you can see it in the list). The message contains the good substring, that means the passed IP-address was accepted correctly. After that the DNS-server cancelled the connection, that was reported by the module with the NO CARRIER message.



last 2 lines : confirmation of the module that it went into the listen-mode ( waiting for connection requests from a master PC )

Now the modem is in the ready state ( MODEM LED flashes slowly ) i.e. it is ready to accept a connection request from a master PC. If an access to the internet is possible from the setup PC, we can check that the IP-address was really passed to the DNS-server. Log into the appriopriate account on the DNS-server and switch on the My Services page :

As you can see in the Host Services section the IP-address 160.218.246.64 was really affixed to the domain mymodem1.dyndns.org. Now we can check modem connection functionality with, for example, the telnet application that is standard accessory of the Windows system. At the command prompt, type : telnet 160.218.246.64 2101 and the PC connects to the modem. Due to this the modem enters the connected state with the PC that is indicated with permanently lit MODEM-LED. The modem is completely transparent in this state now, ie. any message sent from the master PC goes through the modem to its communication interface and vice versa - any message (= response) from a connected instrument passes through the modem back to the master PC. You can check it with typing any test message from the telnet window, say hello . The dialogue list then looks like this :

21

KM GPRS 101

KMB systems

Once the connection request arrives, the communication module transmits the report "SRING: 1" (1 indicates the context No. 1) to the controller. The controller oders the module to accept the request and the successful connection establishment is confirmed by the module with the "CONNECT" message. Then you can see the sent test message in the list. The connection state lasts until the master PC cancels it, or until terminated by the modem itself due to the no-communication timeout expires ( default 90 seconds, can be changed with the „AT# SCFG“ command, see lit [2]), or it can be terminated due to other reasons (loss of signal, etc.). When the connection is terminated the module sends the message "NO CARRIER" :

After receiving the report, the modem controller resets the module to be able to accept another requests for connection ( see the last 7 lines of the list : confirmation messages from the module) and goes back to the ready state ( MODEM -LED flashes slowly ). By that the modem functionality is verified.

4.4.5 GSM Mode Setting Connect the modem to a setup PC (see section above). Before turning on the modem, preset communication parameters in the MSet program : in the upper left window, select the COM tab and then select serial interface port number to which the modem is connected (e.g. COM1). Next, set communication speed of this interface to 9600 Bd and communication address of the modem (Device Address) to value of 250 ( corresponding to the default communication parameters of the modem in the setup state ). 22

KM GPRS 101

KMB systems

For the setup a preset configuration setting supplied with the program can be used. Load the setting into the program : click on Load and select the settings DEFAULT_GSM.mst. The program confirms correct reading with the message "The setting successfully loaded " - confirm by pressing OK.

The setting is composed of five parameters - all of them are the modem controller parameters. After reading this set of parameters appears in the section Setting. The basic group of parameters is listed in subsection General: •

Object … object name. This is a text string of max length of 31 characters. It serves to marking and identification of modems in larger systems and the user may set it arbitrarily according to their needs.



Bd-rate ... communication speed of modem communication interface in units of Bd. Set in correspondence with connected instruments setting ( note : independently of this the modem communicates with fixed Bd-rate of 9600 Bd and fixed address of 250 in the setup state )



Address …modem address. A master PC can communicate via modem both with instruments connected to its communication interface and with the modem controller using this address. The address mustn‘t collide with the addresses of connected instruments – it is recommended to keep the default value of 250.



Mode ... connection mode. In this case, set the GSM.

The fifth parameter is so called Init string. This parameter is at default hidden in the second, more detailed part of the modem controller settings; to expand the detailed part click on the ▼ on the right side of the GSM bar. For now, it is not recommended to change the parameter; a detailed knowledge of the modem communication module function is necessary for this, so they are intended for advanced users only. Now it is advisable to save the settings to disk with the Save button – the program offers the setting name equal to the Object name which can be eventually edited. Correct storage is confirmed with the "The setting successfully saved" message, confirm by pressing OK. Finally, send the setting into the modem in the same way as described in previous chapters.

4.4.6 Modbus Protocol Communication Support With the devices equipped with firmware 1.0 or higher you can communicate via the Modbus protocol too. 23

KM GPRS 101

KMB systems

This protocol uses nine-bit serial communication transmission. The parity bit is added to each byte even if the parity is not used – then one bit of level „1“ is transferred, creating the 2nd stopbit. The serial communication interface Parity / Sbits parameter must be set to one of following options : •

even / 1 when using even parity



odd / 1 when using odd parity



none / 2 when parity is not used

If you want to monitor traffic at the modem seriál interface with the MSet program during the modem standby- or the connection- states it is necessary to set the MSet serial interface parameters accordingly as soon as the modem leaves the setup state. You can do it in the upper left corner of the program window as shown at the nex picture (even parity is set) :

4.4.6.1 Modbus-TCP / Modbus-RTU Protocol Conversion If a master system accesses the modem with the Modbus-TCP protocol, you can activate the parameter conversion by setting the Protocol Conversion parameter to the M.TCP / M.RTU option. Then : •

Modbus-TCP format master commands coming from the GSM network will be translated to the Modbus-RTU format before sending to the serial communication interface



Responses from individual devices in the Modbus-RTU format coming from the serial interface are translated to the Modbus-TCP format before being sent to the GSM network

The modem checks each incoming message and if its structure corresponds to the appropriate format, it converts it first and just then sends it. If the message does not match the appropriate format, it is sent unchanged.

24

KM GPRS 101

KMB systems

5. Literature [1] Telit GC864-QUAD PY Hardware User ( www.telit.com ) [2] Telit AT Commands Reference Guide ( www.telit.com

6. Technical Specifications GSM / GPRS • communication module • frequency range • output power • mode • connection antenna connector serial interface / comm. rate power supply operation temperature dimensions / mass

Telit GC864-QUAD/PY four-band EGSM 850 / 900 / 1800 / 1900 MHz class 4 ( 2 W ) for 850 / 900 MHz class 1 ( 1 W ) for 1800 / 1900 MHz GSM or GPRS, fixed and dynamic IP-address support automatic according incoming call SMA-F ( female ) RS232 (RxD, TxD, GND) or RS485 (A,B,GND) / 1200÷38400 Bd 175 ÷ 275 V AC or DC, max. power 3 VA -30 ÷ +60 °C 91 x 36 x 58 mm / 0.1 kg

25

KM GPRS 101

KMB systems

7. Maintenance, Service The modem does not require any maintenance. For reliable operation you only have to comply with the operating conditions specified and prevent mechanical damage to the instrument. In the event of the product’s breakdown, you have to return it to the supplier at their address. supplier:

manufacturer: KMB systems, s.r.o. 559 Dr. M. Horákové 460 06, Liberec 7 Czech Republic website: www.kmbsystems.eu

The product must be packed properly to prevent damage in transit. Description of the problem or its symptoms must be sent along with the product. If warranty repair is claimed, the warranty certificate must be sent in too. If after-warranty repair is requested, a written order must be included.

Warranty Certificate Warranty period of 24 months from the date of purchase, however no later than within 30 months from the dispatch date from manufacturer’s warehouse, is provided for the instrument. Problems in the warranty period, evidently caused by poor workmanship, design or inconvenient material, will be repaired free of charge by the manufacturer or an authorized servicing organization. The warranty becomes void even within the warranty period if the user makes unauthorized modifications or changes to the instrument, connects it to out-of-range quantities if the instrument is damaged in out-of-specs impacts or from improper handling or if it has been operated in conflict with the technical specifications.

type of product: KM GPRS 101................. .

serial number ..............................................

date of dispatch: ...........................................

final quality inspection: ................................

manufacturer’s seal:

date of purchase: ...............................................

supplier’s seal:

26