Using Ohaus Defender 3000 Scales with BarTender

In this article, I’ll show you how to capture the weight (and tare weight) from an Ohaus Defender 3000 scale using BarTender while avoiding an issue that would otherwise lead to the scale showing only “Print” on its display.

Notes:

This guide applies to the new generation of Ohaus Defender 3000 scales launched at the end of 2021/beginning of 2022. The picture below shows the new indicator on the right and its predecessor on the left.

Ohaus Defender 3000 indicators: Old model on the left, new one on the right.

It was created using Bartender Designer 2022 R8 and version 1.04 of the Ohaus Defender 3000 firmware. Future versions might make things easier (or more difficult, as seems to be the general trend).

Can you use existing Ohaus scales defined in BarTender?

Let’s try it out. In the menu, go to Administer > Weighing Scale Setup:

BarTender Weighing Scale Setup

If no scale has been defined yet, this will launch the Add Scale Wizard (otherwise, click on Add Scale in the windows that appears):

BarTender Add Scale Wizard

After clicking next, you’ll be able to select “Ohaus” as the manufacturer and you’ll see a number of supported models. Select “Ohaus 3000 Series” (as this sounds most similar to “Ohaus Defender 3000 series”):

BarTender Add Scale Wizard Ohaus scales

Continue by specifying the connection method. If your scale is connected via USB or RS-232, you’ll also have to choose the COM port and confirm the interface parameters (Flow Control is set to XON/XOFF by default, it doesn’t really matter):

Click next on all further steps of the wizard. After completing it, we can now test the scale. Select it and click on Properties:

In the window that opens, switch to the Connection tab, then click on Test Connection:

Bartender will start sending the “IP” (Immediate Print) command to the scale to request the weight. It does so multiple times per seconds (4 times by default). It seems to capture the net weight correctly (5.005 kg in the screenshot below):

However, there are at least two issues with this method.

1. The scale shows “Print” all the time

When the scale receives the “IP” command, not only does it reply by sending the weight, but it also shows “Print” on its display. As BarTender sends this command multiple times per second, “Print” is all that you’ll see:

My opinion: Displaying “Print” when the user presses the Print button on the scale is useful (it gives the user feedback). Displaying it when the “P” command is received can be justified by saying that the scale should behave just as if the user had pressed the physical button. However, displaying it when the scale receives “IP” does not make much sense to me. I’m hoping Ohaus will reconsider this and change it in a firmware update. Until then, you can use the solution described below.

2. You cannot use a tare weight

The second issue I found is that once you’ve used the scale’s tare function, BarTender is no longer able to capture the net weight (and it also can’t capture the tare weight):

Solution: Define a new scale that uses the MT-SICS protocol

Unlike its predecessor, the new Defender 3000 supports (some) MT-SICS commands. The MT-SICS equivalent to the “IP” (Immediate Print) command is the “SI” (send immediately) command1. Fortunately, the scale replies to this command without displaying “Print”. Moreover, it also supports the “TA” command that BarTender uses with MT-SICS Level 1 scales to request the tare weight.

Note: You can explicitly set the scale to “SICS” by going into the “Print” menu (for RS-232) or “Print1” (for USB or Ethernet) and setting “Assignment” to “SICS”, but this was not necessary in my tests.

Let’s start the Add Scale Wizard again, but this time, you don’t select an existing model. Instead, choose Define a model not listed above:

Define a new scale model

Then, select Ohaus as the manufacturer and enter a name for your new model, e.g. “Ohaus Defender 3000 SICS”. Under Protocols Supported by this Scale, select “Mettler Toledo (MT-SICS Level 1)”:

Continue with the Wizard as before.

I used this opportunity to test the optional Ethernet interface of the new Ohaus Defender 3000. I set it to acquire an IP address via DHCP (which is out of the scope of this tutorial), connected it to our network and then copied its IP address from the menu under Ethernet/IP Address. The port (which is also displayed by the scale) is alway 9761:

Specify scale connection in Bartender: TCP/IP Network Port

You can – of course – still connect to the scale using a COM port.

After completing the Add Scale Wizard, it is again time to test the connection. Click on Properties:

Installed Scales: Ohaus Defender 3000 SICS

In the new window, switch to the Connections tab and click on Test Connection:

You’ll now see that the net weight and tare weight are acquired correctly:

Ohaus Defender 3000 current weight shown in BarTender

Futhermore, the scale’s display now shows the weight instead of just “Print”.

Conclusion

The new Ohaus Defender 3000 scales are compatible with BarTender, but initial setup is not quite as straightforward as one might expect. You’ll get the best results by defining a new scale that uses the MT-SICS protocol (which the new Defender 3000 supports, unlike its predecessor).

I hope this tutorial is helpful. Please don’t hesitate to leave a comment, but please note that I am in no way a BarTender expert and that answering BarTender-related questions is not something I particularly enjoy. I suggest using the BarTender’s Online Help system or contacting Seagull Scientific if you need support with their software.


  1. Well actually, the equivalent would be “SIU” (send immediately in display unit), but this article is long enough and “SI” is the better choice anyway. ↩︎

How to use the Ohaus Defender 5000 demo kit suitcase

The demo kit allows you to easily test the many interfaces available for the Ohaus Defender 5000 indicator. Its sturdy case is well suited for shipping.

Follow these steps to start using it:

  1. The required components and cables can be found in the compartment on the left side (1).
  2. Connect the load cell simulator (2) (3).

This device simulates the load cell that is normally installed in the weighing platform. Make sure that the pointers on the gauge are at 0, but do not turn on the scale yet.

  1. Set the selector knob (4) to the interface you want to test (e.g. WiFi/BT).
  2. If necessary, plug in the WiFi/Bluetooth dongle (5).
  3. Connect the device to AC power and switch it on.

Turn the load cell simulator counterclockwise to increase the weight:

The configuration of the interface is done in the menu of the scale. Printed instructions are included in the case (6).

When using a WiFi or wired Ethernet connection, the device acts as a TCP server. By default, the IP address is assigned automatically (DHCP). WiFi uses port 6060 and Ethernet port 9761.

After establishing a connection as a TCP client (e.g. using PuTTY), you can request the weight by using one of the commands listed in the manual. The “P” command corresponds to pressing the Print button on the scale. The device will answer using the default template:

This template can be changed in the menu. The menu also allows you to select a different capacity or graduation.

Note: A micro SD card is included in the device, but it cannot be easily accessed.

Reading the weight from an Ohaus Defender 5000 scale with PHP

Please consider: A single-threaded, synchronous programming language with blocking I/O calls like PHP may not be the best choice for communicating with a scale. The following post is not meant as a recommendation for PHP.

Defender 5000 scales can be equipped with a WiFi or wired Ethernet interface. The scale acts as a TCP server and your script establishes a persistent connection as a TCP client.

You can then use one of the following methods to send the weight from the scale to your PHP application:

  • Send a command to the scale to request the weight (described in this post).
  • Wait until the operator presses the PRINT button.
  • Configure the scale to send each stable weight automatically.
  • Set the scale to a continuous transmission mode (it will send several values per second).

Please see the Defender 5000 manual (PDF) for further information.

You can easily test the communication via wired Ethernet or WiFi by using PuTTY in “raw” mode:

PuTTY raw tcp connection
The WiFi dongle uses port 6060 (wired Ethernet: port 9761), the IP address is assigned via DHCP by default.

Defender 5000 scale: weight in PuTTY
IP (immediate print) command used to request the weight and reply sent by the scale (N: net weight, G: gross weight, T: tare weight).

Using PHP to communicate with the scale

For demonstration purposes, I’ve adapted example #2 (simple TCP/IP client) from the official documentation:

<?php
error_reporting(E_ALL);

echo "TCP/IP Connection\n";

/* Ohaus Defender 5000 WLAN interface uses port 6060 by default, Ethernet interface uses port 9761 */
$service_port = 6060;

/* IP address of the scale, can be displayed/set in the menu */
$address = "192.168.0.195";

/* Create a TCP/IP socket. */
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket === false) {
    echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n";
} else {
    echo "OK.\n";
}

echo "Attempting to connect to '$address' on port '$service_port'...";
$result = socket_connect($socket, $address, $service_port);
if ($result === false) {
    echo "socket_connect() failed.\nReason: ($result) " . socket_strerror(socket_last_error($socket)) . "\n";
} else {
    echo "OK.\n";
}

$in = "IP\r\n"; //IP command (Immediate Print) - supported commands depend on the manufacturer, model and LFT settings
$out = '';

echo "Sending command...";
socket_write($socket, $in, strlen($in));
echo "OK.\n";

echo "Reading response:\n\n";
while ($out = socket_read($socket, 128, PHP_NORMAL_READ)) {
    echo $out;
}

echo "Closing socket...";
socket_close($socket);
echo "OK.\n\n";

When socket_read encounters carriage return or line feed, it returns the data received from the scale. By default, these characters are sent by the scale at the end of each line.

The PHP script produced the following output:

Defender 5000 weight requested with PHP

You can modify the output template through the menu of the scale or by using the Ohaus Scale Mate software, e.g. to send just the net weight and date/time:

Ohaus Defender 5000 custom template

You’ll find a list of commands supported by the scale in the user manual (chapter 5, “interface command”). Note that each command has to be followed by carriage return and line feed.

In the script, I used the “IP” (immediate print) command, which tells the scale to send the weight immediately (whether it is stable or not). This command is available on all recent Ohaus scales. One notable exception are legal-for-trade (LFT) models, which only support the P command (similar to pressing the print button) and in some cases the SP command (stable print, send weight as soon as it has stabilized).

Tip: The Ohaus Defender 5000 also supports many MT-SICS commands. This means that you could send commands such as “SI” (send immediately) and receive a reply in a standardized format which is independent of the template set in the scale:
MT-SICS response Ohaus Defender 5000

Please note that I’m not a PHP expert and that I don’t recommend using PHP. This article is only supposed to be a very basic demonstration. Other programming languages such a C#, Java, server-side JavaScript (node.js) or Python may be more suitable.


The header photo shows a Defender 5000 communication test case (a hard case with a built-in Defender 5000 indicator with all optional communication interfaces installed).