Making an electronic hive scale can be harder than you think
Hive scales for use by beekeepers are a niche market; moreover, they must meet a number of special requirements, such as:
Must withstand long-term outdoor use (protection against rain, moisture/dust, very low and high temperatures, possibly theft/vandalism, wild animals etc.).
Must weigh accurately under challenging conditions (temperature fluctuations, vibrations caused by wind).
Must support a heavy load over a long period of time while still registering small weight changes.
Must be able to transmit weight data (often over long distances).
Must have low power consumption (for off-grid installations).
It is therefore unsurprising that no major scale manufacturer offers a hive scale and that commercially available scales from specialized manufacturers can be quite expensive.
List of hive scales available in Europe
The following list contains all beehive scales available in Europe that we currently know of (both commercial and open source / DIY projects). Websites with descriptions in English and with recent updates were highlighted:
It is a compact device designed to be connected to scales and balances made by A&D via their RS-232 interface. It stores the weight and – if required – a sequential number and the date/time. After weighing, it is connected to a USB port on a computer (just like a flash drive) to access the data:
The CSV file created by the AD-1688 can be opened in applications such as Excel by simply double-clicking on it. The weight will appear as a number in its own column, ready for further processing.
Does the data logger work with scales from other manufacturers?
Sometimes, but it almost never works as well as with scales from A&D. In our tests, the following problems occurred.
Connectors and pinout
The data logger comes with suitable cables for (almost) all scales and balances made by A&D. On a DE9 connector (often erroneously called DB9), it uses pins 2 (RxD), 5 (GND) and 6 (DSR), though the latter is not strictly necessary. To connect to scales from other manufacturers, you may need adapters such as “gender changers” or null modem adapters, or you may need to make a special cable:
Please do not assume that the pinout is compatible just because the connector can be plugged in on your scale!
Possible damage
Some scales use pins of the RS-232 port for other purposes, e.g. for powering peripherals such as check weighing signal lights. These pins must not be connected to the AD-1688!
Power supply via the RS-232 interface
The AD-1688 gets its power from the scale it is connected to (or the USB port when connected to a computer). RS-232 voltage levels are clearly defined in the RS-232 standard. Nevertheless, the “RS-232” interface of some scales does not supply the voltage required to operate the AD-1688. On a Kern DE parcel scale, for example, the data logger did not turn on at all, even though the pinout matched:
Further analysis revealed that this scale did not contain an RS-232 transceiver and that logic one (“mark”) was sent as 0 V (instead of −15 to −3 V).
Interface parameters
The settings for baud rate, number of data bits and parity must match on the scale and on the data logger, otherwise the AD-1688 won’t be able to read the incoming data correctly.
When using the data logger with scales from A&D, you do not have to worry about this: Almost all A&D weighing instruments use 2400 bps, 7 data bits, parity “even”. This is also the default setting of the AD-1688.
For scales made by other manufacturers you will have to change the interface parameters either on the scale or on the data logger. The AD-1688 supports the following settings:
Bit rate: 600, 1200, 2400, 4800, 9600, 19200.
Data bits/parity: 7 even, 7 odd, 8 none.
Data format
The data logger expects all data to be sent as ASCII in A&D’s standard format:
First line: byte number; second line: ASCII character sent by an A&D balance; third line: hexadecimal value
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
S
T
,
+
0
0
4
5
6
.
8
9
g
CR
LF
53
54
2C
2B
30
30
34
35
36
2E
38
39
20
20
67
0D
0A
Only a very small number of scales made by other manufacturers support this exact format. If your scale sends data in a different format, two problems may occur:
Unless each line is terminated with carriage return and line feed, the AD-1688 won’t record it.
Even if this is the case, the numeric value of the weight will not be separated from the unit (and other characters sent by the scale).
You can generally solve the second issue by using the import wizard of your spreadsheet application. With Excel, the easiest way to open the file in the import wizard is to rename it from .CSV to .TXT.
Many scales send several line breaks after the weight (for the paper feed of a serial printer). This causes the data logger to create empty rows not containing any data. If you cannot modify the line feed configuration of your scale, you can instead increase the “Line” setting of the AD-1688 to combine several lines into one row.
This will result in empty columns (see example file above), which is much better than empty rows. However, the maximum is 7 lines. Beyond that, data will spill into the next row.
Decimal point or comma
The AD-1688 data logger cannot convert between a decimal point and comma. If you’re in a country which uses a decimal comma, this again means that you will have to use the import wizard of your spreadsheet app to correctly format the weight as a number.
Note: A&D scales let you choose whether the weight should be sent with a point or comma (e.g. “12.34″ or “12,34″) and therefore do not have this problem. You only have to ensure that the “dP” setting on the data logger matches the decimal separator used by your scale.
Transmission mode
Most scales have a “print” or “data” button to send a single weight reading to a connected device. However, this is not always the case. Some scales send the weight continuously with several values per second. This would quickly fill the memory of the AD-1688. You can mitigate this by using the “Rec” setting so that data is only stored at certain intervals, but this is far from ideal for most applications.
Other scales use bi-directional protocols (very common with point-of-sale scales):
Such scales can definitely not be used with the AD-1688 weighing data logger as it can only passively record incoming data. It is unable to send requests to the connected scale (see pinout above, there is no transmit pin).
Intended use according to A&D
Finally, the manual (PDF) clearly states that the AD-1688 is designed to be connected to “balances and scales with an RS-232C connector manufactured by A&D“. It was never intended to be used with weighing instruments made by other manufacturers. Given the many pitfalls described here, this is an understandable decision.
Conclusion
The trouble-free operation of the AD-1688 weighing data logger is only guaranteed with compatible scales from A&D.
On scales from other manufacturers, the AD-1688 may work, but there are many potential problems that can cost you a lot of time. Even in the best case, the resulting CSV file will often not be fully comma-separated due to differences in the data format and will require further processing.
If your scale is not made by A&D, consider connecting it to a PC for data acquisition. You can use our Simple Data Logger software, which is designed to work with scales from many different manufacturers.
Note: The information in this article is valid for firmware P1.10 of the AD-1688.
Links and further information about the AD-1688 weighing data logger
This guide applies to the new generation of Ohaus Defender 5000 scales (2018 or later).
It was created using BarTender 2019 R8 and version 1.05 of the Ohaus Defender 5000 firmware. It may not apply to future versions.
I’m not a BarTender expert, if you think that you have a better solution, please let me know in the comments.
BarTender communicates with a scale by requesting the weight and – if supported – the tare weight in short intervals (every 250 ms by default). The received data is then parsed using regular expressions.
Unfortunately, the “Ohaus” protocols defined in BarTender do not work with the default settings of the current Defender 5000 scales. They also don’t support requesting the tare weight. Therefore, we’ll use the MT-SICS protocol instead. As you’ll see below, this is a very straightforward solution. However, for a limited number of multi-interval Defender 5000 scales, we’ll need to modify the regular expressions used by BarTender.
Note for legal-for-trade applications (verified scales): If you’re planning to use the alibi memory (SD card) installed in the Defender 5000 indicator, please note that the solution proposed here does not create alibi records. To do so, you would have to use the Ohaus “P” (print) command instead of the MT-SICS command to request the weight. However, this would create an alibi entry every 250 ms, which is probably not what you want either. In my opinion, the communication method used by BarTender is not well suited for use with verified scales and alibi records.
Configuring your Ohaus Defender 5000 scale
Note: This guide assumes that you’ve already connected your scale to your PC. I used the standard RS-232 port found on all current Defender 5000 models. Using the optionally available USB or Bluetooth interface (SPP) would be almost identical.
Apparently, you do not need to change the configuration of the scale, as it already supports MT-SICS commands in its default “Demand” mode. However, if you want to explicitly set it to the MT-SICS protocol, press and hold the Menu button, then press 7 to enter the Communication menu, select the interface you’re using, press 2 for Setup and then change the Assignment from “Demand” to “SICS”:
The other settings on this screen should not matter, as they’re irrelevant for the selected protocol.
Configuring BarTender
Add Scale Wizard Step 1
Start Bartender Designer, select Administer>Weighing Scale Setup and Add Scale. This will launch the Add Scale Wizard. Click on Next.
As mentioned, simply selecting “Ohaus 5000 Series” (or any other Ohaus model) will not work with the current Defender 5000 scales. Instead, select Define a model not listed above and click on Next.
Add Scale Wizard Step 2
Select “Ohaus” as the manufacturer and enter a model name (e.g. “Defender 5000 SICS”).
If your scale is a single interval scale (which means that the readability does not change over the entire weighing range), select the “Mettler Toledo (MT-SICS Level 1)” protocol and click on Next. Then skip to step 3 of this guide far below.
If your scale is a multi-interval scale, things may get a bit more complicated. It all depends on the readability (aka “graduation”, “d” or “e”) of your scale. If it has the same number of decimal places over all intervals when using the default unit (kg), you can also go to step 3. If the number of decimal places is not the same, continue reading here.
Example:
Creating a new protocol
For multi-interval scales that don’t have a constant number of decimal places, we have to make a tiny change to the regular expressions defined in BarTender’s MT-SICS Level 1 protocol. Since we can’t modify existing protocols, click on New to create a new one.
Give the new protocol a name (e.g. “SICS”) and click on Copy existing Protocol.
Select “Mettler Toledo (MT-SICS Level 1)” and confirm with OK. All fields for the commands and response patterns should now be filled in.
In every single response pattern except for the last one, locate the following string:
\x20(?<Units>
Change it to:
\x20+(?<Units>
By adding a plus sign, the regular expression now matches strings which contain one or more spaces (\x20) in between the weight (or tare) value and the unit. This is necessary because some multi-interval Defender 5000 scales use two spaces after switching to the second interval:
Note how the second line contains two spaces after “22.25”. With the default regular expression defined in BarTender, this weight value (and all others in the same interval) would not be captured.
I don’t know if BarTender was too strict or if Ohaus was too lax in implementing the MT-SICS protocol. I believe it’s better if I don’t comment on this any further. According to the MT-SICS protocol documents I’ve reviewed, the weight should be right-aligned and separated from the unit with one space character. However, the descriptions of MT “DeltaRange” multi-interval balances mention that the last digit is replaced by a space when the number of decimal places changes:
Therefore, it seems that Ohaus did nothing wrong and the regular expression in BarTender did not account for this scenario.
Note: If you’re regularly dealing with regular expression, I highly recommend the wonderful RegexBuddy software.
Your user-defined protocol should now look like this: Click on OK.
Select the protocol we’ve just defined and click on Next.
Everything in this dialog should be correctly configured for the use of a serial port (RS-232, USB or Bluetooth SPP). Click on Next.
Add Scale Wizard Step 3
Welcome back, my lucky readers who did not have to deal with protocols and regular expressions. Change the name of the scale if you feel like it and then click on Next.
In this dialog, you must specify the COM port on your computer that is used to connect to your Ohaus Defender 5000 scale.
This is it! We’re done! Click on Finish, but don’t bring out the champagne just yet.
Testing your Ohaus Defender 5000 scale
Back in the Weighing Scale Setup, select the scale you’ve just added and click on Properties.
Click on Test Connection. If everything is correct, BarTender should show the Net Weight and Tare Weight received from your scale:
In that case, congratulations, you succeeded. You can now use the values from your scale in BarTender.
Should you not see any weight values, you’ll find some troubleshooting information below.
Troubleshooting a scale connection
Unfortunately, communication problems with scales can have many causes and are often difficult to solve. I can’t give you extensive troubleshooting instructions here, but I’ll tell you the same thing I also tell our software users: Download HTerm, a simple terminal program. Then try to communicate with your scale using HTerm instead of BarTender:
Change the following settings in HTerm:
COM port,
Baud to 9600,
Newline at to “CR+LF” (optional, looks nicer),
Send on enter to “CR-LF” (required).
Click on the Connect button at the top (shown as Disconnect in the screenshot as I had already clicked on it). Then type the “SI” (send immediately) command manually into the input field (lower red arrow) and press enter.
You should see the command you just sent under Transmitted data and the reply from the scale under Received Data (marked green on the screenshot).
If communication is successful with HTerm but not with BarTender, the problem is with BarTender. If you’ve changed the regular expression as described above, double-check that you’ve not made any mistakes. Contact Seagull Scientific for further support. Please don’t ask me for help in the comments.
If you can’t communicate with your Defender 5000 scale using HTerm, something is wrong with your setup. In my experience, the most likely culprits are:
Wrong COM port.
Wrong interface parameters (baud rate, etc.).
Wrong type of serial cable.
Please understand that I cannot diagnose these problems for you remotely. You may want to contact your Ohaus dealer or pay a specialist to help you.