Many scales and balances are equipped with an RS-232 interface. Moxa’s NPort series and similar serial device servers allow you to connect such scales to a network (Ethernet). In this article, I’ll show you how to connect a Moxa NPort 5110A to an Ohaus scale and how to configure and test it.
1. Physical connection
The Moxa Nport 5110A has an RS-232 port (DE9M) on one side and an Ethernet port on the other side:
To communicate with your scale, you’ll need a matching RS-232 cable. The Ohaus Defender 3000 scale used in this example requires a DE9M to DE9F straight (1:1) cable:
Once the physical connection to the scale has been established, the Moxa NPort has to be configured. There are several ways to do so. I prefer the following method:
- Connect the NPort directly to a single computer (not a LAN) with an Ethernet cable.
- Use the NPort Administator software included with the device to configure it.
2. Network configuration
It should be found at the default IP address (192.168.127.254).
Note: It’s not always necessary to change your PC’s IP address if you’re running the NPort Administrator software. However, if you receive error messages during the following steps, try to temporarily set your computer’s IP address to an address on the same subnet (such as 192.168.127.1).
Select the Ethernet connection under Control Panel > Network and Internet > Network connections, right-click on it and choose Properties, then select Internet Protocol Version 4 (TCP/IPv4) and click on Properties. Make a note of your current settings so that you can restore them later, then enter the temporary IP address:
Right-click again and select Configure, then select the Network tab:
Enter a static IP address, subnet mask and gateway that work on your network (or select DHCP or BOOTP for automatic address assignment, though this is not recommended for most operating modes).
With the network configuration complete, you can disconnect the NPort 5110A from your computer and connect it to your network (LAN).
3. RS-232 configuration
It is essential that both the NPort and the scale use the same settings for the serial port (RS-232). In the Serial tab, select the port (the NPort 5110A only has one, but you still have to select it), check Modify and click on Settings:
4. Set an operating mode
The NPort 5110A supports several operating modes, I will only discuss the following two here:
- Real COM mode: This mode allows you to create a virtual COM port on a PC and use the scale as if it were connected directly to that PC. This is very useful when you’re using software which only supports connections to COM ports and cannot communicate over TCP/IP (such as our 232key virtual keyboard wedge software).
Please note that you’ll have to install a virtual COM port driver on the PC that communicates with the scale. In my tests on Windows 10, setting up the COM port through NPort Administrator did not create a new virtual COM port on the system. However, using the NPort Windows Driver Manager worked.
- TCP Server: The NPort acts as a server, waiting for incoming connections from TCP clients on port 4001 (or on another user-defined port). The maximum number of concurrent connections can be changed from 1 (default) to up to 8. This mode works with software like our Simple Data Logger and many others.
Note: It is not necessary to set the data packing options unless you want to optimize either for minimal latency or maximum throughput. By default, the device will try to find a reasonable compromise (this is likely achieved by observing the delay between the data received over RS-232 to determine when a “line” of data is complete).
When I set the scale to continuous transmission mode (wich has no delay between the weight values), the NPort packed 104 bytes in each Ethernet frame, corresponding to almost 6 weight values (the scale sends 80 values/s):
For further details and for information on the other modes, please consult the user manual.
5. Run a test
Depending on the operating mode chosen above, you’ll have to use different programs to test the NPort 5110A. In addition to the software I’ve already mentioned above, you could use the following:
Real COM mode
You can use PuTTY set to “Raw” TCP mode to act as a TCP client:
The following screenshot shows commands sent to the scale and the replies:Another option is our free TCPTester software. It repeatedly sends a user-defined command to the scale (e.g. to request the weight). Once a reply has been received, the command is repeated:
During testing, it can be useful to observe the LEDs on the NPort:
- The “Ready” LED should be green.
- The “Link” LED is green when the NPort has established a 100 Mbs Ethernet connection and orange on a 10 Mbps connection.
- The Tx/Rx LED flashes orange when the NPort receives data from the scale and flashes green when the NPort is sends data to the scale over the serial port. Therefore, If you’re sending commands to a scale, you should be able to see it flash green. A reply from the scale would cause the LED to flash orange. If this is too difficult to see, consider using the web console to diagnose connection issues (I found it worked best in Firefox):
I hope this article has been useful. What are your experiences with Moxa’s NPort serial device servers? Please don’t hesitate to leave a comment! For support, please contact Moxa or your vendor.