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:

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.

Record the weight from a scale or balance to a file – Simple Data Logger software

Connecting your scale to a PC and recording the weight should not be a difficult task. However, data logging software available from scale manufacturers is often expensive, difficult to use or not very reliable. This is why I started developing Simple Data Logger a few months ago.

Simple Data Logger (SDL) writes the weight received from a scale or balance to a file, optionally adding date and time. The CSV files generated by SDL can easily be opened in Excel and other spreadsheet applications for further processing and visualization.

Recording the weight from a precision balance using Simple Data Logger

SDL currently supports the following connections:

  • COM port: RS-232, USB, Bluetooth SPP, etc.
  • Ethernet: Raw TCP format.

Note: Your scale has to send data in ASCII format.

Simple data logger is currently still under development. However, it has proven to be reliable in numerous tests and can also cope with high data rates (e.g. 80 values/s) and very large files.

Get started recording weight values with Simple Data Logger

Connect your scale to your computer, download and install SDL, then follow these steps to configure the software:

  1. Device tab: Device tab in Simple Data LoggerIf your scale or balance is listed in SDL, simply select it and press the set default parameters for device button. Otherwise, select “generic measuring instrument” and enter the interface parameters manually.Set the radio button to match your connection: COM port (RS232, USB VCP, Bluetooth SPP) or TCP/IP.Make sure that you’ve specified a terminator (a.k.a. delimiter, the last character your scale sends in each line of data) or a timeout (e.g. 100ms, SDL will process received data if no additional data is received during this time).
  2. File tab:File tab in Simple Data LoggerChoose a file for the recorded data. SDL will create if for you if it does not exist (otherwise, data will be appended).Choose (or enter) a date and time format or select “None” from the list if you do not want SDL to add the date or time. Pick a decimal separator (for numeric values) and value separator (used to separate values from each other). Common settings are “Dot” as the decimal separator and “Comma” as the value separator (e.g. in the USA) or “Comma” as the decimal separator and “Semicolon” as the value separator (e.g in Germany).
  3. Start tab:Start tab in Simple Data LoggerPress the start button to start recording data. It will be shown in the event log and will be written to the chosen file. Press stop to stop data logging and close the file.

Process the weight values in Excel (or other spreadsheet applications)

Provided that you’ve made the right settings in the File tab, you can easily open the CSV file in Excel (or other spreadsheet applications like Google Docs, OpenOffice/LibreOffice Calc). The weight will be recognized as a number, allowing you to make further calculations (i.e. calculating the total weight as shown below):

CSV file with weight alues opened in Excel for processing

Links and further information

200 years of legal metrology in Luxembourg

Did you know that Luxembourg’s law of August 21st 1816 made the metric system obligatory for all commercial transactions? I didn’t, until I was invited to the 200 year celebration “Bicentenaire de la Métrologie Légale”, which took place in Belval yesterday. The most prominent speaker, Luxembourg’s Deputy Prime Minister and Minister of the Economy Étienne Schneider, took this opportunity to announce that Luxembourg has decided to acquire an atomic clock.

Deputy Prime Minister and Minister of the Economy Étienne Schneider

Deputy Prime Minister and Minister of the Economy Étienne Schneider

Other speakers included ILNAS director Jean-Marie Reiff, BLM director Philippe Kadok, Professor Olivier Francis from the University of Luxembourg and Dr. Martin Milton, director of the BIPM. Mr. Kadok’s presentation contained a slide a few interesting facts about the Service de Métrologie Légale: In 2015, this relatively small sub-organization of the BLM verified 2861 petrol pumps and more than 1450 weighing instruments of all types throughout the country.

BLM director Philippe Kadok

BLM director Philippe Kadok

Several organizations with ties to the field of metrology had set up stands in the conference hall. The Service de Métrologie Légale’s stand showcased balances, weights and other measurement instruments. Sadly, recently retired director John Kirchen was nowhere to be seen.

Service de Métrologie Légale

Service de Métrologie Légale

A&D EK-610i balance used for density determination

A&D EK-610i balance used for density determination

Visitors were also invited to take a tour of ILNAS’ recently inaugurated EMC lab (used only for market surveillance purposes, not for product certification).

 

 

Ohaus Scout STX – a touchscreen scale done right

The first scale with a touchscreen display that I ever used took a while to start up, reacted sluggishly and – if I remember this correctly – required me to set up a user account before it would let me actually use it. That was a few years ago, but still, I was a bit skeptical when Ohaus announced that the newest model in their legendary Scout series would now have a touchscreen, too. However, after purchasing the cheapest Scout STX (the STX 421) and testing it extensively over several weeks, I can say that my worries were unfounded.

Startup time

As you can see in this short video, the Scout STX is even faster than the Ohaus Ranger 3000:

Settings

How many scales can truly claim to be so easy to set up that you never have to look at the manual? As an example, here’s how you change the language: Touch “Menu”, then you’ll see 8 settings, of which “Balance Setup” looks the most promising. You’ll now see another seven settings with “Language” being the first one:

Should you ever find yourself somewhere you didn’t want to go, you can simply touch “Back” to go back to the previous screen.

Somewhat embarrassingly, the only thing I actually had to look up was how to change into another application mode: Instead of going through the menu, you simply touch the application name shown in the top left corner of the screen. I’m just not used to things being so intuitive.

9 applications

The touchscreen really shines when it comes to different applications. As you can see in this video of me using the parts counting mode with auto-optimization, the STX can even replace a dedicated counting scale:

12 seconds into the video, the scale displays an entire number block to let me enter the average piece weight or number of samples. There’s simply no way to achieve this kind of application flexibility and user friendliness without a touchscreen.

Touchscreen disadvantages

One common complaint about touchscreens is the lack of tactile feedback. Fortunately, the most frequently used buttons on any scale, ON/OFF/Zero and Tare, were still kept as physical buttons on the Ohaus Scout STX.

You also have to consider that the fairly large screen needs a lot of power. The Scout STX can be used with four AA batteries, but those won’t last more than a few hours (6 according to Ohaus). It’s certainly a good idea to use the included power adapter whenever possible.

Links and further information

Using your smartphone as a scale?

So far, apps which claim to transform a smartphone into a weighing scale generally fall into one of two categories:

  • Simulators: They pretend to be a scale, but simply show a previously entered weight. Might be good for dealers wanting to rip off gullible customers, but certainly not much else.
  • Creative sensor use: Some apps try to make use of existing sensors in order to calculate the weight of an object. This could mean balancing your phone on a bag filled with air and placing an object on it while the app measures the inclination. Another app requires putting your smartphone on top of the object you want to weigh and then dropping both on a cushion. Of course, you’d also have to repeat the procedure with reference weight. Obviously, this is not exactly user friendly. While I haven’t tried any of the apps myself, they mostly received one star reviews. Unlike the simulators, which at least do what they pretend to be doing, it doesn’t look like these apps work well enough to be even remotely useful.

Therefore, I was surprised when I saw the following video featuring Peach-O-Meter, an application which compares the weight of two peaches:

Weighing Plums on an iPhone

It’s easy to use and seem to be working better than anything available so far. This became possible thanks to 3D Touch, a feature on the new iPhone 6s. A new layer of capacitative sensors registers how hard you press on the pliable glass:

Pressing down onto the glass bends the glass very slightly at the point of contact, shortening the distance between your finger and the corresponding capacitor plate in the array beneath the display.

Putting peaches on your screen is probably not what Apple had in mind when they introduced 3D Touch as “a new way of interacting”. Originally, the program author had planned to use grapes, but discovered that the iPhone ignored them. He’s announced that he’s purchased calibrations weights and is planning to run further tests. There’s also at least one company which is trying to develop a professional app (with “calibration cubes”).

I’m looking forward to seeing where this leads, thought I’m skeptical concerning the usefulness of such an app. Want to weigh lightweight “objects” while you’re on the move? I’m sure you’d get much better results from an inexpensive pocket scale. Using your top-of-the line device in the kitchen has its own perils and reminds me of this sketch from a German comedy show:

iPad Chopping Board (English Subtitles)

 

Free software for scales and balances with RS-232 and USB

Are you still manually entering weight readings from your scale or balance on your PC? Is your scale equipped with a RS-232 or USB (virtual COM port) interface? If yes, you can eliminate manual data entry by connecting your scale to your computer and using our free software 232key.

232key automatically types the weight into any application

Our software runs in the background, listens to the COM port (serial port) your scale is connected to and waits for measurement values sent by the scale. Those values are then filtered, formatted and typed into the application running in the foreground at the current cursor position as simulated keystrokes. This means that 232key can be used to transfer the weight (or other measurement values) into any application that accepts keyboard inputs, e.g. Microsoft Excel, OpenOffice / LibreOffice Calc, Google Docs, a form on a website, etc.

In the following example, I used A&D’s FG-60KBM scale with an optional RS-232 interface (FG-OP-23). I connected it to my laptop with A&D’s serial cable (AX-PC09-SCA) and an inexpensive converter to USB (as my laptop doesn’t have a serial port). Upon pressing the “PRINT” key on the scale, the weight was typed directly into an input field on a website:
Transferring the weight from a scale to a website

Compatibility with scales and balances

To use 232key, you’ll need a scale with a RS-232 interface (aka. serial port, COM port, EIA-232) or an interface which appears as a (virtual) COM port when the scale is connected to your PC. This is the case for many (but not all) scales with a USB interface and for scales which support the Bluetooth Serial Port Profile.

Your scale or balance also has to send the weight in ASCII format. The weight has to be the first numeric value sent* and it should only be sent once (after you’ve pressed a key on the scale), not continuously.

The vast majority of scales and balances available on the market today fulfills these requirements. Just to give you a few examples, you should be able to use 232key with most or all scales and balances made by A&D (RS-232 only), Adam Equipment (RS-232 and USB), Ohaus** (RS-232 and USB), Kern**, MyWeigh (RS-232 only) and other well-known brands. New device profiles are constantly added!

Finally, an easy way to transfer data from your scale to your PC

We designed 232key to make your life easier. No complicated configuration is required. If your scale manufacturer or model is included in the list of predefined devices, you don’t even have to manually enter the interface parameters: Simply select your scale and click on “Default” to load the settings.
Interface settings

Not sure which COM port you scale is connected to? Press the “Auto” button and 232key will try to detect the port automatically (works with all devices which have some sort of hardware handshaking functionality, e.g. scales and balances made by A&D and MyWeigh’s popular HD series).

Do you know which decimal separator (point or comma) your scale is using? Why should you! 232key understands both input formats and lets you choose which output format you want.
Decimal separator

Would you like 232key to press an additional key after typing the weight, e.g. the “Enter” key to jump to the next row in a spreadsheet? No problem, simply specify the desired key in the “Format” tab.
Additional key

All of these useful and user-friendly features are available for free! Additional functionality is available in the paid “Plus” version of 232key.

Download and documentation

Please visit our product website 232key for further information and to download our free software. Should you have any questions or suggestions, please don’t hesitate to post them in our support section or as a comment below.


* We’ve added an exception to this rule for scales and balances made by Adam Equipment.
** Affiliate links.

Update May 2018: Write the weight to a file

232key is a great solution for sending the weight from your scale to an application running on your PC (as simulated keystrokes). In some cases, however, it makes more sense to record the weight to a file which is later opened in Excel (or other applications).

This is particularly true for unattended data logging applications running over long periods of time. Another example are applications with high data rates (several weight values per second) which would overwhelm a virtual keyboard wedge like 232key.

For these use cases, we’ve recently released Simple Data Logger, an easy to use solution for recording the weight sent from your scale to a CSV file. You can read more about it on this blog or on www.smartlux.com/sdl.

Easily weigh aquatic animals using submersible scales

Regularly recording an animal’s weight is essential for keeping track of its health. However, weighing can be a traumatic experience particularly for aquatic and semi-aquatic animals as they have to be removed from the water where they spend all or most of their life.

Fortunately, several weighing instrument manufacturers have addressed this issue with new submersible scales. One such scale is the Ohaus Valor 2000W, shown below being partially submerged to facilitate the weighing of one of our company’s turtles:

Weighing a turtle on a semi-submerged scale

Turtle “Alpha” basking on top of the scale.

Thanks to it’s unique “flow-thru design which channels fluids that may enter the housing through strategically located drain holes”, this scale immediately sinks to the bottom of the aquarium while remaining fully operational. All that’s left to do is to wait until the animal takes a rest on the weighing pan and record the weight. There’s no better way to weigh aquatic reptiles, fish and marine mammals!

Available in capacities from 1.5kg to 15kg, Ohaus’ Valor 2000 can be found here.

How accurate are smart scales?

Are smart scales accurate weighing instruments or just simple bathroom scales with expensive connectivity features? To find out, I tested the Withings WS-30, Fitbit Aria and A&D UC-324NFC using class M1 weights.

Preparation

Each of the scales had not been used before and was configured as instructed by the manufacturer. This included signing up for an account with Withings and Fitbit. In the case of A&D’s UC-324NFC, I took advantage of a function available in the Wellness Connected  app which let me “calibrate” the scale by entering the local gravitational acceleration.

The scales were tested under similar conditions with a stable temperature of around 22°C and were placed on a flat, hard surface. The Withings and Fitbit scales were left alone for a night after the initial configuration as I wasn’t quite sure how they determine the zero value: unlike older electronic scales, you don’t have to switch them on and wait for them to show ‘zero’, instead, you step right on (the UC-324NFC determines the zero point after you step off).

Test procedure

I used 20kg weights to test the scales at 40, 60, 80, 100 and 120 kg. This procedure was repeated 3 times for each scale (I did a lot of weight lifting that day).

Results

The first column gives you the nominal weight (in kg) and the next three are the values as shown by the scales.

Withings WS-30

40 40.2 40.2 40.2
60 60.3 60.3 60.3
80 80.4 80.3 80.3
100 100.3 100.4 100.4
120 120.4 120.4 120.4

Fitbit Aria

40 40.2 40.2 40.1
60 60.2 60.2 60.2
80 80.2 80.2 80.2
100 100.3 100.3 100.3
120 120.3 120.3 120.4

A&D UC-324NFC

40 39.95 39.95 39.95
60 60.00 59.95 60.00
80 80.00 80.00 79.95
100 100.00 100.00 100.00
120 120.00 120.00 120.00

As you can see, A&D’s UC-324NFC was the most accurate scale, never deviating by more than 50g from the true value. Its 50g resolution and gravity compensation function certainly paid off.

However, the Fibit and Withings scales did a great job, too. Looking at the measurement results in each row, you’ll see that they are either identical or off by just one scale interval (100g). We can therefore say that these scales were slightly less accurate, but still very precise* (or that their repeatability was still excellent). As far as your body weight is concerned, you’ll generally be less interested in absolute values and more in tracking changes (“am I loosing or gaining weight”) and these scales would be perfectly suitable for this purpose. Nevertheless, I was a bit surprised that Fitbit and Withings didn’t use the location I had entered during account creation to adjust the scale for the local gravity acceleration. This would most likely have improved their accuracy.

Overall, the results are very good. As far as I can tell from this test, you’re not just paying for the “smart” features, you get accurate scales, too.

Further information / where to buy:

Disclosure:

  • Some links above are affiliate links.
  • My company used to sell A&D’s UC-324NFC in our German scales shop, but we don’t anymore. The Withings WS-30 and Fitbit Aria were purchased at retail prices, A&D’s UC-324NFC was purchased with a dealer discount.

*Meaning of accuracy and precision (as used in this article):
Accuracy and precision explained


RS-232 troubleshooting: fake chips

RS-232 is still the most popular interface for balances and scales. It is often described as “simple”, however, when things don’t work as expected, finding the cause can be difficult.

This article does not aim to be a comprehensive RS-232 troubleshooting guide (for this purpose, please refer to this PDF document from Agilent Technologies or the troubleshooting section on our 232key website). Instead, it is supposed to raise awareness of an issue that is often ignored: counterfeit ICs.

When you’ve tried everything and still can’t reliably communicate with your scale via RS-232, there’s a chance a fake chip may be the cause.

Just a few weeks ago, the thought of encountering counterfeit ICs in digital scales had not crossed my mind. Thanks to FTDI’s recent attempt to “brick” counterfeits via Windows Update, fake chips are now a hot topic on the web. While I don’t agree with the way FTDI tried to punish the end user, I wish the controversy had occurred a few weeks earlier. This would have saved me a lot of time.

Back then I was doing the final QC for several scales which were about to be shipped to a customer. The last item on my checklist was “bidirectional communication using RS-232”, something I had done many times before with this exact model. What should have taken a few minutes ended up taking me several days and nearly drove me crazy because the problems I encountered were difficult to replicate. Eventually, I arrived at the conclusion that something was very wrong with the MAX232CPE+ chips, which are responsible for converting TTL signals to RS-232 levels. After doing some research on the internet*, I started to suspect those chips were counterfeit. It seemed like a far-fetched idea** at the time, but I still desoldered them, took a few pictures and sent them to Maxim Integrated.

Fake MAX232CPE+ and MAX232EPE+

Counterfeit MAX232CPE+

Fake, fake and fake.

Thankfully, I received a reply in less than two hours:

“Yes these parts are counterfeit, they do not match markings of lots we manufactured.”

Now extremely suspicious of all MAX232s***, I disassembled a few more scales from 4 different suppliers. 3 contained ICs belonging to the MAX232 family, so I sent the pictures to Maxim Integrated, too. In addition to the chips used by the scale manufacturer which had prompted me to start this investigation, one chip used by another manufacturer was also flagged as counterfeit.

Counterfeit MAX232EPE+

Counterfeit MAX232EPE+

To be fair, my sample size is too small to draw meaningful conclusions regarding the entire weighing industry. However, if you’re in the business of making weighing instruments and were blissfully unaware of this issue, I hope this article serves as a wake-up call.


* I found documents like this one (16 MB PDF presentation by SMT Corporation) or this one (100 KB PDF, University of Conneticut), this article by Maxim Integrated and even videos of YouTubers walking through huge electronic component malls in Shenzhen where almost everything is counterfeit.

** Though not quite as far-fetched as the manufacturer’s idea that “static build up from the polystyrene packaging in road transportation” was to blame.

*** And also seriously angry at having wasted so much time doing something the manufacturer should have done. I won’t do any naming and shaming here, though.


Update October 3, 2017: Several articles concerning this issue have appeared since I originally wrote this blog post.