Mixed Linear Scale DRO with MSP430 Launchpad

Thursday, July 4, 2013

An increasing number of readers have been asking me to add support for other encoders to my Digital Readout application, especially the “standard” Chinese scales and cheap calipers. Although I’ve been experimenting with the idea for some time but never got around to getting it done. Last weekend, while working on step-by-step build instructions for the MSP430 Launchpad DRO controller, I realized that I was much closer to the solution than I previously realized. The MSP430G2553 microcontroller that ships with the newer version of the Launchpad kit is a very capable chip that should be able to read three or four different scales with no problems. After digging through my and my father’s garages, and a trip to Harbor Freight I was able to round up six different-looking calipers and a BG Micro “Digital Indicator”, so I was ready to start experimenting.

Digital Caliper Basics

Inner workings of a standard
Harbor Freight caliper

Before going much further, let’s cover some basics to make sure that everyone is on the same page. Almost all digital calipers and scales use an incremental capacitive transducer to determine their position. In most cases the main scale covers a circuit board that has a special pattern etched on it; inside the main body there is another circuit board with a set of etched strips. By rapidly measuring the capacitance between each strip and the frame PCB, the controller inside the caliper can precisely measure its movement. By knowing how far the transducer has moved from the reference point the scale can then calculate its precise position and display it to the user or send over the wire [to the Launchpad in our case]. There are differences in how the position is encoded and sent over the wire but almost universally these scales use a variant of a synchronous serial protocol. In case iGaging Remote Digital Readout scales the display unit provides the clock; all of the others that I had a chance to test provide their own clock.

The Requirements

From the get-go I realized that making a separate firmware for each type of scale didn’t make sense. Instead, the firmware would need to be able to read different kinds of scales. I considered letting the user configure each input port using jumpers but quickly dropped the idea. If possible, the controller will need to auto-detect the protocol. Alternatively I can write a small app that can configure the inputs from the Android device. It would also be nice to have the ability to use a mix of scales/calipers. In other words the firmware would need to detect the data protocol for each axis individually. Additionally, since the Launchpad has a green and red LED, it would be great to use them for providing some basic feedback to the user. Finally the project should be easy to put together for a person with little or no electronics experience and use readily available components.

The Hardware

Basic circuit that converts
1.5V signal from scales
to 3.3V needed for MSP430

The first order of business was to connect the scales to the microcontroller and make sure that it can read the signal. To run at 16MHz, MSP430 Launchpad requires 3.3V power supply. The datasheet states that input threshold voltage min/max is 1.35V and 2.25V respectively at 3V supply. In other words the 1.5V signal coming from the calipers will likely not read as “high”. I first tried powering one of the calipers from 2.5V supply but it promptly let the magic smoke out and died. This was only a minor setback, though, since a voltage level shifter is a basic, easy to build circuit. The idea is to connect the caliper output through a resistor to a NPN transistor as shown in the schematic. This shift the voltage level to 3.3V but will invert the input as well, which can be easily handled in the firmware.

4-Axis adapter board prototype

Each scale will require two of such level shifters (input buffers) - one for the clock line and one for the data line. A 4-axis adapter board can be easily build for a few dollars using some parts readily available from any store that carries electronic components. I built mine using eight MP2222A transistors, eight 220 Ohm resistors, and a proto board from Radio Shack.

Any resistor value between about 200 Ohm and a 1/2 KOhm should work. Similarly, any NPN transistor would work as well, since MSP430 maximum input current draw is on the order of 2mA. Please keep in mind that some transistors (such as 3904, for example) have the pins reversed so make sure to connect them in the correct direction. Alternatively the whole board can be replaced with a single “Octal Line Driver” IC or two Op Amps.

Former USB cable connected to
a Harbor Freight caliper's main board

Second the scales have to be connected to the adapter board. Initially I tried using the proprietary cables [that came with the BG Micro Digital Indicators] but the connection was horribly unreliable on all but Harbor Freight caliper. After a few hours of wiggling the cable I decided to simply solder four vires to the pads and call it good. To access the pads the calipers had to be taken apart but it proved to be fairly easy. There are four bolts hiding under the label on the backside that can be undone using a miniature Philips screwdriver. Once the front sub-assembly is off, there are four more tiny screws inside, holding the main board to the case. The buttons and LCD display will do their best to scatter around so be prepared to catch them. To keep things consistent with the connections used with iGaging scales in the previous versions of the controller I used a sacrificial USB cable. This way all of my scales use Red-White-Green-Black sequence for Vcc, Data, Clock and Ground respectively.

Finally it was time to connect the adapter board to the Launchpad. To keep the hardware compatible with the current version of the firmware (to make things easier for people using only iGaging scales) I decided to leave the existing pin functions unchanged. Fortunately there were enough unused pins, so this didn’t pose any issues. Since there were two more unused Port 2 pins (market XIN and XOUT), it made sense to use them for the fourth axis. P1.7 would be used to provide the clock to the iGaging scales, so they can be treated by the input pins just like the rest of the scales that provide their own clock. Finally this leaves P1.5 and P1.6 for tachometer, which I’m planning to add in the near future.

With the hardware taken care of it was time to deal with the data protocol, which I will discuss in the next post.


  1. Thanks Yuriy!
    My $29 24" Igaging scale is in the mail. Time to order the MSP 430 and warm up the soldering iron!

  2. Hi Yuri,

    Do have any idea where I could find information regard interfacing to iGaging digital indicators? The connector on them appears to be a USB mini-b type.

  3. Hi Yuryi,
    Very interested in connectin one (X-axis) igaging scale and two "chinese" scales (ex verniers). I see what you did on the 4-Axis adapter board prototype but what are the components in the top left corner, please?
    Is the software able to identify and process the different protocols yet?

    1. Joe,
      The component is an adjustable voltage regulator for 1.5V supply. I'm not using it right now (powering the scales from their own batteries).
      I haven't posted the firmware for this board yet, though. There are still a few issues to iron out but to answer your question - yes, it detects 21bit, 24 bit and the "Harbor Freight" caliper protocol.

      Thank you

  4. Yuriy;
    At some point in the future would you please post the circuit for the 1.5v per supply. Thanks

  5. Dear Yuriy,

    I'm trying to connect 3 "Chinese" 2*24 bit scales, these scales supply both data and clock. Could you please explain what to
    do with the 3 clocks and to which pins they
    should be connected on the MSP430.

    Thanks a lot for a great project

    1. At this point the code doesn't support it. I'm getting pretty close to a "public beta" of new controller but it still needs a bit of work.

      Thank you

  6. Dear Yuriy,

    does the V1.2 of the Launchpad Firmware 1*24bit Scales ?
    where i must connect the Clock lines ?
    I will connect 3 1*24bit Scales only on a Lathe. (this Scales have Clock and Data Output )
    Otherwise the Launchpad an BT Modul works fine with Samsung Pad 2 7.0 (but of course only the display shows 0)

    Many Thanks

    1. Roland,
      1.2 doesn't. There are two [different] version of the firmware coming (within a few weeks) that will handle 2x24 protocol scales. I'll be posting the details in a few days...

      Thank you

  7. In the picture of the digital scale PCB you have connected the USB wires: Red, White, Green, Black as Vcc, Data, Clock, Ground. On the Schumatech site the connections are shown as Vcc, Clock, Data and Ground. Can you tell me which is correct? Are the contacts labelled or easily identifiable on the PCB?