Digital calipers have become available at very low prices. Some models even feature a serial port. For any passionate hacker this poses the immediate question: can Arduino read such calipers? The short answer is yes.
There is a type of digital caliper which is commonly sold on internet auctions for as little as 10-15€ and which features the required serial port. It hides behind a little plastic sliding cover on the upper side of the instrument. I bought one of these and after some testing luckily discovered that it uses a data protocol already described in detail on the net. I found this contribution particularly useful:
This is my caliper with the slide cover of the serial port opened
A close-up view of the serial port showing the four pins: 1.5V power supply, clock, data and ground.
Here the most important facts about the caliper's data transmission:
This is all we need to know to operate the caliper in the millimetre mode, in inch mode things are slightly different.
Before decoding the caliper data, we need to raise the logic level of both data and clock lines from 1.5 to 5V. I have achieved this with the following simple transistor circuit:
However, this little circuit which we need on both the data and clock line not only raises the voltage of the signal, but it also inverts the logic levels. This is not a major problem as we can easily deal with it by adjusting the Arduino code accordingly.
The caliper’s data and clock lines are connected to 2 Arduino digital pins via the described level shifting circuit.
The code first identifies the longer period when clock is HIGH, which separates the consecutive series of 24 bits. Then it reads the logic level of the data line each time the clock changes from HIGH to LOW and assembles the individual bits to the resulting value, considering also the positive or negative sign as expressed by bit 21.
Note that HIGH and LOW in this code are inverted since our interface circuit has inverted the original logic levels.
With this code and the described setup you should be able to read the caliper data on the serial monitor of your PC.