element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Spring Clean!
  • Challenges & Projects
  • Project14
  • Spring Clean!
  • More
  • Cancel
Spring Clean!
Projects E-Caliper with USB, LCD and Bluetooth Interfaces
  • News
  • Projects
  • Forum
  • Members
  • More
  • Cancel
  • New
Join Spring Clean! to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: dougw
  • Date Created: 1 Jul 2025 7:44 AM Date Created
  • Views 448 views
  • Likes 14 likes
  • Comments 4 comments
  • dougw
  • E-Caliper
  • spring cleaning
Related
Recommended

E-Caliper with USB, LCD and Bluetooth Interfaces

dougw
dougw
1 Jul 2025

Intro

I use digital calipers on every project which makes me interested in their features. With the advent of low-cost digital calipers, I could not resist buying a couple of them. I discovered they have several drawbacks such as jerky friction, very short battery life and low resolution. However they do have a connector that can be used to monitor their readings. I have been looking for an interface cable for years, and there are some, but they are far more costly than the calipers, so I started looking into making my own. This is not a new idea, but all the home made connectors I have seen have problematic connectors. Usually they have no springs in the contacts, which makes it hard to maintain reliable contact on all four pins. I discovered quite a few issues that slowed my progress down significantly. One of the main issues was determining the pitch of the pins. I needed to be sure of the pitch because my plan was to make a printed circuit board with a custom connector and I didn't want to re-do it. This blog is the culmination of that journey.

E-Caliper System Image

image

Digital Caliper Interface Schematic

image

This circuit translates the1.5V clock and data signals from the caliper to 3.3V or 5V. It has a 1.5V regulator to supply power to the caliper and the voltage divider that sets the comparator voltage for the dual comparators. The supply voltage for the comparators is 3.3V or 5V, what ever supply voltage is coming from the MCU.  I actually substituted an MCP6002 op-amp for the comparator s since that is what I have in stock, and it worked perfectly. I looked at the signals on a scope and they are very clean. The scope was needed to nail down the relationship and timing of the clock and data signals.

Digital Caliper Interface PCB

image

Note the four custom spring contacts that need to mate with digital caliper PCB plated fingers. The pitch between pins that I used is 1.5mm and it seems to work, but it is pretty fiddly to accurately form these small contacts at such a fine pitch.

MCU Schematic

image

This PCB connects an HC05 Bluetooth module to a an Arduino Pro Micro. It also has an I2C 1602 LCD to remotely display the caliper reading. Th LCD uses 3.3V I2C pullup resistors, but the power supply is 5V to allow high LCD contrast. Of course it also dedicates 2 pins to receive clock and data caliper signals.

MCU Module

 image

The Bluetooth module was programmed with the name of "Caliper" to make identification in the Bluetooth device lists easier. The programming system for the Bluetooth module was the subject of a recent blog.

E-Caliper Video

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

Firmware

// Caliper sketch to read and display caliper readings
// Readings are sent to LCD, Bluetooth and USB
// by Doug Wong 2025

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

#define CALIPER_CLK A2  // Clock pin from caliper
#define CALIPER_DATA 5 // Data pin from caliper

LiquidCrystal_I2C lcd(0x27, 16, 2); // Adjust the address if needed

int bit_array[25];        // For storing the data bit. bit_array[0] = data bit 1 (LSB), bit_array[23] = data bit 24 (MSB).
unsigned long time_now;   // For storing the time when the clock signal is changed from HIGH to LOW (falling edge trigger of data output).
unsigned long ms_now;
float LastValue;

void setup() {
    pinMode(CALIPER_CLK, INPUT);
    pinMode(CALIPER_DATA, INPUT);
    lcd.begin();
    lcd.backlight();
    lcd.setCursor(0, 0);
    lcd.print("Digital Caliper");
    lcd.setCursor(0, 1);
    lcd.print("   Readout");
    delay(500);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Caliper ");
    Serial.begin(38400);
    Serial1.begin(9600);
    Serial1.println("digital Caliper");
    pinMode(17, OUTPUT);
}

void decode() {
  int sign = 1;
  int i = 0;
  float value = 0.0;
  float result = 0.0;

  while (digitalRead(CALIPER_CLK) == LOW) {};       // Wait until clock is HIGH

  for (i = 1; i <= 24; i++) {
    while (digitalRead(CALIPER_CLK) == HIGH) { }    // Wait until clock goes LOW
    bit_array[i] = !digitalRead(CALIPER_DATA);
    while (digitalRead(CALIPER_CLK) == LOW) {};
  }
 
  for (i = 1; i <= 20; i++) {                       // Turning the value in the bit array from binary to decimal.
      value = value + (pow(2, i-1) * bit_array[i]);
  }
 
  if (bit_array[21] == 1) {
    sign = -1;                      // Bit 21 is the sign bit. 0 -> +, 1 => -
  } else {
    sign = 1;
  }

 if (bit_array[24] == 1) {          // Bit 24 indicates the measuring units (1 -> in, 0 -> mm)
     lcd.setCursor(9, 0);
     lcd.print("inches ");
     result = (value*sign) / 2000.00;
     lcd.setCursor(6, 1);
     lcd.print(result, 4);          //send result to LCD
     lcd.print("  ");
     Serial1.print(result, 4);      //send result to Bluetooth
     Serial1.println(" in  ");
     Serial.println(result, 3);     //send result to USB
     Serial.println(" in  ");
  } else {
     lcd.setCursor(9, 0);
     lcd.print("mm     ");
     result = (value*sign) / 100.00;  
     lcd.setCursor(6, 1);
     lcd.print(result, 3);          //send result to LCD
     lcd.print("  ");
     Serial1.print(result, 3);      //send result to Bluetooth
     Serial1.println(" mm  ");
     Serial.print(result, 3);       //send result to USB
     Serial.println(" mm  ");
  }
}

void loop() {                                      //detect start of data reading sequence
    if (digitalRead(CALIPER_CLK) == HIGH) {
      while (digitalRead(CALIPER_CLK) == HIGH) {}  // Wait for clock to go LOW
    }
    time_now = millis();
    while (digitalRead(CALIPER_CLK) == LOW) {     // Wait for clock to be LOW for 10ms - only happens between readings
      if ((millis() - time_now) > 10) {break;}
      if (digitalRead(CALIPER_CLK) == HIGH) {time_now = millis();}
    }
    decode();                                     //capture and decode the bit sequence
}

A couple of things to note:

  • The data stream for one reading is 24 bits. Bit 24 indicates whether the reading is in inches (1) or mm (0)
  • Bit 21 is a sign bit - if it is 1 it means it is negative number

Discussion

I am glad that I finally got a digital caliper interface working after so many moons of scratching at the edges of it, and I am very happy that the PCB I designed fit well and worked flawlessly. The project started out seeming to be simple, but It ended up with four 3-D printed parts, 2 PCBs, a PC and an android device. The firmware is not long, but without closely examining the scope traces and going through numerous revisions, it would not have worked. Those fancy custom contacts have already been through dozens of mating cycles with no apparent degradation. There are a couple of things I could do to improve on the prototype and I have nine more PCBs available if I get ambitious, but the main objective of this project has been met. One thing I have already started is an android app to display the readings sent via Bluetooth. here is a preview of what it will look like:

image

I will try to add in a scope image of the clock and data waveforms to this blog. They are quite interesting, but I have to take the system apart to get a scope on the signals.

This project is not exactly spring cleaning, but the theme includes digging out old projects, and the project does have some nifty spring contacts in it...Relaxed

  • Sign in to reply
  • dougw
    dougw 10 days ago in reply to shabaz

    Speech output is a great idea. I just did an Excel VBA macro for another project that used speech output - it would be easy to have Excel read the caliper and supply a button to turn speech on or off. Of course it could have other buttons to do various computations with the readings.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Andrew J
    Andrew J 10 days ago

    Great project Doug.  Remote reading is really useful and once you can get readings out further use cases will pop out the woodwork as you go along.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz 11 days ago

    Hi Doug,

    Nice work. I'd been on the lookout for a pair of BLE calipers for ages, and I narrowed it down to two candidates.One was called S_Cal EVO, but I was quoted something ridiculous (approx. 325 USD) or Shahe 5101L (approx 60 USD).

    The S_Cal EVO has spectacular BLE capability (it can operate in several modes for future-proofness) whereas the Shahe model only works one way and limited configurability which needs to be done on the instrument, not remotely.

    However, despite the simpler capability, I've been really happy with the Shahe model. I was meaning to write a review but I never got around to it.

    Anyway, my point was going to be, if you're looking for ideas for your app, it could be worth checking out some of the current apps documentation, in case you see anything of interest to you. For instance, one thing I'm missing (I've been meaning to implement it) is speech output of the measurements, since I'm not always able to look at the display. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB 11 days ago

    Great post Douglas.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube