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]

Comments

  1. Kris says:

    This is an interesting hack that has already been hashed over a few times in several machinists forums. There’s a couple projects out there to read multiple calipers at the same time so you can use the cheap Chinese calipers as DRO’s (digital readouts) to know the absolute positions of your X/Y/Z/Quill on a vertical/horizontal mill or lathe

    http://www.msh-tools.com/DRO/index.html

    http://www.yadro.de/

  2. Casey O'Donnell says:

    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.

  3. Nice hack, now we can monitor fruits growth

  4. uC says:

    Nice link Kris.

    They have a iPod DRO. That looks slick. It would probably look really nice with a larger screen. Like the colour nook, or any android tablet.

    http://www.msh-tools.com/DRO/ipprg.html

  5. addids says:

    I always figured that was an unpopulated usb jack.

  6. sdmadsen says:

    Please tell me I’m not the only person who read the title as Reading a digital caliper with a micrometer

  7. I had run an experiment a year ago. I put 2 different calipers n the oscilloscope and reverse-engineered the protocols they used. They had different protocols, and also i found a third one:

    http://pcbheaven.com/exppages/Digital_Caliper_Protocol

  8. Maris says:

    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.

  9. Marco says:

    “Nice hack, now we can monitor fruits growth”

    And use the fruit’s acid to run the low-power TI uC !

  10. addidis says:

    @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.

  11. PocketBrain says:

    You guys covered [David Cook] using a digital caliper as a depth gauge on his milling machine.

    http://hackaday.com/2010/03/27/swapping-coins-cells-for-capacitors-for-noise-filtering/

    It would be nice to get that RS232 protocol converter miniaturized; you could go wireless with a bluetooth-serial module.

  12. gyro_john says:

    @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.

  13. saimhe says:

    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.

  14. Maris says:

    @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 :)

  15. ladz says:

    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.

  16. Oh hell yes! I’ve been wondering how to interface with the port on my digital caliper (Same as pictured) and I have three Launchpads I’ve barely touched! :3

  17. raisin says:

    Similar post with tons of basic explanation and video:

    http://www.nerdkits.com/videos/digital_calipers_dro/

  18. gyro_john says:

    @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.

  19. Carlo Heras says:

    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.”

  20. Marinus says:

    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

Follow

Get every new post delivered to your Inbox.

Join 96,369 other followers