Bluetooth Wireless Interface for Mitutoyo Calipers and Indicators

4,892

23

1

There are millions of Mitutoyo Digimatic calipers, micrometers, indicators and other devices in the world today. Many people like me use those devices to gather data directly into a PC. This eliminates having to log and type in sometimes hundreds of values, but also presents some problems related to having a laptop in the shop where laptops may get dropped or otherwise damaged. This is especially true if the measurements are taken on large parts or in situations where the standard Mitutoyo data cable just isn't long enough.

A few years ago I built a similar device based on HC-05 Bluetooth modules and some Arduino microcontroller boards that would allow me to leave the laptop safe on a table and roam up to 50 feet taking measurements. This device worked great but had several issues. There was no indication of when the transmitter battery was fully charged, no indication of bluetooth connection status, and indication of successful data transmission. It also was big and clunky and literally looked like a science project! Even with these limitations, he other guys in the shop preferred using it over the Mitutoyo USB data cable.

This project overcomes those limitations of the old device, adds more features and is a bit more professional all for less than $100.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: How It Works:

The interface is comprised of two parts, a transmitter and a receiver. Connect the transmitter to the gauge using the data cable permanently attached to it and connect the receiver to a PC using a micro USB data cable.

On the transmitter, sliding the switch towards the cable end turns it on. On the receiver end the blue LED is initially flashing indicating no connection, when a connection is made the LED will stop flashing and be on continuously. The transmitter and receiver are now connected.

The transmitter (bottom device in the photo) connects to the gauge and reads the raw Mitutoyo data stream every time the "data" button is pressed. Then it formats the data using information in the data stream such as decimal point location, sign and units. Then it constructs an ASCII string from this data and sends it through the HM-10 Bluetooth module in the transmitter to the HM-10 on the receiver side.

On the receiver (top device in the photo) the HM-10 sends the ASCII characters sent from the transmitting HM-10 comprising the measurement to the Arduino Pro Micro which then sends them through the USB cable to the PC. It emulates a keyboard to do this so the data is then injected into the open application, in my case its Excel. The data is followed by characters that cause the cursor to drop to the next line. A nice thing about this is that you can change this to do whatever you would like if you need to enter data into custom software. The receiver then sends a request to the HM-10 on the transmitter to flash the blue side of the LED to indicate to the operator that data was received successfully. The receiver module also strips out characters from the incoming data stream associated with remote control of the HM-10 on the receiver.

Charging the transmitter is done with a micro USB charge or cable plugged into the USB socket on the transmitter, the LED on the receiver will glow red while charging and turn off when charging is complete.

There are other functions covered later as to processing that can be done to assure that all values are in metric or standard units or to warn if you've accidentally hit the +/- button making all the measurements negative. You can even check the transmitter battery voltage.

Step 2: Preparation:

In addition to the materials mentioned in this Instructable, there are a few other items to configure and program the HM-10 Bluetooth modules and microcontrollers. You will need a USB to TTL UART serial adapter to configure the Bluetooth modules, an Arduino to serve as the programmer for the ATTiny85 microcontroller (or similar programmer that can work with the Arduino IDE) and of course, jumper wires to do the configuration and programming. The ATTiny85 in this Instructable was programmed using an Arduino Nano clone and a 10 uf electrolytic capacitor connected between the RST and GND pins. Other hardware will work if you have it but you may have to research the changes in procedure needed for that. This Instructable assumes that you are familiar with the Arduino IDE and are somewhat comfortable using it, Google and some patience are needed otherwise.

Before configuring the Bluetooth modules it would be a good idea to read Martyn Currey's BLE tutorial at http://www.martyncurrey.com/hm-10-bluetooth-4ble-modules/ This article contains information as to how to tell the real ones from the fakes, set up pairing, roles, modes and firmware update information for the HM-10 modules used in this Instructable.

Beware of fake HM-10s on the market. The link in the BOM provided in this Instructable is to real ones (or at least ones with real firmware on them when I bought them last fall). Getting fake ones isn't a deal breaker but if you end up with fakes it takes a few more steps to get them working as needed for Instructable as they have to have the real firmware before they can be configured properly. If you do get a fake you can flash the real firmware onto it by using the following tutorial https://www.youtube.com/watch?v=ez3491-v8Og There are other tutorials on how to flash HM-10 firmware onto CC2541 modules (fakes). The photos in this Instructable show fake modules that I had to flash with HM-10 firmware while building this interface (this is the 3rd one I've built). Real ones are about $6 per pair and fake ones are $3 per pair, its worth the extra $3 to get the real ones. I strongly encourage you to buy real HM-10 modules!

A couple of definitions not included by default in the Arduino IDE are needed for the Sparkfun Arduino Pro Micro and ATTiny85 microcontroller used in this Instructable.

You can add support for these parts to the Arduino IDE by adding the following links to your boards manager.

For the ATTiny85:

https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json

For the Sparkfun Arduino Pro Micro:

https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json

Separate these two entries with a comma as shown in the picture.

Also you will need a special small footprint serial library for the transmitter module:

SendOnlySoftwareSerial: https://github.com/nickgammon/SendOnlySoftwareSerial

Step 3: THE BOARD

The board that I designed for this Instructable can be ordered from JLCPCB or some other site such as Seedstudio ect if you use the gerber files attached to this Instructable. I designed it using easyeda.com. Here is a link to the board at easyeda. https://easyeda.com/MrFixIt87/mitutoyo-bluematic-spc-smt-mcp73831 If there is enough interest, I may have a few PCBs made and sell them cheap on ebay.

This board must be cut into two separate boards (one for the transmitter and one for the receiver). The cuts will follow the white outlines at the center of the PCB in the image above and one corner of the transmitter board. These cuts will follow the red lines drawn on the picture of the PCB above. Be careful when cutting the boards, particularly in the notches at the corners of the transmitter board. These cuts get very close to traces on the board. A set of fine files comes in handy here.

Most of the components can be ordered from Digi-Key or Mouser etc, Digi-Key part numbers are included in the BOM for items that they have. Some of the items I bought on eBay, Amazon or AliExpress. I have included links to items on those sites as needed in the BOM.

The BOM.pdf file is the easiest to read and the URLs are clickable links.

Step 4: HM-10 Module Configuration, Arduino Pro Micro Programming

It is a good idea to obtain the HM-10 modules before anything else and make sure you get them properly configured and working as a pair as there is a lot of fake ones on the market and itrequires a couple of extra steps to install the real firmware on the fakes. Only the real HM-10 firmware allows the receiver to remotely flash the LED on the transmitter when the "data" button is pressed. Don't upgrade the firmware beyond V6.05.

Martyn Currey's tutorial very handy for this. If you follow it, you will have no problems. Also be sure to get bare castellated modules like the one on the right side in the picture for this step. Solder them to the PCB if needed to aid in attaching temporary wires for configuration. Do not solder any other components onto either PCB until you have a pair of working BLE modules. Only pins 1,2,12-15,21-25 need to be soldered.

On the Tx PCB the HM-10 will need the following configuration:

Pairing: pair to other HM-10 (use a serial monitor to test for data flow between modules when connected)

Role: peripheral

Mode: 2

On the Rx PCB the HM-10 will need the following configuration:

Pairing: Must pair with peripheral HM-10 above

Role: central

Mode: (none, only peripheral has a mode)

Program the Arduino pro micro with the sketch named Mitutoyo_Keyboard... above. Make sure you choose the 3.3V 8MHz version of the Arduino Pro micro in the board manager of the Arduino IDE when uploading to the board. Also make sure you have all of the referenced libraries installed. I used the Sparkfun version of the pro micro (red) but clones are available on ebay which will also work, just be sure you get a 3.3V 8MHz board with the Atmel 32U4 microcontroller and NOT a ATMega328P. Also get a blue one that looks like the red Sparkfun one in this Instructable and not a black one, the black ones are too wide to fit the hole pattern on the PCB).

Step 5: Component Assembly, Fitting the PCBs Into Enclosures

For the Tx PCB solder the other components onto the PCB. Its a good idea to solder the USB connector on the BLE Tx board first before the other components in this area. It might be a good idea solder the ICSP header onto the BLE Tx board last. Note how the leads on the bi-color LED are "folded", originally the idea was to have this go through the side of the enclosure, but I later decided to use a translucent enclosure so that the LED wouldn't have to be wrangled though a hole while assembling. It also adds a nice effect when the blue side of the LED flashes after a measurement has been transmitted. For the bi-color LED the shortest lead is blue, center is common anode.

At this time measure the location of the switch, USB connector and make holes in the enclosure for these items. I have found that its best to feed the data cable out of the left side (as pictured) of the box (0.25" hole centered on the width and height of the enclosure). Carefully test fit the PCB making adjustments to the size of the holes until the switch moves freely and the USB connector fits into the opening. Install 2 #2 screws to hold the PCB in place (however if the fit is snug the PCB will be captive anyway and really won't need screws).

On the Rx PCB solder the Arduino pro micro onto the PCB using the two 7 pin headers. Adjust the opening on the USB connector side of the Rx PCB enclosure to allow the PCB to sit firmly against the inside of the enclosure. Note in the picture of this assembly that the LED extends away from the board. This is to firmly locate the PCB within the box and works quite well actually with the smaller grommet. Carefully adjust the lead length of the LED so that a snug fit is obtained after assembly. The PCB is marked as to red and blue, the shorter lead on the LED is the blue lead, center is common anode. Snap the cover on the Rx enclosure, its done.

Step 6: Program the ATTiny85, Solder in the Data Cable Connections, Connect Battery

Now its time to program the ATTiny85. I used an Arduino Nano clone running the Arduino ISP example sketch. The Nano requires a 10uf electrolytic capacitor installed between GND and RST (- lead to GND) for programming. The pin connection details are in the Arduino ISP sketch. The ICSP header on the PCB in this project has the pin names stenciled on so the connections should be straight forward.

Make sure that you have ATTiny85, 8kB flash and Internal 8MHz clock options selected in the board manager when uploading to the ATTiny85 as shown in the picture.

Once this is done, install the large grommet. Cut the data cable about 8"-10" from the instrument end and remove the outer jacket revealing a couple of inches of the interior wires. Leave the shielding strands about 1/2" from the striped cover as shown. I soldered the shielding of the data cable to the switch to give it strength against pullout in use although there also is a large hole in the PCB in this are for that if you want to go that route. Solder the individual wires to the PCB as shown, the data wire colors are silk-screened on the PCB at the appropriate holes.

Connect the battery as shown, be careful about polarity as reversing it will burn up the LiPo charger/manager chip on PCB in short order (don't ask how I know...)

Step 7: Test, Use, Menu of Advanced Functions

Now install the cover. You're done!

All 4 of the units I've built so far have velcro to attach the transmitter to the instrument and the receiver to the top of the laptop lid. In practice this works very well. Install the velcro fuzzy (loop) side to the top of the laptop lid, the rough (hook) side to the case of the receiver. Install the fuzzy (loop) side to the case of the transmitter and the rough (hook) side to the back of the caliper or indicator. Doing it this way allows you to store the transmitter and receiver together when not in use and also has the soft fuzzy side on your laptop lid.

Test the battery charging by connecting a micro USB cable to the USB connector on the Tx module, if the battery isn't fully charged the LED should light up red. Sometimes the LiPo is so close to fully charged that the charger IC will not charge it so don't worry if the LED don't light up initially.

Now you can connect the data cable to a caliper or indicator (anything that takes the type of cable that you used).

Connect the Rx end to a micro USB data cable (must be a data cable and not just a charge cable), and into a USB port on your PC. It may have to install the driver that allows it to act as a keyboard but it should be automatic. Turn the Tx module on using the switch. The LED on the Rx module should be flashing for a few seconds then stay on when a connection is established.

Test by pressing the data button on the cable connecting the caliper to the transmitter module. You should see the measurement on the PC screen. The Arduino Pro Micro works as a HID keyboard and will insert incoming measurements directly wherever the cursor is on your PC.

The programming in the transmitter module allows for a options. You can access this menu by measuring 0 five times consecutively. Once in menu mode, to select a menu option measure a negative value beginning with the option number in the menu, for example to automatically convert all measurements to be metric, measure a negative value with a 1 as the first non-zero digit. (-1.xx mm or -0.1 inches for example). To go back to normal mode measure 0 five times then measure a negative value that starts with a 3 as the first non-zero digit). Its programmed this way to avoid accidentally configuring options. If in menu mode measuring 0 again or any positive value automatically cancels menu mode and returns to normal mode.

Menu options are:

  1. Auto-convert all measurements to metric units (if needed)
  2. Auto-convert all measurements to standard units (if needed)
  3. Cancel auto-conversion of units
  4. Reject negative measurements (prints warning message)
  5. Cancel rejection of negative measurements
  6. Measure and print transmitter battery voltage (not documented in menu)

When entering the menu mode any options in effect are printed out at the top as a reminder of options in effect. All options are stored in EEPROM and are retained after turning the unit off or battery depletion. The battery life for the units that I have built is about 45 hours of continuous use and recharging takes about 3 hours from fully ran down.

A non-documented feature is to enter menu mode (0 five times) then measure a negative value starting with 6 as the first non-zero digit, that causes it to measure and print out the current battery voltage as shown in the attached video.

My experience with the 3 units that I have built is that range is up to approx 50 feet in an open shop environment.

Step 8: Final Thoughts - Potential Modifications / New Features / Hackability

Although at this point you will have a perfectly usable interface that can be used with millions of devices in the world, it is by no means finished in the sense that nothing further can be done. One of the sweet things about taking this approach rather than buying the Mitutoyo U-Wave is that now you have a device that can be customized in many ways.

You could use other Mitutoyo cables to connect to the transmitter instead of the one that I used for this Instructable if your device uses a different cable. The colors of the internal wires and signals should be the same on all Mitutoyo cables. Just keep in mind that the cable would need a data button to trigger measurement or some other means would have be devised to trigger measurement. A request for measurement can be sent to the gauge by briefly connecting the green/white wire pair to ground (the blue wire in the gauge cable). This could be done by installing a switch or 1/8" audio jack in the transmitter box connected to those wires and connecting an external switch through it. If you have an indicator mounted in a fixture or need to not have to touch the gauge the audio jack approach would be ideal.

If all you need is serial data (RS232 TTL, SPI, I2C etc) that can be accomplished by code changes on the receiver and connecting directly to the pins on the Pro Micro that you choose to use for outputting the data.

Remote Control: Another interesting possibility would be to connect a transistor between the green/white pair and the blue ground from the gauge with the gate connected to the HM-10 pin 26. Then on the receiver end, connect a 38kHz IR remote detector with the output pin to the receiver Arduino Pro Micro pin 7. then modify the code on this microcontroller to look for specific commands from any infrared remote and then trigger the transistor installed in the transmitter via a AT+PI031 / AT+PI030 remote call similar to the way it flashes the blue LED on the transmitter now. This would give the ability to trigger readings from a remote location which in certain circumstances could be very handy. I may design another PCB with this functionality built in.

I'm sure there are many other features that are possible, please comment with suggestions, thoughts and ideas.

Now there is a commercial wireless data communication device available from Mitutoyo, but when I checked the price of that was about $800 for the system. The total cost of building this device is about $100 and can be less, especially if you use a Arduino Pro Micro and or have a Mitutoyo data cable lying around to use to connect to the gauge as those are two of the most spendy items in the BOM. I seriously doubt that the Mitutoyo U-Wave is hackable to add features like this one is.

I hope you enjoyed this Instructable, its my first one!

Please leave comments, questions, feedback, ideas and suggestions! If you like it, please vote for it in the PCB contest! Thanks!!!!

PCB Contest

Runner Up in the
PCB Contest

Be the First to Share

    Recommendations

    • CNC Contest

      CNC Contest
    • Make it Move

      Make it Move
    • Teacher Contest

      Teacher Contest

    Discussions

    0
    None
    DIY Hacks and How Tos

    8 months ago

    Great first Instructable. You should enter this into one of the contests that are currently running on the site.