❓ Problem

It's tedious to write down digital caliper measurements while working with research samples since you have to set the calipers down each time to record the value.

✔ Solution

Use SAM32 to read the caliper measurement, decode the protocol, and emulate keystrokes over USB to enter data into spreadsheet. Note: wired design driven by @CaitlynBioE's specific use-case.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/31f62927-af70-40ec-b750-e45f956bb111/demo3.gif

Jump to the SAM32 code


Choosing the Right Calipers

Enabling USB input from digital calipers is expensive: Amazon Mitutoyo USB Input Cable runs $174 on top of the already $150 calipers! But, it shows us there's at least an interface to work with (on some models). You can see by the product image that the cable mates with a 4-pin press-fit connector on the body of the calipers.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/25b6f4a0-76ec-4ea4-b0e3-4694edf3fe50/Untitled.png

Not all calipers will have output capability. In fact, after tearing down the most popular budget calipers on Amazon: [iGaging IP54 Electronic Digital Caliper](iGaging IP54 Electronic Digital Caliper) we see that the glob-topped IC driving the linear encoder doesn't even have the data-output pins available for us to use.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d3dfa30c-faf7-47d2-90c4-4365ac6358ca/Untitled.png

Logic board in the [iGaging IP54 Digital Caliper](iGaging IP54 Electronic Digital Caliper) circa 2018. Notice data output pins are not made available

Logic board in the [iGaging IP54 Digital Caliper](iGaging IP54 Electronic Digital Caliper) circa 2018. Notice data output pins are not made available

The easiest way to tell if you have a pair of calipers with output capability is to look for the model of encoders packaged in caliper bodies with a port (or door) in the top right corner of the device as shown to the right.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/844a5822-b111-4f5a-8a47-df1c8bf49fff/Untitled.png

Understanding the Data

Folks have already documented the types of data presented by digital caliper ports. I found the following pages very helpful:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/9f011261-e059-4575-bbeb-b0592c8de6f9/Untitled.png

Key points from the last link:

Data is transmitted in a continuous data stream

Each complete dataset consists of a series of 24 bits

Data are transmitted by means of a data line and a clock line

Data is read on the FALLING edge of the clock signal

The caliper uses a 1.5V logic level

We can use a simple level-shifting circuit to measure the 1.5V logic using our SAM32 (with 3.3V logic). Below is a simulation of the NPN circuit used. Check here to play with the interactive version. The data and clock signals each need a level shifting circuit. I initially tried using a MOSFET as opposed to a BJT... but was unsuccessful. Maybe the impedance of the caliper pins?

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c2359a9a-02d4-448a-ae89-967bc2b1c4cd/circuit-20190626-2324.png

Once we're able to level-shift the signal, it's time to use the logic analyzer and decode the data. As shown below, we want to measure at the clock falling edge which translates to the rising edge when the signal is inverted. We then invert the measured value to get the desired data in binary format (least-significant bit first). This data format is referred to as binary coded decimal.