Monday, July 22, 2013

RS232 to Control LXI Instruments

Instruments that were designed more than a decade ago included an RS-232 serial port as an I/O interface. Using RS-232,  users were able to automate their instruments' measurements and configuration settings. However, RS-232 is no longer being offered as an interface on newer instruments. Some users have been reluctant to upgrade their systems with newer instruments because they won't be compatible with their system's RS-232 serial I/O. Users still want to be able to communicate to their instruments using RS-232. With these users in mind, I believe that I have found an off-the-shelf solution for RS-232 controllers to communicate with modern test instrumentation.

I wanted to find a converter that would enable communications between my RS-232 controller to a 34461A Truevolt DMM which has USB, LAN, and GPIB (optional) I/O ports. I also wanted the configuration process to be simple and painless. I didn't want to spend days trying to figure out how to get the converter to work.

The 34461A is targeted as a replacement for the 34401A. The 34401A has RS-232 while the 34461A does not. This post should help some of you that are looking at migrating to the 34461A but the lack of RS-232 support was a barrier. The techniques detailed in this post should be applicable to most Agilent LXI instruments.

Perhaps you have looked at RS-232 to USB converters as a solution but those typically connect the USB side to the PC controller and RS-232 to the device. This doesn't work in this case since you want the RS-232 on the controller side and USB on the instrument side. USB relies on a host/device pair which requires that the host have drivers to communicate with the device. Most manufacturers recognize the difficulty in having a USB converter act as the host since the converter will need to have upgradeable drivers for any USB device that the user wants to install. I haven't found any products that will allow users have RS-232 on the host side and allow custom drivers to talk with the device.

 RS-232 serial controller to communicate to a LAN instrument
Many Agilent instruments offer LXI certified Ethernet ports in addition to USB or GPIB.  Since TCP/IP Ethernet is essentially a handshake protocol without a defined host or device, this matches well with the RS-232 serial protocol for our I/O purpose. After searching on the internet for a little bit I found a few promising RS-232 to TCP/IP-Ethernet converters that might work for  RS-232 communication to LXI instruments.

I purchased the Startech NETRS232_1 from Amazon.com since it had some good reviews regarding reliability and driver support. You might want to purchase something that is rack mountable if you need to permanently mount your converter. Startech has a few other converters that offer the same functionality in a different form. I haven't purchased the Perle or Lantronix products although I believe that they will offer the same functionality.

Configuring the Converter and DMM

The default configuration for these types of converters enables the user to connect to a single serial device from multiple Ethernet devices. They are targeted at networking serial devices such as a serial printer. This is not our use case. We need to be able to connect a serial device (our controller) to a single instrument. In order to configure the NETRS232_1, I had to connect the converter's lan port to my PC using a crossover Ethernet cable. I then ran the IP Extender Manager software that came with the device. Once the software found the converter,  I had to activate and unlock the device (accomplished by right clicking on my device in the software). This allowed me to access the properties of the converter. 

I kept the converter's default network settings of:
Static IP: 192.168.0.35
Subnet mask: 255.255.255.0
Gateway address: 0.0.0.0
Name: [empty]
Workgroup: [empty]
DHCP detection: Disabled


Configuring RawClient Mode
 
The NETRS232_1 has a RawClient Port Mode that will allow you specify a target IP address and TCP port for the converter to use. To change to that mode I right clicked on my converter in the right hand pane and chose properties. Then in the Target Settings tab, I entered an IP address of 192.168.0.61 for my DMM (more on that below) and specified TCP port 5025. Port 5025 is the port that should be used for LAN socket connections on most Agilent LXI instruments and is important for this application.
 

The converters RS-232 serial settings I left at the default.
Bits per second: 9600
Data Bits: 8
Parity: None
Stop bits: 1
Flow control: None
All other settings were left at the converter's default RawClient settings.

On the DMM side I needed to configure the LAN settings to match my converter's setting. Getting into the Utility>I/O config>LAN settings>Modify Settings screen allowed me to change to Manual (static IP) mode. I then changed the Subnet Mask to match the converter's default 255.255.255.0. The IP Address was a little bit more tricky and I was only able to get the converter to communicate to my DMM if the first three fields matched the converter's static IP address i.e. put it in the same subnet. This shouldn't be a problem since the only IP devices will be the converter and the DMM. Since the converter's IP address was 192.168.0.35, I chose my DMM's address to be 192.168.0.61. Note that this address has to match the address that we set in the converter's RawClient's Target IP Address step above.

Testing the solution


Once my DMM and my converter were configured, I tested it out using the RS-232 port from my PC. Remember, from the PC's standpoint it only knows about RS-232 and does not know that the 34461A is a LXI instrument. The easiest way for me to communicate via RS-232 was to use Agilent Connection Expert (ACE) from the Agilent IO Libraries Suite. I opened up ACE and configured my COM1 port to the same RS-232 serial settings as the converter's. The picture below shows that ACE is able to communicate to my 34461A via RS-232. ASRL1::INSTR is the convention that Agilent uses for addressing RS232 communication on the COM1 port.


I also tried to do some basic configuration and readings. Using Agilent Interactive IO, I was able to do single readings and 10 readings per sample. This proved to work well and I didn't have any issues with this. I won't be able to get maximum DMM reading and transfer rates with this converter due to the limiting transfer speeds of RS-232.





Additional Tips For This Solution

I did find a few small things to be aware of when working with this adapter.

  • As mentioned before, I needed to set the IP address of the DMM to be in the same IP address  range of the converter. Even though I had set the same subnet mask, I could not get the converter to communicate to the DMM using the DMM's default Auto-IP address of 169.254.4.61. I needed to set the IP address to be within the same range as the default settings of the converter at 192.168.0.35, to put it onto the same subnet. This meant that I needed to set the address to 192.168.0.xxx,where xxx is any number between 0 and 255.
  • I also found that the converter took a little bit of time to apply it's settings. By this, I mean that after I would change the settings I could not communicate to the DMM right away. This led me to believe that I had a setting wrong. An example of this is when the converter didn't change the target IP address right away. After about 2-3 minutes the converter would apply its settings and I could communicate.
  • This solution shouldn't need IT approval for using the DMM's Ethernet port. Since this is a direct connection from the PC to converter to the DMM, all Ethernet traffic is isolated to the converter and DMM.
  • I didn't try to set the converter to DHCP mode in order to put it onto the LAN. Most applications that need RS-232 are looking at direct connections from the controller to instrument. However, I believe that DHCP mode would work provided that the IP address of the DMM/instrument is static so that you can configure the converter's Target IP address.Use of DHCP and you LAN might need your IT department's approval.

As a proof of concept, it looks like the RS-232 to Ethernet converters will work if you that need to use RS-232 with modern instruments. The configuration process took me about 1.5 hours to figure out and understand the subtleties. With the steps that I documented here, it should take less than 30 mins to setup in the future. Not too bad for an off-the-shelf solution.








7 comments:

  1. Thanks for doing the investigation on this!

    ReplyDelete
  2. I couldn't manage to communicate with my Keysight 34461A until I set the port to 5024 instead of 5025. The Ethernet To RS232 converter I am using is a Brainboxes ES-246. To make it work, "Serial Tunneling" must be enabled and "Telnet" protocol type should be used instead of RAW TCP.
    I was also able to make it work without hardware converter just by using a software virtual COM port to Telnet redirector. HW VSP3 did the trick (http://www.hw-group.com/products/hw_vsp/index_en.html).

    ReplyDelete
  3. Just a smile and the rain is gone Can hardly believe it, yeah. There's an angel standing next to me. Reaching for my heart Just a smile and there's no way back .Can hardly believe it, yeah But there's an angel calling me. Reaching for my heart I know that I'll be okay now. This time, it's real I lay my love on you It's all I wanna do Every time I breathe I feel brand new You open up my heart Show me all your love and walk right through As I lay my love on you.
    dumb ways to die
    fireboy and watergirl 4

    ReplyDelete