Home     Contact     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Tech-BLOG     RSS     Terms of services     Privacy policy  
 Home     Contact     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Tech-News     RSS   

PCB Fabrication
17 December 2009
Author: Giorgos Lazaridis
Digital Caliper Protocol


Intro

This is yet another interesting experiment that took place in the PCB Heaven techlabs these days. This experiment has to do with the digital caliper protocols. These calipers have a communication port for interfacing with a PC or other supported devices. As far as i know, there are basically 3 types of protocols for interfacing them. The first one is the Digimatic from Mitutoyo. The other two protocols are both for the Chinese calipers. To distinguish them, we will name them Chinese-BCD and Chinese-Binary protocols. The BCD and Binary suffixes comes from the way that the data are being transmitted.

Because the Chinese calipers are ridiculously cheap, i experimented with two calipers covering both the Chinese-BCD and the Chinese-Serial protocol. You can see the experiments here:





As far as the Digimatic protocol is concerned, i have not yet done any experiment. Instead, you can see the full documetnation of this protocol from the following file. This is a complete 52-bit protocol that is being transmitted only upon request (handshake), and the data comes in BCD nibbles:



 The Digimatic protocol from Mitutoyo
























Relative pages
  • Learn how the PS2 keyboard protocol works
  • Re-use and/or extend your molex connectors
  • Learning PICs @ PCB Heaven On-Line Book




  •  Rate this article!


    Comments

  • At 12 June 2011, 17:15:16 user Boris wrote:   [reply @ Boris]
    • Hello. I want to read this data by PIC16F887. What is a better way to do this?


  • At 13 February 2010, 22:20:54 user Philip Freidin wrote:   [reply @ Philip Freidin]
    • "Have you ever bought from this site? "

      Yes, I bought about $70 worth of stuff from them 2 weeks ago.
      Some RTC (the model I suggested to you) and some high voltage supplies
      for a Nixie project I am doing. For products that are basically just
      to support hobby users, their documentation is very professional.

      As both his company and I are in California, the shipping time was
      only 2 days. Ordered Tuesday, order acknowledged Wednesday, shipped
      on Thursday, received Saturday. Obviously will take longer to ship
      to Greece. Just ask questions via the Contact page.


  • At 13 February 2010, 16:18:49 user Kammenos wrote:   [reply @ Kammenos]
    • The RTC modules looks nice, and the battery lifetime is also brilliant. Have you ever bought from this site? They use paypal cart, i suppose it is secure.


  • At 13 February 2010, 16:06:16 user Philip Freidin wrote:   [reply @ Philip Freidin]
    • "But for my application, i will use external power to either power the LCD or the micro that will convert to RS232. The same power will be used to power the caliper - that will no longer rely on batteries."

      In that case, a normal NPN transistor, driven through maybe a 10K base resistor would be a good starting point for your experimentation.


      "I will need your suggestions for a clock that i think of making, that will rely on batteries when the mains is out (this happens quite often here in Greece)"

      For battery backed up clocks, have a look here:

      http://www.tayloredge.com/storefront/SmartNixie/index.html

      at the 1362 or 1374 modules.


  • At 13 February 2010, 6:24:23 user Kammenos wrote:   [reply @ Kammenos]
    • Oh, now it makes sense. But for my application, i will use external power to either power the LCD or the micro that will convert to RS232. The same power will be used to power the caliper - that will no longer rely on batteries.

      Actually, i will attach one caliper (liner) to the spindle of a carpenter's router, to measure the height of the cutter. I will not have any problem with the power supply. I will need your suggestions for a clock that i think of making, that will rely on batteries when the mains is out (this happens quite often here in Geece)


  • At 13 February 2010, 6:15:13 user Philip Freidin wrote:   [reply @ Philip Freidin]
    • There are two issues. How much power is drawn from the caliper to
      drive the level shifter, and how much power the level shifter draws from the system it is connected to.

      The caliper battery has very limited power, so if you don't want to
      affect the caliper battery life much, you need a CMOS type load.
      For example, a CMOS chip, or the gate of a FET.

      So a FET transistor might work, although you will need very low Vgs.
      Maybe something like a 2N7000 or 2N7002.

      If you use a NPN (or PNP) transistor to sense the caliper output, it
      is easy to make it work with the voltage swing from the caliper, but
      it will draw power that is many times the normal caliper power
      consumption.

      The suggested chips are designed specifically for these voltage
      ranges. In my application, I also care about the current consumption
      of the system my caliper is connecting to (it also has a very small
      battery), and the suggested chips have an idle current of 0.5 uA.

      Of course, if you can find a microprocessor for which 1.4V is an
      acceptable level for logic high, then that would be a good solution.

      Most micros use VSS*0.7 for logic high, so a processor that runs at
      5V needs at least 3.5V. A processor that runs at 3.3V needs 2.3V .

      This is why I mentioned that the caliper output at 1.5 for logic
      high would be a problem.


  • At 13 February 2010, 5:43:57 user Kammenos wrote:   [reply @ Kammenos]
    • Silicon Valley... nice place to work...

      For the voltage shifting, i thought of using simple transistors. You think there will be a problem?


  • At 13 February 2010, 5:32:38 user Philip Freidin wrote:   [reply @ Philip Freidin]
    • Hi Kammenos,

      I understand your comments about secrets. I work in Silicon Valley,
      mostly for big chip companies. Lots of secrets, lots of re-inventing
      of the wheel. In my hobby work though, I try and help others if I
      can, and hope others will help me.

      As for averaging of the readings, you must calculate the averages of
      the full 24 bit numbers (as I did in my prior explanation), not just
      the low 3 bits. This is because the rest of the bits can be affected
      by the low 3 bits as it rolls back and forth over the major transition
      from 111 to 000.

      My current project (started 5 years ago, but been on hold for last
      4 years) involves reading data from calipers (obviously). As the
      voltage levels from the caliper are 0 to 1.5 volt, you may have problems interfacing them to a microcontroller, as the logic high
      may not be high enough. May I suggest that you consider the following
      parts to do level shifting (that's what I use): sn74AUP1T57 or 58.
      These can shift the caliper signals to 0 to 3.3V signals.

      All the best,
      Philip


  • At 13 February 2010, 3:14:09 user Kammenos wrote:   [reply @ Kammenos]
    • Fist of all Philip, thank you for the links. Zero and Mode button! Of course!

      It looks like you've done quite a nice job yourself! Where i live (Greece), people hide their so called "Secrets" from their discoveries. Not to accuse them as they make a living from this discovery. But that is the main reason i am now on the net. I believe that there is not actually a real secret. What someone has done, someone else can do it better. The difficult thing (that could be characterized as a secret) is to thing of a problem rather than finding the solution.

      Anyway i will consider averaging the 3 LSBs. Now that i think of it again, i think you are right. Although with this cheap caliper such an accuracy would be pointless, it has to be done for the sake of the experiment. I am planning to make a PC interface or a remote LCD display.


  • At 12 February 2010, 19:31:14 user Philip Freidin wrote:   [reply @ Philip Freidin]
    • Hi Kammenos,

      Notation I will use: For a 24 bit number, the least significant bit
      (LSB) is 2^0 , and the most significant bit (MSB) is 2^23

      For point 1: I agree that the 3 LSBs are noisy, but they do have value.
      For example, if the three LSBs (2^2, 2^1, 2^0) are toggling between
      111 and 000, then the 2^3 bit is also changing as a by-product of the
      noise in the 3 LSBs. Noisy data can be improved by the square root of the number of samples that are averaged. (from DSP theory, for random noise)

      For example, if you average 4 measurements (add four 24 bit numbers, and then divide by 4 (down shift by 2) the new number will be twice
      as accurate as before. In this case the 2^2 bit (of the average)
      will be less noisy than the separate measurements. This is just
      normal DSP type signal processing, not specific to your caliper data.

      The reason the 3 LSBs are noisy, is that the measurement process is
      noisy.


      For point 2: By weight of bit, I am referring to how you interpret the binary data. For example, the binary number 1100 has bit weights of 8, 4, 2, 1, giving a decimal value of 12. For the data from the caliper, the LSB has a weight of 1/20480 inches, the next bit is 1/10240 inches, etc for each bit being a weight of double the bit to the right. Just normal binary interpretation, with a conversion factor to a physical quantity (distance).

      I just collected some data from one of my Chinese calipers. I have seen several different data formats beyond the two you have seen. My current caliper outputs 2 x 24 bits, absolute then relative, at 76 KHz. Crazy stuff is the relative data (second set of 24 bits) are all inverted.

      Here is the data, with the caliper reading 6.0000 inches
      Data sampled on clock falling edge.

      Data is received LSB first: 000111111111100001111111
      Re-arrange as MSB on left: 111111100001111111111000
      Invert all bits: 000000011110000000000111
      Show as HEX: 0 1 E 0 0 7
      Convert to decimal: 122887
      Divide by 20480: 6.00034 inches

      Caliper only shows 0 or 5 in 4th decimal place, so this dislays
      on caliper as 6.0000

      Here is some confirming info:

      http://www.shumatech.com/support/chinese_scales.htm

      And here's something I wrote 5 years ago:

      http://www.fliptronics.com/tip0006.html


  • At 12 February 2010, 17:33:41 user Kammenos wrote:   [reply @ Kammenos]
    • Hello Philip,
      For point 1: I am not quite sure if these bits really mean something. The resulting number is accurate (except this 1.006 thing) w/o reading these bits.

      For point 2: What do you mean by "weight of bits"? And also, for example i measured 100mm (3.937 inch) and got the result from the port 100.6mm (3.961 inch). How did you came to this 1/20480?


  • At 12 February 2010, 17:06:58 user Philip Freidin wrote:   [reply @ Philip Freidin]
    • Nice article. With regard to the accuracy issue in the last section,
      you may want to try the following:

      1) Don't throw away the LSBs, instead average the readings to reduce
      the noisyness.

      2) Your article didn't indicate how you are interpreting the weight
      of the bits. I believe the units are 1/20480 of an inch.
      i.e. when the caliper is measuring 2 inches, the transmitted value
      is 40960. Maybe this accounts for the error you are seeing.


     

      Name

      Email (shall not be published)

      Website

    Notify me of new posts via email


    Write your comments below:

          






    delicious
    digg
    reddit this Reddit this
    Faves

    Search PCB Heaven


     HOT in heaven!



    PCB Heaven chirps on Follow me on Twitter

    TAGS cloud

    Protocol  How It Works  How To  In The Chopshop  Hack  Experiment  Reverse-Engineering 



    NEW in heaven!



    New Calculus: Common Base transistor amplifier - Design Calculator

    Random Circuits!
     Automated Light Controller with adjustable Sensitivity and Hysteresis
     LCD PIC Clock with the Maxim DS1307 RTC



     Home     Contact     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Tech-News     RSS   

    Site design: Giorgos Lazaridis
    © Copyright 2008
    Please read the Terms of services and the Privacy policy