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.
As is often the case with goods manufactured in China, it's hard to make any sense of brands and models because in most cases, the same products are sold under a number of different brands. In addition to the better-known brands such as Ditron, Easson, and Sino, there is a bewildering number of scales sold under names like Jino, Jink, Chino, etc. At a given price point, the scales look close to identical internally regardless of the brand, so it's likely that they are manufactured by a small handful of manufacturers and are re-branded for different distributors. For instance, the scales above are branded differently and were purchased more than two years apart from different sellers, yet the internal components look almost 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:
- Four wires: +5V, 0V, A, B
- Five wires: +5V, 0V, A, B, R (or Z)
- Eight wires: +5V, 0V, A, B, R (or Z), A', B', R' (or Z')
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.
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..
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.
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:
- The dot is next to pin #1
- With the tab pointing up, the first pin will be in the upper left corner
- With the bevel side on the left, pin #1 will be in the upper left corner
Note: Going forward, we will position the IC so the pin #1 is in the upper left corner.
Step 2 - Identify The Power Supply Pins
This step will be identical for all three types of DRO scales:
- Switch your multimeter to the "Resistance" mode or, if available, "Continuity" (A.K.A. "Beep") mode.
- 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"..
- Place one of the multimeter leads on that pin and probe continuity between it and the wires connected to the DB9 connector.
- 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.
- 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"
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.
From this point the steps will differ, depending on whether or not you have differential scales.
Step 4 - Identify the Pulse Lines
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:
- Most commonly, the reference line will output a square wave with a period that is several times larger than the other two lines.
- Very rarely, the line will output short pulses at relatively long distances (tens of millimeters apart).
- Switch your multimeter to "Voltage" mode.
- 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.
- 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.
- 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".
- Carefully tap the reading head to move it lenght-vise until the voltage changes from low to high or vice versa.
- Note how much you had to move the head.
- 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.
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.
- Repeat steps 4 and 5 above for the rest of the lines
- 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|
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.