0% found this document useful (0 votes)
31 views

rs2gprs en

This document provides instructions for using an rs2gprs Java applet to connect serial devices remotely over GPRS. The applet allows a PC to communicate with equipment having RS-232 or RS-485 interfaces via a Siemens TC65 GPRS modem. It establishes a transparent data channel between the modem's serial port and a TCP port on the PC. The document describes setup and configuration for both physical and virtual COM port connections between the PC and modem.

Uploaded by

ftonello
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

rs2gprs en

This document provides instructions for using an rs2gprs Java applet to connect serial devices remotely over GPRS. The applet allows a PC to communicate with equipment having RS-232 or RS-485 interfaces via a Siemens TC65 GPRS modem. It establishes a transparent data channel between the modem's serial port and a TCP port on the PC. The document describes setup and configuration for both physical and virtual COM port connections between the PC and modem.

Uploaded by

ftonello
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

rs2gprs

Serial (RS-232) connection to remote objects over GPRS

JAVA applet for Siemens TC65 / Cinterion TC65T modems and compatible modules
Build 120523 and later

User manual

2012
1 Purpose
rs2gprs Java applet for Siemens TC65 / Cinterion TC65T modems and compatible modules is
intended for making a wireless connection over GPRS to equipment having RS-232/RS-485
serial interface. It can be used e.g. For retrieving data like energy (water, gas)consumption from
remote locations, or equipment remote control (including "smart home" solutions). To use the
applet you will need an active GPRS connection. Equipment being connected must have either
RS-232 serial interface or other interface that can be converted to RS-232 (e.g.RS-485 and RS-
485/RS-232 converter), 8 bits in byte, no parity, 1, 1.5 or 2 stop bits (parameters are limited by
modem capabilities).
Applet allows using Modbus/RTU protocol that restricts time interval between neighbour bytes.
GPRS connection does not guarantee this parameter so the applet fills internal buffer with data
arriving over GPRS and sends incoming packet to device after adjustable period of silence (this
option can be set up or turned off using menu).

Fig. 1 Usage example


For correct rs2gprs operation a PC or other IP-enabled communication device is needed. PC
runs user software that wants to access remote device. PC must have network interface with
public IP address and accept incoming TCP connections from Internet. It is possible to use either
software specially designed to work over TC or software that communicates over serial (COM)
ports.
2 Copyrights and copylefts
rs2gprs Java applet is distributed free of charge with source codes.
The author of this applet is against all copyrights in all forms. Thus, everybody can use this
applet in any possible way, without even feeling any obligations to its author. Author hopes that
this will be his small input into development and improvement of the world and the human
civilisation. It is desired (but not obligatory) to mention authors' email address
[email protected] as the author of concept and original code if you are distributing this applet
or applets based on its source code. I will also appreciate your "thanks" sent to me to the same
email address :) .
Modifying the applet to better suit your special needs is also highly appreciated as I think any
new personal skills improve the common wealth. You can load all you need for modification
from http://www.gsmpager.ru.
3 Description
Siemens TC65i GSM/GPRS modem (now known as Cinterion TC65T) has a serial port RS-232
and can send and receive data over wireless GPRS connection (you pay for traffic not for online
time). Data transmission between RS-232 and GPRS is performed by rs2gprs applet that starts
automatically when modem is powered on.
rs2gprs connects to IP address and port specified in menu and acts as a bridge between modem's
serial port and server TCP port until reset, powered off or disconnected. In the latter case modem
reconnects to server automatically. It is possible to set up a virtual COM port in server PC by
using com0com and com2tcp software packages available for free from
http://com0com.sourceforge.net/ (see below). In this case transparent data channel is set up
between modem's COM port and virtual COM port on PC. In this case you can connect client
software to server's virtual COM port.
After creating communication channel user data or requests being sent to virtual COM port are
transferred to modem over GPRS. rs2gprs resends received data into modem's COM port.
Reverse data path is the same.
Baud rates on modem and server side may be different. The only limitation is possibility of data
buffer, or GPRS data channel overflow (if data arrives faster than it can be sent out). If
connection is broken modem tries to reconnect until success.
A single server can work with multiple modems. However, if you use com0com program it has
"one modem = one COM port" limitation. To build bus-like connections (multiple client on the
same COM port) you can try hub4com project from http://com0com.sourceforge.net/.
rs2gprs Java applet can be set up using any serial terminal program like PuTTY v.0.60 and later,
Hyperterminal, minicom etc. Set baud rate to 115200-8-n-1, connect modem directly to selected
PC COM port by null modem cable ad power up the modem (or run applet using modem AT
commands) to see menu prompt.
After setting up connection and other parameters you can save settings in modem file system as
default that will be loaded on subsequent applet start-ups.
If no data are being sent over GPRS channel some cellular operators disconnect the link. To
prevent this problem rs2gprs has an option of sending keepalive bytes (about 2 bytes per
minute) during silence periods.
Since build 101216 rs2gprs supports data buffering to work with devices that do not allow long
delays between bytes within a single packet (e.g. that use Modbus/RTU protocol to
communicate).
Since build 120523, modem can act as a client (initiates connection to server over GPRS) or as a
server (listens for incoming connections). Client can save money on supporting public IP address
of modem, while server does not require permanent connection to clients and can be polled on
demand. Server requires assigning static IP address, either public or private, to modem.
rs2gprs does not use, send or receive RTS/CTS, DTR/DSR flow control signals.
4 System requirements
PC used together with rs2gprs must have (in the case when rs2gprs acts as a client):
• Permanent connection to Internet with public IP address, either static or dynamic with
appropriate DNS support (e.g. http://www.dyndns.com/ services/dns/dyndns/ );
• Incoming TCP connection(s) to selected port(s) not blocked by firewall or ISP.

5 Connecting the modem


Modem should be mounted and connected as said in modem's user guide.

Fig. 2 TC65 modem connector pin numbering


Modem's serial port is connected to serial port of remote device by 3-wire null modem (crossed)
cable (see fig.3):

Fig. 3 Null modem cable schematics


To set up the applet you will need to connect your modem to PC by modem (direct) cable.

6 Setup
6.1 Server setup
There are several possible types of server setup. One type is used when user application can
connect to remote devices over TCP/IP. In this case you do not need to create or use virtual
COM ports in setup. Usually the program can connect to one or several devices by their IP
address and port number, in this case rs2gprs applets are set up as servers and accept
connections from user software. A less common example is when user application processes
incoming connections from one or multiple modems (in this case, each modem must be set up as
a client and must connect to a different port number).
Since rs2gprs is transparent for data flow between COM port of modem and TCP port of user
application, it can be compatible with 3rd party servers or clients. For example, the applet worked
with software by Moxa.
In the case when user application cannot work with TCP/IP it must work with serial port to be
used together with rs2gprs. Physical or virtual COM port setup will be required in this case.
The easiest one is setup of serial connection with a physical PC serial port as an endpoint. More
complicated but more useful is virtual COM port as an endpoint. Both types of setup are
described below.
In both cases one PC can provide several connection channels to different modems at the same
time. These channels must have different port numbers for rs2gprs instances connection.
To set up your server you will need to download and install appropriate software from
http://com0com.sourceforge.net/ .
Please do not forget to set up rs2gprs client before doing actual connection!
6.1.1 Comm channel with physical serial port as an endpoint
When this type of setup is running, PC's physical serial port will be visible for connected
equipment as a physical serial port of remote device (excluding RTS and DTR signals) that is
actually connected to a TC65 modem, as shown on figure below.
Run com2tcp.exe program with required parameters on your server PC. E.g. running
com2tcp.exe --baud 115200 --ignore-dsr \\.\COM1 1234
Will create a transparent data communication channel between serial port СОМ1 with baud rate
115200 bps and ТСР port 1234. The --ignore-dsr option allows ignoring flow control lines,
which might be useful when using 3-wire serial cable or when working with some types of
terminating equipment.
To test the setup connect your modem to port COM1 with a modem(straight) cable and run the
following from command prompt:
com2tcp.exe --baud 115200 --ignore-dsr --telnet \\.\COM1 1234
(--telnet option provides correct telnet software operation)
From another command prompt window run
telnet localhost 1234
(connect to TCP port 1234 of your PC):

Fig. 4 Running telnet


enter “at” without quotes and press Enter. You should see modem answer:

Fig. 5 Data passing through com2tcp


In the first window you can see diagnostic information about connection:

Fig. 6 Connection diagnostic info


For normal operation run
com2tcp.exe --baud 115200 --ignore-dsr \\.\COM1 1234
Or something similar, depending on your particular task and terminating equipment setup.
6.1.2 Channel with virtual COM port
In this kind of setup a virtual COM port on PC will act as a physical port of remote device
connected to a modem, as shown in the figure below.

To set up a data channel with a virtual COM port you will need to install com0com software.
During default setup new virtual serial ports will appear among devices present on your PC
(visible in Device Manager):

Fig. 7 New serial port found during com0com installation

Fig. 8 Setting up a new serial port

Fig. 9 Serial ports in Device Manager


After installation you can set up your new pair of ports through GUI or command line interface.
Let's rename one end of our pair into СОМ33. During rename, incorrect or occupied names are
marked by colour. Here you can also create a new pair of ports.

Fig. 10 Null modem pairs setup GUI


To test, run
com2tcp.exe --baud 115200 --ignore-dsr --telnet \\.\CNCA0 1234
Then run Hyperterminal (Start-Programs-Accessories-Connection) and select virtual port
СОМ33 from list:

Fig. 11 Selecting a virtual serial port set up earlier


Set up the port:

Fig. 12 Setting up virtual COM port to test for correct opration


and again run
telnet localhost 1234
(connection to TCP port 1234 of your PC). We are making connection through com2tcp and
virtual null modem cable to Hyperterminal on СОМ33:

Typing letters in one window will show them in another, and vice versa.
For normal operation run
com2tcp.exe --baud 115200 --ignore-dsr \\.\CNCA0 1234
or something similar depending on your equipment settings and user software capabilities.

6.2 Modem setup


6.2.1 Loading applet files into modem
You can load rs2gprs.jar и rs2gprs.jad into modem with Mobile Exchange Suite software avilale
at http://gsmpager.ru/soft/tc65mes.zip This program after installation creates in "My computer"
folder a new device named "Module" (fig. 4).

Fig. 13 "Module" deice


If your modem is connected to a PC by straight 9-pin cable its file system will be visible
through "Module" shortcut (see fig. 5).

Fig. 14 Modem file system


Copy rs2gprs.jar and rs2gprs.jad into this folder by means of Windows (e.g. Drag and drop, or
copy and paste).
Another convenient way of loading files is through free SiMoCo program by Pavel Cibulka, that
can be found in Internet. My separate thanks to this guy.
6.2.2 Modem setup
To set up your modem and rs2gprs applet connect the modem to a PC using modem cable
(straight) and run any serial terminal (Hyperterminal or latest PuTTY). Open the port connected
to modem at baud rate 115200 bps with flow control disabled. In Hyperterminal press any key to
start connection. After that power up your modem. When ^SYSSTART appears on screen type
AT^SJRA=A:/RS2GPRS.JAR and press Enter. The applet rs2gprs should start (you will see OK
then Starting…) Within 10 seconds from appearing “Press ENTER twice to see menu” prompt
press Enter twice and you will see setup menu (fig. 15).
Fig. 15 rs2gprs setup menu
rs2gprs menu structure is shown below. To work with menu press requested alphanumeric keys
(e.g. to display applet settings press 1 in root menu). Press Enter to redisplay current level menu.

Fig. 16 Example of displaying current applet settings


Usually it is sufficient to provide APN (access point name), server's IP address or URL, and port
number to make a GPRS connection to server PC. If PC has dynamic IP address you can try
using http://www.dyndns.org or similar services. If you connect through router, ADSL modem
or other network infrastructure you may need to set up port forwarding.

Menu Submenu Meaning if Explanation


unclear
1 – Display Displays current applet settings
settings
2 - Change
settings
2 - Change IP Change server Enter IP address or URL for
address or URL to address modem to connect to. E.g.
connect to 12.34.56.78 or myserver.net
3 - Change port Change port Enter server port number for
number to connect to number modem to connect to (must be
equal to value set in Settings-
Connection menu if using
ModemNet.exe software on PC
side) or port for incoming
connections, if rs2gprs acts as
server
4 - Change keepalive Keepalive byte used for channel
byte value activity is encoded by sending this
byte twice while in normal data
flow (similar to ESC sequence in
XON/XOFF flow control). It is
recommended to set byte value
that cannot appear in data channel
or appears rarely in data flow.
5 - Change APN E.g. internet.nw
6 - Change username Enter login and password here if
your provider requires it for
7 - Change password
connection
8 - Change module Modem СОМ port baud rate
port baud rate during normal operation (during
setup it is always 115200)
9 - Change PIN code Enter PIN code here if PIN
authentication is turned on in your
SIM card. Otherwise enter "(no)"
here.
A - Change Buffering delay Data packet arriving over GPRS
MODBUS in milliseconds will not be sent to modem's СОМ
accumulation delay port until no data arrives over
(used if M=on) GPRS during this number of
milliseconds.
B - Change phone Dial this number Sometimes people really need to
number for CSD if you will use use CSD (slow but no delays)
calls CSD instead of instead of GPRS, and this setting
GPRS is exactly for this special case.
Important! This can be VERY
expensive!
C - Change Applet operation Acting as a client, rs2gprs will
operation mode: 0 - mode: client or keep connected to external server
client (connects to server over GPRS. Acting as a server, it
external server), will receive incoming connections.
1 - server (listens for
incoming
connections)
F - Save settings to Save current settings to file. These
file settings will be loaded on modem
power-up.
K - Toggle keepalive Turn sending keepalive bytes on
usage or off
M - Toggle Turn serial packet buffering on or
MODBUS off
compatibility
D - Show debug info Helps during debug, but do not use
in terminal it in production environment!
0 - Exit menu Go to main menu
6 - PIN menu
1 - Try current PIN Used to check if the current (being
into SIM card set up in menu 2-9) PIN code is
accepted by SIM card.
0 - Exit menu Go to main menu
9 - Exit Exit from rs2gprs into modem
program command line (modem will accept
AT commands)
0 - Exit menu Exit from menu and run rs2gprs

6.2.3 rs2gprs Autostart Setup


To enable rs2gprs automatic start on modem power-up run the following commands in terminal:
at^scfg="Userware/Autostart/Appname","",a:/rs2gprs.jar
at^scfg="Userware/Autostart","",1
at^scfg="Userware/Autostart/Delay","",50
If modem responded OK to each of these 3 commands autostart will be turned on and will
proceed in 5 seconds after modem power-up.
7 Operating Sequence
After you have set up your modem, tested your settings and saved them into configuration file,
just run both PC software and modem.

7.1 Modem as Client


Modem will attempt to connect to server until success. After successful connection a serial
communication tunnel will appear between serial port of modem and virtual serial port on PC (or
user application).

7.2 Modem as Server


Modem will accept one incoming connection to its IP address and port at a time. After successful
connection a serial communication tunnel will appear between serial port of modem and virtual
serial port on PC (or user application).
Attention! After disconnect on any cause new incoming connection will be possible only after
delay (approx. 120 s) needed for modem reinitialization.
8 Source Code
rs2gprs applet source code can be compiled in Eclipse 3.2 (http://www.eclipse.org) with
EclipseME plugin (http://eclipseme.org/, later http://www.eclipse.org/dsdp/mtj/). You can load
pre-configured environment from http://gsmpager.ru/soft/eclipse.rar .
Source code can be loaded from http://gsmpager.ru/tc65.html .
9 Changes
120523: new “B” anc “C” commands in setup menu, added changes describing modem operation
as TCP server.

You might also like