Reading a digital caliper with a microcontroller

[Maris] wanted a way to read measurements from a digital caliper electronically. He ended up using the TI Launchpad to accomplish this, but not all of the necessary hardware is seen above. The calipers cost him about $7 on eBay, and they have four interface pins which made this hack quite a bit easier. After a bit of probing he established their purpose; voltage, ground, clock and data. A bit of scoping proved that data was being sent in 24-bit burst in packets that are quite easy to decode.

From there it’s just a matter of interfacing with a microcontroller. The chip he’s using is an MSP430G2231 that runs at 3.3V, but the caliper’s logic high is only 1.5v. By constructing an adapter using a pair of transistors, the data and clock from the calipers are able to pull pins on the MSP430 low. This is collected and analyzed by [Maris'] firmware and can be read on a PC using a terminal program.

[Thanks Chris]

20 thoughts on “Reading a digital caliper with a microcontroller

  1. that uC works great with two rechargeable AA batteries @ 2.4V, datasheet says 1.8V minimum.

    $7 is a nice price for those i can only find one for $12.

    now pair it with a laser.

  2. Glad you like it! I have the link in my article to guy I bought it from for 7$ including slow shipping (I have no connection to him whatsoever). Others where closer to 10$ as you say.

    Yeah, you could pair couple of those with miling machine and make small CNC type of thing. My initial idea was to use it as position sensor for motocycle suspesion data loging, but 8 times a second won’t be enough for that.

  3. @sdmadsen
    NO! I read it once , thought about it, and thought reading a digital caliper digitally. And thought well gee thats dumb just look at the lcd. Then the second time I realized what they meant.

  4. @Maris:

    If you need more speed, try this: give up on the SPC data interface and get the encoder signals directly. I suggest you try to find them, not at the pickup or read head, but after a stage of amplification. You’re looking for a pair of square waves in quadrature (90 deg. apart in phase).

    Since the signals would probably not be CMOS- or TTL-compatible, you might have to buffer them up with a couple of transistors.

    Your Launchpad should be plenty quick enough to keep up with the count at the rate your bike suspension will move.

    I’ve done a couple of projects with microcontrollers reading and doing math on encoder outputs. If you should need a little insight, feel free to ask.

  5. He is lucky with those transistors. Conditioning a bidirectional push-pull line (think MOSI/MISO at 10 MHz) with ubiquitous discrete components would be nightmare in comparison.

  6. @gyro_john

    You mean to read directly before that small caliper mcu, like directly those capacitance sensors? Yeah, that sounds interesting… but as you say I’m not sure how much “energy” those signals would have… If you have any more pointers/links, feel free to send them my way. If that works out, could be nice topic for another article :)

  7. There is an open source package called OpenDRO that has C code to read these using an ARM. I know a lot of work has been put into that project with different scales. Some of them use different protocols.
    One thing that’s really nice is that the OpenDRO code puts the capable calipers into a high resolution mode so you can actually get more digits out, though probably at questionable accuracy.

  8. @Maris:

    I e-mailed you a rather long thing of my comments on how to parse the two square waves – I thought it too long to post here. Sorry everybody; I don’t have a good place where I can leave it forever.

    However I thought that two other comments might be of interest:

    1. As to low-energy signals, let me suggest that I would connect them to the gates of FETs, then the loading would be very small.

    2. Here’s a new idea I just had this week to get a longer linear encoder from cheap calipers. I’m excited to try it. You see I have a very small home milling machine with 14″ X-axis travel, so no cheap caliper will have a long enough stroke. Here’s my idea: I chain two of them together in series. They will both extend and collapse randomly together. Since we now know how to do conversion math on the square wave inputs, I run the outputs of BOTH calipers to my conversion circuit and output equivalent A, Abar, B and Bbar signals equivalent to the sum of what the two calipers are doing.

    Happy Holidays, all.

  9. The TI [censored] still haven’s shipped my order from August. Calling TI support is like calling the phone company “We don’t care. We don’t have to.”

  10. Hi, Im doing a project also using a digital caliper, what type of caliper would you surgest using, I will also pickup the signal, (the data stream) to fead into my own circuit, and where can I find the type of protocols they use?

    Thanx Marinus

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s