RS232 over the Internet

Connecting a GNSS serial port over the Internet to a remote SNIP NTRIP Caster is easily achieved using one of the many serial to internet adopter dongles available.  In this article we describe the setup process using the popular USR-TCP232-302 product made by Jinan USR IOT Technology and available from many electronics retailers for about $25 dollars (US).  The firm makes a variety of similar products including some with WiFi connectivity if you do not have a physical internet cable (RJ45) near the Base Station.

If you happen to have a spare PC, or a low cost NUC node, the free Lite model of SNIP can also be used to connect older serial GNSS Base Stations by their serial ports.  That has the advantage of using proper NTRIP protocols and security for the connection.  In this example we will use the serial to internet adapter device and create a RAW connection to the SNIP Caster.  These adapter devices simply read in the serial data stream and then establish a connection with common TCP/IP to the designated remote device (in this case the Caster).  But they are not able to add the NTRIP protocol details, hence the need for a RAW TCP/IP style connection.


The setup process consists of three separate steps:

  1. Initially connecting to the adapter device
  2. Programming the adapter device
  3. Programming the SNIP Caster to accept the connection

Of course you must also program the GNSS device to send the data you need (observations, the precise antenna location, etc. typically all encoded in RTCM3 messages).  These settings should then be saved in the device so that when there is a power lose and recovery, you will not need to reset things.  We recommend that you power cycle the entire Base Station setup a few times once everything is working to ensure it will recover as desired.

Connecting to the Device

Typically half the battle is to initially find and connect to the adapter device itself.  In this authors experience, this is the step that often consumes the most time.

This is best initially done at the comfort of a desk rather than out in the field/barn/shed where the Base Station is to be installed.   We presume there is a working PC with a working internet connection and a browser.  We will use the browser (and a small web page built into the adapter device) to adjust the settings.  A common internet cable will be needed as well as a place to plug in the adapter device into a bridge or hub.

⇒⇒ Plug the adapter device power module cord to the wall and to the device.  Plug in the internet cable to your local network.  Confirm that you see the normal two lights (current sensing and packet traffic) under the cable.  Now that the device is operational, we need to find it on the network.

Fresh out of the box (or after pressing the reset button and power cycling) the device IP is set to 192.168.0.7 (with a mask of 255.255.255.0 and a gateway of 192.168.0.1). [A basic knowledge of how IP addresses works is assumed here, but nothing of any depth]  It does not do DHCP until you program it to do so.    It does reply to PINGs. [Devices from other makes will use other IP values as their defaults]

If you happen to be in network where the sub-net 192.168.0.x is reachable, great, you can reach the adapter device without any annoying temporary network changes.  Bring up a command prompt and type “ping 192.168.0.7” and confirm this (if it is reachable, you will see the text Reply from 192.168.0.7 bytes=32 ….).   You can move on to the next step, Programming the Device.

Many local networks avoid using 192.168.0.x  (here we use 192.168.1.x in one office and 192.168.2.x in another).  If you happen to be in an office or home that uses 10.10.x.x. or 192.168.xx.yy where xx is not == 0, then you will need to create a temporary network to gain access to the device at 192.168.0.7  – but that is really not as hard as it might seem.

You only need one PC and an internet cable which you will connect directly between the PC and the adapter device (a WiFi connection is not suitable for this).  We will simply copy down the current network settings, then change them, program the device, confirm it works, and then change everything back.  Do not attempt this on a ‘network PC’ that loads its operating system from a central server each day.  While doing this, the PC will not have access to the internet or to eMail, or any other resources in your local office network.

First we need to document what the current network card setting on the PC are set to be.  Go to your Control Panel, select Network and Internet, select Network and Sharing Center and then select Change adapter settings .  Double click on the Local Area Connection icon for the connection you will use.

You should now be looking at a Local Area Connection Status dialog box similar to the below.

In a moment we will change the TCP/IPv4 settings (under Properties) so we can reach the adapter device.  But first we must document the current settings to restore them.  If you (more correctly, your office environment) use DHCP, this is easy, less so if you have entered specific settings.  Click on the button marked Properties.

Select (click on) the entry marked Internet Protocol Version 4 (TCP/IPv4).

Press the button marked Properties and take a look at the displayed screen.  It will look similar to one of the two images below.   The one on the left is a machine using DCHP to obtain the IP values; the one on the right is using manually entered values.

[Aside: Each separate connection on your machine has these settings.  Here we should be using the physical RJ45 cable connection for the internet, not any WiFi connection or any virtual connections you may also have on this machine.  If you do not normally use this connection or cable you may have to enable the adapter to be able to set its values.]

If your machine has the radio button checked for “Obtain… address automatically” – please note that for restoring later.

If your machine has values entered in the fields, please jot the numbers you see down (or screen capture) for IP address, Subnet mask, Default gateway and any DNS Servers.  We will need to restore these values as a final step.

We can now enter the values shown below so that the PC and the adapter device can see each other:

Save these values.  You can check them with the ipconfig command from a command line if needed.

⇒⇒ Plug the adapter device internet cable directly to your PC, unplugging the cable that was there.  The power supply module should be active and plugged in from the prior step.  Confirm that you see the normal two lights (current sensing and packet traffic) under the cable.  Now that the device is operational, we need to find it on the ‘network’ you have created consisting of just these two devices.

You should now be able to PING the adapter device as well.  Because your PC and the adapter device are the only devices on this ‘network’ (the cable between you), no other devices can be reached at this time.

Open whatever web browser you prefer to use on the PC. Enter the IP for the device (at present 192.168.0.7).  If you connect to the adapter device you will see a log on dialog.

Congratulations. The default user and password is admin / admin. We can now move to programming the device itself.

Programming the Device

The adapter device is programmed with a simple web interface. Similar to many small network appliances, parameter values are set on the web page, then the device is restarted to install the new values.    One annoying detail with the USR_TCP232-302 is that it is built in China and will default to Chinese characters for some of the web page error messages.  But all the key pages are available in English (you can toggle between the two with a small icon in the upper right hand corner of most pages).

If you have not already done so, log on to the device (user = admin  password = admin).  You will be presented with a simple web status page.

The tabs/buttons along the left side are used to access the major controls and bring up a web page for that purpose.   We next have to set up the permanent IP to be used and then set both ‘sides’ of the device.

  • Unless the IP 192.168.0.7 is suitable for your environment, this should be changed.
    Use the Local IP Config tab for this.
  • The internet side, so the device can reach your SNIP Caster and send it data.
  • The serial port side, so the device can read the serial date from the GNSS Base Station
    Use the Serial Port tab for both of these

Note: If you will be using more than one of these devices within a single subnet, they each must have their own unique IP address.

Setting the permanent device IP

Press the Local IP Config tab to bring up the below web page and enter the IP you would prefer to use.  Be sure that the submask and gateway values are correct as well. The adapter device needs a valid gateway to send data to the remote NTRIP Caster.

[Aside: Any valid DNS value can be used (for example google at 8.8.8.8).  In this example we entered the direct static IP value for the Caster was used, rather than the domain name. The adapter device implements its DNS resolution using php and some odd web page clutter has been observed when it is first used. ]

In the above example the value 192.168.1.150 was used.  Enter a value suitable for your use.  [This was a value selected to work well in this office (where we use a sub-net at 192.168.1.xxx).  You would presumably select a value for your own office sub-net (or wherever the GNSS base and the adapter device will be placed) so that the adapter device can reach the internet and so you can reach the device from any nearby PCs]

You can now save this value and then will be asked if you wish to restart. Save and Restart.
Note: Every time you save a new IP value, you must then log on again to the new IP value.

We recommend you assign a static IP within the range of your office DHCP and not use DCHP itself (although the device does support that – select it in the drop down if desired).   The reason for not using DHCP is that this device will in time need to be found again on the local network and unless you can access the current DHCP leases, this can be problematic. Unlike a PC, there is no easy way to sit at the device and determine what value it has been assigned.

Reconnect to the device at its new IP address and continue with the steps below. Best practice: Tape a label with the new IP on the device for future assistance.

Note: You can reset the device to all the original values and the IP of 192.168.0.7 if you hold down the reset pin for ~10 seconds and power cycle the device. This is helpful when the device is ‘lost’ after the new IP is assigned.

At this point you can now restore the network card details to their prior values and return your PC to its full functionality.

⇒⇒ Plug the adapter device internet cable directly to your local network now.  Cycle the power to the adapter device on and off. Restore the PC network cable as well. Restore the PC network network settings from your notes as well.  Now that the device is operational with its new IP, ensure we can still find it on the network at the address you assigned it to. Confirm that your PC can again reach other devices (such as internet browsing and eMail) as well as the adapter device.  Be sure to label it!

Entering the remote NTRIP Caster IP

Now that a suitable local IP has been assigned to the device and the device can be reached, we will use the Serial Port tab to set up each side of the interface:

  • The internet side, so the device can reach your SNIP Caster
  • Then the serial port side, so the device can read the serial date from the GNSS Base Station

Enter the remote IP of the SNIP NTRIP Caster in the field marked Remote Server Addr.  If you enter a URL, the IP it resolves to will be shown below it in brackets, once it is connected.  Enter the port the Caster listens on (typically 2101) in the field marked Remote Port Number. The field marked Local Port Number is not used.

The field marked “Work Mode” is set to be TCP Client which indicates that the adapter device will initiate the TCP/IP connection to the SNIP NTRIP Caster.  We do not use a server mode here because this device lives behind your firewall and is unable to receive inbound connections.

Setting the Serial Baud rate details

Press the Serial Port tab to bring up the below web page.

The baud rate values and other values selected (parity and stop bits) must match the values used by the serial port on the GNSS device.  This interface is a simple ‘three wire’ one (no clear to send wire is present).  We typically use 19200 bps for a base with GPS+GLO data, but faster speeds are needed when more GNSS signal are present. If you are getting data at the other end but it is garbled, mismatched baud rates are the typical cause.

Oddly, the Baud Rate field does not present the normal standard speeds in a combo list to chose from, you must enter the value by hand.  Enter whenever one of these values matches your GNSS equipment settings:  9600 19200  38400 57600 76800 115200 230400 or 46080.

The cable you will need will vary based on the GNSS equipment used. If you have formally used a simple straight cable to connect the GNSS to your PC running a terminal program or some other setup utility, you will need a null modem cable to connect to the adapter device.  The cable end for the device is a male db9 plug.

⇒⇒ Plug the serial cable from the GNSS Base Station into the adapter device. Data should now be flowing to the device and the device should immediately try to connect to the remote IP address and port you entered before.  Unless the this IP and port is open at the other end (the final step below) this connection will fail and the device will simply retry.

 

Sending Data into the SNIP Caster

On the receiving SNIP device we need to establish an active Raw connection slot to accept the incoming data.  This is discussed in detail in other knowledge base articles, please see one of the below.

The RAW TCP/IP Tab explained.

Setup details for a RAW TCP/IP connection.

When connected, the details shown on SNIP are similar to any other RAW connection.

And We are done….

Once all of the above is completed, data will flow to the SNIP caster immediately. There is no concept of an on or off mode for this particular device.  Once correctly setup it will simply run.  You can see also the progress of data leaving the device from its web pages (the Current Status tab) which is updated every 5~8 seconds.

In the above you can see that data is flowing to the “Remote IP/TX/RX-1” connection.  The 12 bytes of in-bound data is the “OK” reply returned by SNIP when the connection was started.  The other empty entries (-2, -3, -4) are not used in this connection mode.

A few concluding remarks

Most other manufactures and devices have very similar setup screens and options.  Two options you may find bear additional comment and guidance.

Buffering– As a rule no buffering is desired as it causes latency and delay.  The GNSS will typically dump a sequence of new messages at a 1Hz rate as a block of continuous serial data.  The precise byte count of this data will vary as the number of satellites (SVs) changes, so is is not a useful threshold for trigger sending from.  The size of the TCP packets used will also vary with the network being used, and rarely align to RTCM message sizes. In a similar way, avoid enabling any buffering in any USB/Serial devices connected to the GNSS.

Keep-Alive – There is no need for the use of the keep alive protocol in an NTRIP system as the messages themselves serve to provide a 1Hz exchange rate.  It should not be enabled, but will do no actual harm other then a mild waste of bandwidth.  The keep-alive messages consist of 64 byte empty frames that exchanged at the TCP level. SNIP also monitors every NTRIP connection at the application layer to detect time outs and data starvation.

If you elect to change the default user and password (found in the Misc Config tab), then be sure to denote that on the device label you made.  You made that label, right?   The reset button will restore the factory defaults when needed.

In conclusion, these inexpensive device offer a simple way to connect any Base Station that has only a serial port and is not able to speak the NTRIP protocol into your SNIP NTRIP Caster network.

Related Articles