Interface description (RS-232) for A&D FX-i and FZ-i precision balances

A&D’s FX-i and FZ-i precision balances are equipped with a serial interface (RS-232) and can be easily connected to a computer for data transfer (if necessary with a converter from RS-232 to USB or to Ethernet). You can, of course, also connect other devices such as a serial printer, a data logger or a secondary display.

I recently tested all communication modes and their various settings in order to update the product description in our German scales shop. Since this took me a lot of time, I also translated my findings into English for publication on this blog.

I found that all commonly used communication modes (a.k.a. transfer modes, transmission modes) are supported and that they can often be fine-tuned in a way rarely possible with other balances. Concerning the data format, the FX-i and FZ-i balances support not only A&D’s standard format, but also several other formats which might make these scales suitable as a drop-in replacement for older Mettler Toledo or Sartorius balances. However, the more recent SICS protocol was not implemented.

The balances support a number of commands for bidirectional communication. However, not all applications and settings are accessible via remote commands (for example, the limits for checkweighing cannot be set by a connected computer).

You can use any terminal software to test communication via the RS-232 interface (e.g. HTerm or PuTTY). For productive use, I recommend A&D’s free WinCT software or our Simple Data Logger software. The best integration can often be achieved by customizing your own software to communicate directly with the balance.

RS-232 interface and cable

FX-i and FZ-i balances have a built-in DE9M connector and require a straight (1:1) cable (not a null modem cable):
RS-232 interface on A&D FX-300i balance

Interface parameters

Default settings are highlighted in bold:

Baud rate: 600, 1200, 2400, 4800, 9600, 19200
Data bits: 7 bits or 8 bits
Parity: even, odd (for 7 data bits), none (for 8 data bits)
Stop bits: 1 bit
Data flow control (handshaking): none (RTS and CTS lines are connected internally but not used for actual flow control).

Data format

By default, the balances use the proven A&D format and transmit 17 ASCII characters for each weight value:

First line: number; second line: ASCII characters sent by the balance; third line: hexadecimal value
 1 2 3 4 5 6 7 8 91011121314151617
ST,+00456.89gCRLF
53542C2B30303435362E38392020670D0A

As far as I know, the very first scale from A&D with a data interface already used the same format. This is very impressive, particularly when other manufacturers sometimes change the data format between firmware updates or even between transmission modes.

As alternatives to the A&D format, 5 further data formats can be used. The user manual (PDF) contains a detailed description in chapter 10-6.

Communication modes

The corresponding setting in the menu of the balance is indicated in [square brackets].

  1. Key mode: The weight is transmitted when the PRINT button on the balance is pressed.
    • Mode A: Only when the weight is stable [dout / Prt 0].
    • Mode B: Immediate transmission (stable and unstable weight) [dout / Prt 4].
    • Mode C: The balance waits until the weight has stabilized and then transmits it [dout / Prt 5].
  2. Auto-print: The weight is automatically transmitted after stabilization.
    • Mode A: Return to zero is required before next transmission [dout / Prt 1]. You can set which range around zero counts as “zero” (10, 100 or 1000 digits) [dout / AP-b]. You can also specify whether only positive, negative or all values should be transmitted [dout /AP-P].
    • Mode B: No return to zero is required before the next transmission [dout / Prt 2]. You can set the required difference from the last stable value (10, 100 or 1000 digits) [dout / AP-b]. You can also specify whether lower, higher or all values should be transmitted (compared to the last stable value) [dout /AP-P].
  3. Stream mode: Continuous transmission of 5, 10 or 20 values/s [dout / Prt 3]. The frequency is determined by the display refresh rate [bASFnc / SPd]. This mode is not suitable if you connected a printer or hardware data logger to the balance, but it is required if you want to use an external display. Our data logger software can also easily handle this number of values per second.
  4. Interval mode: Transmission of a value every 2, 5, 10, 30 or 60 seconds or every 2, 5, or 10 minutes [dout / Prt 6].
  5. Command mode: The balance responds to commands received over the interface (bi-directional communication). Available in all modes, see commands below.

In mode 1, 2 and 4, the display blinks to signal that the weight has been transmitted.

Supported commands

“Q” is used to request the displayed weight immediately, while “S” is used to request the weight once it has stabilized. All commands must be terminated with carriage return and line feed:

No.: 1 2 3
ASCII:QCRLF
Hex:51OD0A

Complete list of commands (in alphabetical order):

?IDRequests the balance ID (can be set through the menu).
?PTRequests the tare value set by using the PT or T command (does not work for tare values set by using the RE-ZERO button on the scale)
?SNRequests the balance’s serial number.
?TNRequest the balance’s model name.
CCancels the S or SIR command (before completion).
CALSame as pressing the CAL button.
<ESC>PSame as the “S” command. <ESC> is the escape control character (1Bh).
<ESC>TSame as pressing the RE-ZERO button.
EXCCalibration using an external weight (only for FZ-i).
QRequests the weight data immediately.
OFFTurns the balance off.
ONTurns the balance on.
PSame as the ON:OFF button (“P” = power?).
PRTSame as pressing the PRINT key.
PTSets a tare value, PT:xxx.x g. The unit must be transmitted using A&D’s format (3 characters, right-justified, padded with spaces).
RSame as pressing the RE-ZERO key.
SRequest the stabilized weight. If the weight is currently not stable, the balance waits until it has stabilized. There seems to be no timeout (though the command can be cancelled with “C”).
SISame as “Q”.
SIRSwitch to stream mode (continuous transmission).
SMPSame as pressing the SAMPLE key
TTares the balance.
USame as pressing the MODE key.
ZSame as pressing the RE-ZERO key.

Other settings affecting RS-232 data transmission

You can set the balance to acknowledge valid commands with the ACK control character (06h) and to reply to invalid with “EC” and an error number [SiF / ErCd]. The manual contains detailed information and examples in chapter 16-2.

The terminator can be changed from carriage return and line feed (0Dh 0Ah) to carriage return (0Dh) [SiF / CrLf]. This affects both the output and the input (commands).

It’s also possible to change the decimal point to a comma [bASFnc / Pnt].

The balance can re-zero (tare) itself after sending the weight, which is useful during formulation [dout / Ar-d].

FZ-i balances are equipped with an internal clock and calendar and can output the time, date or time and date [bASFnc / dout / S-td]. According to the manual, this only works when outputting GLP data and not with individual weight values (I will test this later this week). This information can be added to the weight data [dout / S-td].

You can use the animal weighing application to calculate an average weight and automatically output it (as shown in this short video). Statistical calculation mode can output numbered individual weight values and summarized statistical data.

You’ll find further settings in a function table in the user manual (chapter 10).

Further information

Software Kern BalanceConnection: what’s new in 2019

Two versions of Kern’s BalanceConnection software are now available: the standard version (SCD-4.0) and the Pro version (SCD-4.0-PRO).

The following table shows the features of the standard version on the left and the additional features of the Pro version on the right (according to Kern’s 2019 catalog):

BalanceConnection SCD-4.0BalanceConnection SCD-4.0-PRO
· For operating systems Windows XP, Vista, 7,
8, 8.1, 10
· Supports balances measuring devices with
RS 232, RS 485, Bluetooth, LAN or WLAN
network (TCP/UDP/IP)
· Highly flexible formatting of the output (any
order, formatting and rounding), particularly
recording of date and time for every value
transferred, if required
· Any number of devices/interfaces can be
connected, as well as simultaneous and
synchronised recording of several balances
· Key-activated or time-controlled interro-
gation of measurements or trigger of device
functions, also for continuous recording
· The interface protocols for KERN balances are
already predefined (standard configuration)
· Compatible interface cable included when
you order a KERN balance at the same time
· Many different transfer and recording
options:
– Microsoft ® Excel/Access/Word in the
fore ground or background
– Other Windows applications (through key
simulation), e.g. shipping software or ERP
system (SAP, Sage, etc.)
– File recording (e.g. as text or CSV file)
– Print out on text or label printer
– Screen output such as large display, line
chart (drying curve for moisture analyzer),
histogram, etc.
· ODBC/SQL databases such as SQL Server
or MySQL
· Transfer to HTTP Webservices/Web forms
· Histogram
· Enables the connection of medical balances
to practice EDP systems using the device
data transfer protocol (GDT) and also the
HL7 protocol
· Implementation of programs/scrips using
freely-definable command lines
· Command sequences
· Defining the conditions for specific events
and the reaction to these events
· Filter for stability recognition (configurable
value storage)
· Central configuration repository, e.g. on the
network
· On-screen displays with configurable user
interface for flexible balance operation

If you do not need the features listed on the right, the standard version is the right choice. However, this version has also become a bit more expensive compared to the single version available so far.

Inexpensive alternatives

If you don’t need the extensive functionality of BalanceConnection and only want to connect a single scale to your PC, we offer two very inexpensive alternatives. Each of these programs has a single purpose and is therefore easy to set up and use:

  • 232key: Transfers the weight to any application (e.g. Excel, shipping software, etc.) using a key simulation (virtual keyboard wedge).
  • Simple Data Logger: Stores the weight in a CSV file (if desired with date and time), the weight can also be retrieved from the scale using a timer (Plus version only).

Further information

Raspberry Pi: Connecting a scale can be very easy…

…as long as you choose the right scale! The photo below shows an A&D EK-2000i compact balance connected to a Raspberry Pi 3 Model B using a compatible serial cable and an FTDI RS-232 to USB converter:
Scale connected to Raspberry Pi

Python and pySerial make it easy to read weight data from a scale

On the Pi, I used Python with pySerial to read the weight from the scale. The script I put together is trivially simple. You can download it here or just type it on the Pi:
Script to read weight sent from A&D scale

By pressing the PRINT-Button on the scale, I then sent a few weight values to the Pi and the script wrote them to the terminal (b’ is added by Python):
Weight printed to terminal

In a more useful application, you would want to parse the data sent from the scale to get the weight as a number and then do something with it (maybe write it to a database). You could also do interesting things with the GPIO on the Pi like sounding an alarm when a certain weight is exceeded (though a microcontroller might be better suited for this).

I then switched the scale to “stream mode” (continuous transmission) where it sent 10 values per second (stable or not). The output you see below is the result of placing a single object on the scale and waiting for it to stabilize:
Weight data in continuous mode

I hope this example shows that it can be really easy to transfer the weight from a scale to a Raspberry Pi.

Notes on scales and the Raspberry Pi

One advantage of A&D scales is that (almost) all of them use the same data format and interface parameters and that you’ll find a good description in the manual:
A&D EK-i balance data format

However, you could use also use scales made by other manufacturers as long as they come with an RS-232 interface and the ability to send the weight in ASCII format. Available data output modes vary, so please read the product description carefully before buying.

A converter like the one I used is already built into some scales, which means that you can directly connect them to the Raspberry Pi via USB (you won’t need a serial cable). You’ll find many Ohaus scales with this interface option and the ones I’ve tested worked fine. However, cheaper scales with a USB interface can often not be used with pySerial as they do not emulate a serial port. They can also present other challenges (e.g. data that is not transmitted in human-readable ASCII format).

You do of course not have to use Python, just make sure that your preferred programming language can communicate over a serial port on the Pi. The book Raspberry Pi with Java: Programming the Internet of Things (IoT) contains projects using Ohaus scales and, well, Java.

Finally, please don’t try to use the serial interface already provided by the Pi on the GPIO pins without a logic level converter (RS-232 voltage could reach up to 15V). Excellent further information on serial ports on the Raspberry Pi can be found here.