How to capture only the end result from a Mettler Toledo H53 Moisture Analyzer with 232key

Real-life example: Moisture Analyzer

One of customers wanted to capture the end result from his Mettler Toledo H53 moisture analyzer using our 232key software. However, the moisture analyzer sent a lot of data at the end of the moisture determination process:

14:08:42 Port opened: COM3 Bitrate: 9600 Data bits: 8 Stop bits: 1 Parity: NONE
...
14:08:45 -MOISTURE DETERMINATION-<13><10>
14:08:45 METTLER TOLEDO<13><10>
14:08:45 Type             HE53/01<13><10>
14:08:45 SNR           B123456789<13><10>
14:08:45 SW                  1.13<13><10>
14:08:45 <13><10>
14:08:45 Drying Prog.       Rapid<13><10>
14:08:45 Drying Temp.      130 <29>C<13><10>
14:08:45 Switch-Off          Auto<13><10>
14:08:45 Display mode         %AM<13><10>
14:08:45 <13><10>
14:08:45 Start Weight   0.637 g  <13><10>
14:08:45 <13><10>
14:08:45 Total Time      4:20 min<13><10>
14:08:45 Dry Weight     0.604 g  <13><10>
14:08:45 End Result      5.46 %AM<13><10>
14:08:45 <13><10>
14:08:45 Date: ..............<13><10>
14:08:45 Time: ..............<13><10>
14:08:45 <13><10>
14:08:45 Comment: ...............<13><10>
14:08:45 Signature: .............<13><10>
14:08:45 --------- END ----------<13><10>
14:08:45 <13><10>
14:08:45 <13><10>
14:08:45 <13><10>

Our customer was only interested in the end result (5.46 in the example above), but 232key captured and typed all the numbers it could find, resulting in the following output:

531234567891.131300.63740.6045.46

Regular Expressions to the rescue

Our software includes a powerful tool for such cases: regular expressions. Don’t worry, you don’t have to learn about them in detail. You can simply send us the data received from your device as displayed in the Event Log of our software (as shown above) and we’ll assist you. However, in some cases, all it takes is a small modification.

If you go to the Input tab in 232key and click on the Customize button, the currently used regular expression will be displayed:

Regular Expression in 232key MU

For the “Generic measuring device” and many other device profile, it looks as follows:

([-+]?\s*[0-9]*[\.,]?[0-9]+)

This regular expression captures the first number it encounters in each line of data. If you want to capture only the data of a specific line and ignore all others, look at what makes it unique. In this case, we could use the words “End Result”. Simply inserting them at the beginning, followed by “\s+” (which stands for “one ore more whitespace characters”) ensures that 232key only captures the number following these words:

End Result\s+([-+]?\s*[0-9]*[\.,]?[0-9]+)

That’s all it takes in this case. Alternatively, we could use the “%” character appearing at the end of the “End Result” line. As there’s no other line in the report where a number is followed by a percentage sign, the following regular expression also works (and will continue to work even if the user changes the language of the report):

([-+]?\s*[0-9]*[\.,]?[0-9]+)\s+%

Regular expressions are available in 232key Plus, 232key MU, 232key Pro and our Simple Data Logger software.

232key version 2018.1.4 released – includes flow control support and new profiles for Mettler Toledo and Sartorius balances

Version 2018.1.4 of our virtual keyboard wedge software for devices with RS-232 interface is now available and includes the following new features:

  • Flow control (handshaking) functionality (XON/XOFF software flow control and RTS/CTS hardware flow control):
    Flow control (handshaking): RTS/CTS and XON/XOFF
  • Device profiles: Mettler Toledo (MT-SICS), Sartorius (SBI), Sartorius (SICS), Denver Instrument.
  • Previous “Sartorius” device profile renamed to “Sartorius (legacy)” and modified to set flow control to “RTS/CTS” automatically. This profile works with older Sartorius balances which require hardware flow control.

These improvements were possible thanks to the feedback from our customers.