Subscribe to Arduino Academy and start learning today for FREE!

Harbor Freight / Pittsburgh Caliper Arduino Connection

Another HF Caliper project. Here is the HF Caliper connected to our digital interface for Arduino, Raspberry Pi, and more. Just above the battery door is a small access panel that covers a 4 pin edge connector. Carefully solder 3 wires to those pads, which, from left to right are GND, Data, Clock, and +1.5v (we aren’t using that one). You no longer need to solder on to those delicate pads, as we have a cable that plugs right in!

The interface is simple. two transistors (we used 2N2222A) and four 10k Ohm resistors 1/4w.

You can order a finished board for only $20, a HF cable (no soldering) for $25, and a Arduino Nano w/ integrated Screw Shield for $15

Screenshot, schematic, and code are posted below. Thanks to the following sites for ideas and resources:

Cable to fit caliper, eliminates need to solder –

Just cut off the RJ-11 plug, strip 1″ of the black outer jacket, strip 1/2″ of insulation on each wire, fold back in half, solder, and insert into screw terminals (the wires are too fine to hold in the screw terminals otherwise). Connect as follows:

Become the Maker you were born to be. Try Arduino Academy for FREE!

Gnd – yellow
Data – blue
Clock – red
1.5v (not used) – white

Next version of the board will have a RJ-11 jack on board, no stripping wires.

Arduino code is below:
//Digital caliper code to read the value off of a cheap set of digital calipers
//By Making Stuff Youtube channel
//This code is open source and in the public domain.
const byte clockPin = 2;  //attach to clock pin on calipers
const byte dataPin = 3; //attach to data pin on calipers
//Milliseconds to wait until starting a new value
//This can be a different value depending on which flavor caliper you are using.
const int cycleTime = 32;
unsigned volatile int clockFlag = 0;
long now = 0;
long lastInterrupt = 0;
long value = 0;
float finalValue = 0;
float previousValue = 0;
int newValue = 0;
int sign = 1;
int currentBit = 1;
void setup() {
  pinMode(clockPin, INPUT);
  pinMode(dataPin, INPUT);
  //We have to take the value on the RISING edge instead of FALLING
  //because it is possible that the first bit will be missed and this
  //causes the value to be off by .01mm.
  attachInterrupt(digitalPinToInterrupt(clockPin), clockISR, RISING);
void loop() {
   if(finalValue != previousValue) {
     previousValue = finalValue;
   newValue = 0;
 //The ISR Can’t handle the arduino command millis()
 //because it uses interrupts to count. The ISR will
 //set the clockFlag and the clockFlag will trigger
 //a call the decode routine outside of an ISR.
 if(clockFlag == 1)
  clockFlag = 0;
void decode(){
   unsigned char dataIn;
   dataIn = digitalRead(dataPin);
   now = millis();
   if((now – lastInterrupt) > cycleTime)
     finalValue = (value * sign) / 100.00;
     currentBit = 0;
     value = 0;
     sign = 1;
     newValue = 1;
   else if (currentBit < 16 )
     if (dataIn == 0)
       if (currentBit < 16) {
          value |= 1 << currentBit;
       else if (currentBit == 20) {
          sign = -1;
   lastInterrupt = now;
void clockISR(){
 clockFlag = 1;

Become the Maker you were born to be. Try Arduino Academy for FREE!


Notify of
Inline Feedbacks
View all comments
4 years ago

what is being used for a display?

My Mobile Kalinowski
My Mobile Kalinowski
4 years ago

How to print the score on lcd 16×2?

6 years ago

I tried this. Despite this being my first Arduino project, over sized soldering equipment instead of just buying the cable (everyone should just buy the cable, don't put yourself through that), using a PN2222 transistor instead of the listed one, and obtaining my 10k resistors from an old radio, it somehow worked the first try and made a neat little graph in my Arduino software. I couldn't be happier, thanks.

5 years ago

Can you power the calipers from the 1.5 volt pin on the calipers? With a regulator to drop down the 5V of course. My big complaint I have with my HFT caliper is that the battery dies *way* too fast.

Steve Spence
5 years ago

Yes you can! However, you lose calibration and mode settings when the power supply is turned off. You could use a rechargeable battery and have it charge when the arduino is powered up ….

5 years ago



Would love your thoughts, please comment.x