Ohaus Defender 3000 scales: Commands to request the weight (and to control the scale).

The Ohaus Defender 3000 series scales with T32XW and T31P indicators can send the weight via the standard RS-232 interface. There are several ways to trigger data transmission:

  1. By pressing the print button1 on the scale,
  2. automatically at each stable weight,
  3. continuously2 at a rate that depends on the baud rate (approx. 50 values/s with standard setting 9600 bit/s; 100 values/s with 19200 bit/s)3,
  4. in intervals from 1 s to 3600 s,
  5. on demand via the interface with a suitable command (bidirectional communication).

In this article I’ll describe the 5th method: a device connected to the balance via the RS-232 interface (e.g. a computer, microcontroller, PLC, etc.) sends a command to the balance and it responds with the weight:

Requesting the weight from an Ohaus Defender 3000 scale
Made by me with Microsoft Whiteboard, an application that fits my limited artistic talent
Notes:
1 Originally, scales were more often connected to printers than to computers, hence the name “Print”.
2 Continuous transmission (3) is not possible with verified (legal-for-trade) scales.
3 The actual measuring rate (conversion rate) is always approx. 16 values/s.

All explanations in this article refer to the current (October 2021) generation of the Ohaus Defender 3000 with the T32XW indicator with firmware 1.03 (left in photo above) and the T31P indicator with firmware 1.14 (right in photo).

Instruments with different firmware as well as older or possible future newer Defender 3000 models may behave differently. For verified (LFT) scales, some features are disabled (also, legal requirements must be observed when connecting verified scales to computers).

Commands to request the weight and data format of the response

To send commands to the scale and to view the reply, you can use any serial terminal software (I’ll be using HTerm). No settings need to be changed on the scale: by default, data transmission by pressing the print key (1) and requesting the weight via the interface (5) is supported.

Important: In HTerm, be sure to select “CR” or “CR-LF” in Send on Enter under Input Control so that all commands sent to the scale are terminated with these characters (required).

The following commands are listed in the user manual (PDF), I’ll discuss them in detail below:

Defender 3000 scale commands

SP command (Print when stable) – does not work as expected

If the scale sent the weight as soon as it stabilized after receiving SP, this command would be very interesting. However, the Defender 3000 does something completely different: it sets the Print > Stable setting to “On” and responds with “OK”:

SP command Ohaus Defender 3000 scale

As far as I know, this setting cannot be changed back to “Off” with any command (except the Reset command). It must be changed directly on the indicator in the Print menu.

This command is unfortunately useless for retrieving the weight. On other scales, such as the Ohaus Defender 5000, it works as expected.

P command (Print)

The P command corresponds to pressing the Print button on the scale. Therefore, the already mentioned stability setting (Print > Stable) is observed:

Print > Stable: “On”

If Print > Stable is set to “On”, the weight is only sent if it is stable (an asterisk * appears in the upper left corner of the display when the weight is stable). If the scale receives the P command when the weight is unstable, it does not respond (and the display briefly shows “–NO–“):

P command Ohaus Defender 3000 unstable print stable on

Note: For verified scales, Print > Stable is always set to “On” and cannot be changed.

Print > Stable: “Off

If Print > Stable is set to “Off”, the scale always responds to P with the weight. Unstable weights are marked with a question mark (see below).

Output format of the scale when replying to the P command

The description in the manual is largely correct:

Defender 3000 scale output format

The 7 characters for the weight correspond to the 6 digits of the scale display plus the decimal point. The legend is only used for the gross, net and tare weight (deactivated by default) and is otherwise omitted.

Example 20.00 kg, stable:

P command Ohaus Defender 3000 scale stable

Example -3.18 kg , unstable:

P command Ohaus Defender 3000 scale unstable

Example 11,87 kg, unstable, with unit (Print > Content > Unit: “On”):

P command Ohaus Defender 3000 scale unit unstable

Example with gross, net and tare weight as well as unit (all entries in the Print > Content menu set to “On”), stable:

P command Ohaus Defender 3000 gross net tare weight unit stable

Note: The scale sends the lines with the net weight and the tare value only if the latter is not zero (i.e. if the tare function was actually used).

Same example as above, except that the tare value was set with “1000T” via the interface:

P command Ohaus Defender 3000 gross net pre-tare weight unit stable

The only difference is “PT” (pretare) instead of “T” in the last line.

IP command (Immediate Print)

The IP command can be used only with non-verified scales. After receiving the IP command, the scale sends the weight immediately, whether it is stable or not. Moreover, the response is not influenced by settings in the scale’s menu, so Print>Stable and Print>Content do not play any role.

Output format of the scale when replying to the IP command

For a stable weight, the response consists of 16 characters:

IP command Ohaus Defender 3000 stable

If the weight is unstable, two characters are added (space and question mark at the end):

IP command Ohaus Defender 3000 scale unstable

Other commands

CP (Continuous Print)

Activates the continuous transmission of the weight (possible only with non-verified scales), see point 3 at the beginning of this article. With 0P (zero + P) this can be deactivated again. The data format is similar to those described above.

Caution: The high data rate can overload some programs. In addition, the scale is sometimes falsely recognized as a serial mouse by Windows if it sends values continuously already at system startup (the mouse pointer then jumps wildly across the screen and your customer may call you and complain that your scale made his PC go crazy).

xP (Interval Print)

Transmission every x seconds (with x from 1 to 3600), send 0P to disable. The data format is the same as the P command.

Z (Zero)

For zeroing the scale, corresponds to pressing the Zero button on the indicator. The allowed range for executing the command is controlled by the Setup > Zero setting (2% or 100% of the capacity).

Note: The scale always responds with “OK”, even if the allowed range has been exceeded and the command could therefore not be executed (and the display showed “–NO–“).
Caution: If Setup > Zero is set to “0-100”, the maximum capacity could be unintentionally exceeded (as the zero range is not subtracted from the capacity).

Use the Z command to eliminate small residual values. It is not intended as an alternative to the tare command (see below).

T (Tare)

Same as pressing the Tare button. Suitable for “zeroing” the weight of a container or weighing individual components of a recipe.

The tare function can be deactivated by sending 0T (zero + T). The scale will then show the gross weight again instead of the net weight (only possible via this command, not via a button on the indicator). 0T is probably not supported by verified scales (I haven’t tried this out yet).

Note: If the tare function cannot be executed (because there is no object on the scale), the scale will still respond with “OK”, but will show “–NO–“in the display.

xT (Pre-tare)

Sets x as a pre-tare value, where x must be specified in g. Not possible with verified scales.

Example:

1000T command pre-tara Ohaus Defender 3000 scale

PU (Print Unit)

The scale responds with the currently used unit (without blank spaces, see example under xU).

xU (Unit)

Changes the current unit, 1U=>g, 2U=>kg, 3U=>lb, 4U=>oz, 5U=>lb:oz.

Important: In order to set a unit, it must have been activated in the menu of the scale under Mode > Unit. Otherwise, the scale responds with “ES” instead of “OK”:

unit grams not activated

Verified scales may not support all units (this depends on your local regulations).

Example switching from kg to g:

Change unit to grams

PV (Print Version)

The scale responds with the type of indicator (T32XW or “Defender 3000” for T31P), the firmware version (Sr=Software Release) and the “legal-for-trade” setting (“ON” for verified scales, “OFF” otherwise). With this command you can easily check if your scale uses the same firmware as my test unit.

Example T32XW:

PV command Ohaus Defender 3000 T32XW

Example T31P:

PV command Ohaus Defender 3000 T32XW

<ESC> R (Reset)

Resets all settings to the factory defaults. In my tests, some settings were only applied after a restart. I see no reason to use this command during normal operation (though – unlike on the Ranger 3000 and 4000 – it fortunately didn’t seem to reset anything in the CAL menu).

Example:

Reset command Ohaus Defender 3000

Summary of how to request the weight from an Ohaus Defender 3000 scale

The IP command is the simplest way to retrieve the weight (with the unit) from the Defender 3000. However, it cannot be used with verified scales.

Alternatively, the P command can be used, which is equivalent to pressing the Print button. It is influenced by the Print > Stable setting (send only stable values) and Print > Content setting (scope of transmitted data and unit).

SP is not a command to retrieve the weight, even if the description in the manual suggests this.

The format of the scale’s response differs slightly depending on the command (I don’t know why). I therefore recommended not reading a fixed position from the response string, but searching for the first number instead (which will be the weight).

How to connect your scale to a network (Ethernet) using Moxa’s NPort 5110A

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:

Data cables (red) are not included.

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:

Ohaus scale with Ethernet connection through Moxa NPort 5110A

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:

  1. Connect the NPort directly to a single computer (not a LAN) with an Ethernet cable.
  2. Use the NPort Administator software included with the device to configure it.

2. Network configuration

Start the NPort Administrator and locate your NPort by clicking on the Search button:NPort Administrator: Search

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:
Ethernet IP address setting in Windows 10

If the NPort is shown as locked, right-click on it and select Unlock:
NPort Administrator: UnlockThe default password is “moxa”.

Right-click again and select Configure, then select the Network tab:
NPort Administrator: Network configurationEnter 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).

To make the NPort accessible on our network, I set its IP address to 192.168.0.253:
NPort Administrator: Modified network settings

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:
NPort Administrator: Default serial settings

Enter the RS-232 settings found in your scale’s menu or user manual. The default settings of our Ohaus Defender 3000 scale are shown in the screenshot below:NPort Administrator: Serial configuration (RS-232)

Important: By default, the NPort is set to CTS/RTS flow control! You cannot change this setting when using the Setup Wizard through the web console. As mentioned before, I recommend using the NPort Administrator software instead.

4. Set an operating mode

To change the mode, go to the Operating Mode tab, check Modify, select the port and click on Settings:NPort Administrator: 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.
    NPort Administartor: TCP Server mode

    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):
    Wireshark screenshot

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

A terminal program like Termite or HTerm can connect to the virtual COM port. Make sure that the connection parameters correspond to the settings of your scale.

TCP Server

You can use PuTTY set to “Raw” TCP mode to act as a TCP client:
PuTTY configurationThe following screenshot shows commands sent to the scale and the replies:PuTTY communication with Ohaus scaleAnother 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:

TCPTester tcp utility used to test Moxa NPort connected to Ohaus scale
TCPTester free TCP test utility available from Smartlux

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):
    Moxa web console monitor async

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.

Did you find this article helpful? You can support this blog by purchasing a PDF version for US$2/copy (contains no additional information).