Interfacing with Digital Calipers

Digital calipers are one of the most important tools for accurate machining of existing pieces, such as project boxes, switches, and custom parts. This is particularly true when you don’t have the manufacturer’s datasheet to provide the dimensions of an object.

Inexpensive imported digital caliper

Besides the LCD display, many calipers have a digital output port for their data. Name-brand calipers charge significantly more money for the inclusion of a data port, even though they often build it into all of their models, only to be hidden by the plastic case.

Calipers with data outputs can be used as positioning sensors in robotics by attaching one caliper jaw to a moving part, and the other jaw to a fixed part. The absolute and relative position can be determined to a hundredth of an inch. Many hobbyists attach calipers to their milling machine to create inexpensive digital readouts (DRO).

Another potential reason to interface to an electronic caliper is to quickly log dimensions for statistical analysis or quality control.

In order for a microcontroller to read a caliper, you need to know the pinout and data format. These specifications vary from manufacturer to manufacturer. This article provides the measured timing and bit formats for two brands of digital calipers that I own.

Buying Cheap Digital Calipers with Data Ports

Inexpensive imported digital calipers can be found on eBay. (They are sometimes referred to derogatorily as “cheap Chinese calipers”.)

Average prices vary by length: 6 inch ($8), 8 inch ($22), and 12 inch ($40). A lot of sellers fool around with higher shipping costs, so I added the shipping to the price when quoting the approximate cost. Don’t overlook the shipping cost when comparing similar calipers.

The last time I purchased calipers at SparkFun Electronics, I found the format was different than the formats described in this article. Also, high-end calipers tend to use SPC format, which is also not something that I’ve decoded and documented.

Make sure the calipers are digital (an LCD display) rather than analog (clock face with dials).

Analog caliper.

Also, make sure the calipers include a “data output port”. Most of the imported calipers include the data output, although the auction ad may not say so. You may want to ask before buying.

Pinout of imported digital caliper.

You can buy nice pre-made mini-DIN data cables (#1990, $13.95) for your imported calipers at Little Machine Shop. One end fits into the caliper data port and the other end mates to a 4-pin female mini-DIN connector such as CUI #MD-40SM (DigiKey CP-2240).

Pinout Mini DIN Digital Caliper Data Cable.

I’ve encountered calipers to which the cable doesn’t fit because of the shape of their particular plastic slot. Filing away some of the plastic from the caliper’s casing can correct that problem.

The opposite problem is that the cable may not fit snugly. On one particular caliper, I had to drill and tap tiny #0-80 screw holes to affix a piece of copper clad board to clamp the cable in place.

Securing data cable on digital caliper using circuit board and screws.

Because the price of a data cable can exceed or approach the cost of the caliper, you may opt to solder wires directly to the caliper’s data port circuit board traces. It isn’t an easy soldering job, but I’ve done it.

Caliper Power Source

With the exception of high-end name-brand absolute-position-encoded calipers, most calipers measure relative position only. The implication is that they need to be powered on at all times in order to remember their existing position, in order to display a change in position. If they were to truly power off, you’d need to bring the jaws together and re-establish zero each time you powered them on. That would be obnoxious.

To get around this limitation, the relative-position calipers continue to operate even when you press the “power off” button. They simply turn off the LCD. If you really want to conserve power, you need to remove the battery before putting away the caliper.

Fortunately, the caliper uses very little power (10-20 micro amps) regardless of whether the LCD is turned on or not. The caliper can remain powered by a LR44 or SR44 battery for a year or more.

This isn’t anything that should affect you. I’m just warning you that if you remove the batteries, supply power externally, and then power off your project, the digital calipers will reset to 0 regardless of the actual position of the jaws.

Caliper Voltage

Calipers run at very low voltage (nominally around 1.5 V). Your project can get away with providing power to the calipers using a relatively common 1.8 V voltage regulator, or through a LM317 variable voltage regulator set to 1.65 V (the voltage of a completely fresh alkaline button cell).

If your project is going to supply power to the calipers, remove the batteries from the calipers to prevent the project power source from applying a charge to a non-rechargeable battery. The battery may overheat and vent; spewing chemicals into your calipers. For absolute stability, I replaced the batteries with moderately large value capacitors.

Alternatively, a simple solution is to not supply power via the data cables. Just leave the batteries in the calipers and don’t attach the positive voltage wire on the data cable to your project power source.

Low-Voltage Interfacing

The low voltage will make it difficult to interface the caliper outputs (nominally 1.5 V output to represent a high level) to a microcontroller with digital inputs that need as much as 0.7 × V cc (around 3.5 V for a 5 V power supply). You can connect each caliper output through a resistor to an NPN transistor, and take that output to a pull-up resistor on the microcontroller. That will level-shift the signal, but it will also invert it. So, flip it back again in software.

Another approach is to use a low-voltage comparator, such as the TLC3704. Simply compare the caliper outputs to a voltage around 0.8 V and feed the output into the microcontroller.

Let’s see the output of a caliper with two 24-bit packets...