How to Find Glass DRO Scale Pin Functions

The prices of generic Chinese Glass DRO scales have come down over the last few years, putting them well within the reach of even the most budget-conscious machine shops. With careful shopping, a set of three scales for a mid-sized milling machine can be found for around $250 (USD). Even the most inexpensive Chinese glass DRO scales offer excellent quality, accuracy and reliability, making them a perfect choice for a DIY DRO setup. Unfortunately, as is often the case with goods purchased from China, product documentation and after-sales support is poor or non-existent. This can be especially problematic when the scales are purchased for use with TouchDRO setup instead of in a bundle with the manufacturer's DRO display unit.

Virtually all modern Chinese DRO scales use the same 5V supply voltage, output format and 9-pin D-Sub (AKA DB9) male connector, but the pinout is not standardized. On one hand, this means that for all intents and purposes these scales are interchangeable. On the other hand, if you ever need to connect a scale to a display unit from a different supplier, you will need to figure out what the pinout of the new scale is and move some lines around. Unfortunately, quite often the sellers are unwilling or unable to provide accurate documentation for their scales. Luckily, reverse-engineering the pinout of Glass DRO scales is pretty easy since they all use similar circuits with only minor variations.

Two Chinese DRO Scales that were purchased 2 years apart. Despite different branding the internals are virtually identical.

What Not to Do

When you receive your DRO scales, you might be tempted to plug them in and see the numbers change on the screen. This is not a good idea. Unless you are sure that the wiring scheme is compatible, there is a chance that you will permanently damage the scales. The circuit in some of the cheaper scales is pretty basic and lacks any sort of reverse voltage protection or current limiting. If you get unlucky and the power pins are reversed, you can accidentally let out the "magic smoke".

Second, as mentioned earlier, brands are mostly meaningless when it comes to Chinese DRO glass scales. Many Chinese distributors buy batches of scales from the lowest bidder and simply stick their own logo on them. Once the batch is sold, they might get the next one from a completely different supplier. Consequently, you might find a wiring diagram for the scales of the same brand that is completely different from yours.

Finally, there is no standard color-coding. While you might be tempted to think that Red is +5V and Balck is 0V, this is very often not the case, and the color-coding is completely random. For instance, the scales pictured above had almost identical internal electronics but the wiring was different: one used Red, White, Yellow and Black wires for +5V, 0V, A and B respectively; the other used Red, Black, Blue, Green, Yellow for +5V, 0V, A, B, and R.

A Bit of Theory

Most generic DRO scales on the market are simple linear optical encoders that output a 5V quadrature signal. The output consists of two square waves that are offset by 90 degrees. As the scale moves forward or back, the offset is either positive or negative, which allows the DRO to determine the direction of the travel and either increment or decrement the counter.

Customarily, these two output lines are labeled "A" and "B". In addition, some scales might have a "reference" output labeled "Z" or "R" that has a longer cycle and can be used for a basic error correction. Scales that have just A, B, and Z/R outputs are called "Single Ended". Often in the documentation for such scales, you might see the term "TTL". Although it's not strictly correct, this usually implies that the scales have 5V single-ended output.

For shorter cable runs, a single-ended signal is very reliable, but as the cable length increases, the signal integrity slowly degrades. Therefore, some of the more expensive Chinese DRO glass scales use a differential signal to negate the effect of line noise. For each of the signal lines (A, B, and R/Z) they include a line that sends an inverted signal. For instance, when A is high, A' is low, and vice versa. The DRO inverts A' and adds it to A; since the noise is also inverted, the spike is canceled out. Scales that offer differential output often include terms like "RS422" or "TIA/EIA-422" or even "TTL Differential".

Reverse Engineering Pin Functions

You might encounter three different scale wiring configurations:

The steps needed to reverse engineer the pin functions will differ slightly, depending on the type of your scales. Fortunately, all common Chinese DRO scales use variations of the same circuit based on the common LM339 quad comparator. The better single-ended scales use a slightly more sophisticated version that includes a dozen or so of extra components; the sub $100 scales use a very basic circuit that includes a through-hole version of the comparator, two potentiometers, and one or two capacitors. Finally, the differential scales use two comparator chips.

Required Tools

To identify the pin functions, you will need a basic multimeter that can test voltage and resistance or continuity. Additionally, you will need a way to provide a 5V power supply. If you intend to use a TouchDRO Adapter, it can be used to provide clean 5V supply. Otherwise, you can improvise something by using an old phone charger and cutting off the USB plug.

Step 1 - Gain Access to The Circuit

First, take apart the DB9 connector to gain access to the wires. Chances are, individual contacts might be covered with small pieces of shrink tubing; in most cases, you can just slide them off..

Insulation on glass DRO scale connector pulled back to expose leads
Shrink tubing pulled back to expose the contacts

Second, take the small metal cover off the scale's reading head. It's held in place by two small Phillips screws. The cover will likely be somewhat stuck to the case, so you will need to use a small flat screwdriver to pry it off. Inside, you will see a circuit that looks similar to the pictures below.

Easson, Ditron Glass DRO scales use almost identical circuit
Easson, Jino, and Ditron scales's electronics are based on LM339 IC

The relatively large black component is the LM339 comparator IC. It can come in two flavors (packages) - the larger "through-hole" and smaller "surface-mount". The pinout is identical, so the difference is only how you find the first pin. On the through-hole package, there is a small tab on the one of the shorter edges; on the surface-mount package, there might be a small dot in one of the corners, or one of the long edges might have a pronounced bevel. All three indicate the position of the first pin:

Step 2 - Identify The Power Supply Pins

This step will be identical for all three types of DRO scales:

  1. Switch your multimeter to the "Resistance" mode or, if available, "Continuity" (A.K.A. "Beep") mode.
  2. Counting from the top of the IC on the left side, find the third pin. This is a positive supply for the comparator, also called "Vcc"..
  3. Place one of the multimeter leads on that pin and probe continuity between it and the wires connected to the DB9 connector.
  4. You will notice that one wire will get you a reading on the order of 10-20Ohms, while the others will be on the order of KiloOhms. Mark this wire as +5V.
  5. The pin that is directly opposite the Vcc is the comparator's Ground pin (third from the top on the right side). Repeat the steps above and mark the wire with the lowest resistance as "Ground"
Internal circuit board of a Glass DRO scales with multimeter lead
Third pin on the right is connected to the ground

If your scales have only four wires (plus braided shield), you are done. The other two wires are lines A and B. For most DRO units, it doesn't matter which is which since you can reverse the direction of reading in the settings.

Step 3 - Power Up The Scale

To identify the pulse lines, you will need to power up the scale. If you're using the TouchDRO adapter, you can start assembling one of the provided DB9 pigtail cables such that the red lead is connected to the pin you marked +5V and the black lead to the pin you marked ground. Once done, plug the molex connector into one of the axis inputs of the TouchDRO adapter and power up the board.

For more information on how to put together and connect the pigtail connector assembly please refer to the instructions page for your version of the TouchDRO Scale Adapter.

Glass DRO scale connected to the TouchDRO DIY DRO adapeter
TouchDRO can be used to power the scale

From this point the steps will differ, depending on whether or not you have differential scales.

Step 4 - Identify the Pulse Lines

Single-Ended Scales

Let's start with the simpler case or single-ended scales. At this point, you will have three wires that are not marked. As you might recall from the above, two will be lines A and B, and one will be the reference signal. There are two possibilities here:

  1. Switch your multimeter to "Voltage" mode.
  2. Connect the black (negative) lead to the scales "Ground" line. If using a TouchDRO adapter, you can insert the lead into one of the PCB mounting holes since they are connected to the ground.
  3. Connect the red (positive) lead to one of the unidentified lines. You should see voltage reading close to 5V or 0V, depending on the position of the reading head.
  4. Going forward we will refer to a value that is close to 5V as "high" and a value that is close to 0V as "low".
  5. Carefully tap the reading head to move it lenght-vise until the voltage changes from low to high or vice versa.
  6. Note how much you had to move the head.
  7. Repeat steps 4 and 6 for the other two lines.

You will notice that out of the three lines, one needed to be moved much farther than the other two for the voltage to change. This is the "reference" line; the other two lines are A and B.

Differential Scales

Steps 1-5 above apply to the differential scales, but since there are twice as many lines, you will need to do a bit more work.

  1. Repeat steps 4 and 5 above for the rest of the lines
  2. You will notice that two of them needed to be moved farther for the voltage to change; mark them as "Reference"

Now you will need to identify A/A' and B/B' pairs. For this, you will need to move the scale several times and measure the voltage. It will be useful to make a table like the example below:

Wire Color Test 1 Test 2 Test 3 Test 4 Test 5
Yellow High High Low Low Low
Green Low High High Low High
Blue Low Low High High High
Brown High Low Low High Low

You will notice that pairs Yellow/Blue and Geen/Brown never have the same reading. I.e. when Yellow is high, Blue is low, and vice versa. These are in fact A/A' and B/B' pairs. At this point, you don't know which of the lines is primary and which is complementary, but fortunately, this is not important in most cases. Reversing the primary and complementary lines reverses the direction of reading, but that can be changed in the DRO settings.