Wireless CNC Touch Probe

2,543

21

20

Introduction: Wireless CNC Touch Probe

Wireless conversion of Tormach passive touch probe using ATtiny85 generated Infrared beams

After being a user of the Tormach passive touch probe for several months on my PCNC 440 mill, I became used to its cable and found it no big deal- until I was recently able to outfit the mill with an Automatic Tool Changer. At that point I wanted to store the probe in the ATC where it could be automatically loaded and unloaded for use in probing cycles during CNC operations. That won't work with a cable. There is a commercially available kit for conversion of the Tormach passive probe to wireless operation that I considered which seemed to be very robust and full featured but it was a bit of overkill for my needs so I decided to do a basic DIY version.

Video demo/build overview:

https://youtu.be/wkzOw1YkcPI

I chose an IR link rather than RF to simplify the implementation of a reliable short range connection. The design uses a 38KHz IR transmitter with the signal sourced by an Arduino compatible attiny85 pulsing high power IR LEDs using a transistor driver. The IR is received by a 38KHz IR receiver chip which uses a transistor to drive a reed relay operating in the Normally Closed mode used by Tormach passive probes. The NC relay contacts connect to the accessory input port of the mill.

The IR transmitter and receiver circuits are each powered by their own Lipo battery and associated USB Lipo charger module. The receiver circuit needs 5V, so its power circuit also includes a 5V boost regulator. The probe circuit has low standby power (.09ma) and wakes-up only on probe opening which should give very long probe battery life between recharges from 600maH Lipo probe battery. The IR Receiver standby of about .4ma should similarly provide long life between charges from 2500maH 18650 cell.


SHOW LESS



The schematics and 3D model (including Fusion 360 and STL format files) are found here:

https://grabcad.com/library/wireless-tormach-cnc-touch-probe-1

The ATtiny85 code for this project is found here:

https://github.com/wolfend/WirelessIRProbe



SHOW LESS

Supplies

Tormach Passive probe

Parts as shown in schematic which includes both transmitter and receiver circuit boards.

Lipo batteries for Xmtr and Rcvr as shown in individual steps

Lipo battery USB charger/manager modules for Xmtr and Rcvr (TP4056)

3D printed case

ATtiny85 programming environment (Arduino IDE + programmer)

5-pin DIN male connector/cable to plug into mill accessory port- you could use the length of cable that you cut off the probe, but likely are better off waiting to cut the probe cable until testing is done. I purchased a MIDI cable from Amazon that has the same connector on each end and cut it in half.

Step 1: Probe IR Transmitter

Build ATtiny85 circuit board as shown in schematic. Recommend using header pins for both LED and probe connections (not just LED connections like my prototype).

Setup your Arduino environment for ATTiny using one of many online guides. Use the SpenceKonde ATTiny core to do this as described in the guides. Program ATtiny85 using code from Github using your favorite method. You can use an Arduino to do this but I use one of the sparkfun PGM-11801 USB programming boards as shown in the photo. Prior to programming the chip the first time, the fuses for the ATtiny should be configured as shown in the screenshot of the menu drop down from the Arduino IDE by selecting "burn bootloader" from the menu. Plug the programmed ATtiny into socket on board. Verify the board works as expected and recommend measuring the 38KHz nominal output that it produces using a frequency counter or oscilloscope to verify that the frequency is within one kHz or so from the nominal 38KHz.

3D print case and lid. I used 3mm layers with supports under the portions where the screws thread into. Use hot glue to install IR LEDs.

Wire the ATtiny board, the Lipo battery, and battery charger board as in the xmtr power schematic and install in case. Use hot glue to secure components as necessary. Be sure to use a connection between battery and rest of circuit that can be disconnected easily during maintenance. Wire the LEDs to their connector on the circuit board. They share a common Vcc and have individual current limiting resistors.

Step 2: Probe IR Receiver

Build receiver circuit board per schematic. This board is connected to the receiver battery box using a cable made from a length of CAT5 cable. The board and connection to the cable is sheathed in transparent heat shrink tubing, not including the IR receiver chip. The leads of that chip were sealed with clear silicone. The entire assembly was affixed to the top of the inside of the mill enclosure, roughly facing the spindle, using zip ties.

Step 3: Receiver Battery Box and Cables

Wire receiver battery box per schematic and install in box. I used a 3D printed 18650 battery holder from Thingiverse. The +5V output of the battery box feeds the receiver circuit board via its cable. The 5-pin DIN cable for the mill accessory input port is connected to the wires in the cable coming from the relay contacts on the receiver board.

Be the First to Share

    Recommendations

    • First Time Author Contest

      First Time Author Contest
    • Backyard Contest

      Backyard Contest
    • Stone Concrete Cement Contest

      Stone Concrete Cement Contest

    20 Comments

    0
    ygribel
    ygribel

    7 weeks ago

    Hi,
    is the any reason you are using the battery/battery management for the Receiver?
    Can you just use 5V from Accessory Port?
    ( on my PCNC770 DIN5 Accessory socket has 5V on Pin1 and 12V on Pin3,
    I'm not sure about PCNC440)
    Thanks,
    Yuri

    0
    wolfend
    wolfend

    Reply 7 weeks ago

    Hi, unfortunately, the PCNC440 does not have this voltage on the DIN connector, but I would definitely try using this power source if I had it available. Just make sure it can supply enough current and test thoroughly. There is nothing special about the way I chose to implement the receiver power supply, any solid 5V supply should do and a battery should not be strictly necessary; I was just trying to make sure I did not introduce power supply noise into the system. Good luck!

    0
    ygribel
    ygribel

    Reply 7 weeks ago

    Hi,
    thanks for fast response.
    More questions if I can?
    I'm not really experienced with Arduino IDE and ATTiny85 processor,
    (but made the few projects with Parallax BS1 and BS2 in the past)
    So, I've bought Sparkfun programmer like yours, installed IDE v1.8.19 and
    SW related for the programmer. Also bought the few blank ATTINY85 20U.
    I programmed two IC's with your code, but the frequency generated by transmitter is much lower than 38kHZ (around 4.7kHZ) Than I found one ATTINY85 20PU at home and program it with the same code and it works like a charm!
    (I'm not sure if it's 20PU vs 20U difference and also not sure if home-chip was blank before programming!)
    The question: you've mentioned we need to burn bootloader before programming?
    My understanding was for PGM-11801 we don't need the bootloader to upload the program?
    Or I missing something.
    Thanks,
    Yuri
    BTW: let me say again: wonderful project and nice job!

    0
    wolfend
    wolfend

    Reply 7 weeks ago

    First, thanks for the kind words, I hope I can help.
    The step in the instructions you are referring to says:
    Prior to programming the chip the first time, the fuses for the ATtiny should be configured as shown in the screenshot of the menu drop down from the Arduino IDE by selecting "burn bootloader" from the menu.
    Even though this step uses the "burn bootloader" item in the menu, what it actually does in this usage is to configure the internal "fuses" of the attiny chip which configure various aspects of its operation, including things like clock rate. If you look at the screenshot, it shows the various settings needed (e.g., 8MHz internal clock) for this project. I suspect if you take the chip of yours that did not work and perform this step, it will also produce the correct output.

    0
    ygribel
    ygribel

    Reply 7 weeks ago

    My understanding is:
    Step1: I need to add SpenceKonde ATTiny core from GITHUB to IDE (because my menu looks different, I installed only atttiny required for PGM-11801 )
    Step2: Burn Bootloader (where is the code for Bootloader coming from?)
    Step3: Upload you code
    Please correct me if I'm wrong
    Thank you

    0
    wolfend
    wolfend

    Reply 6 weeks ago

    1) Follow the instructions here to add the Spence Konde core to your Arduino IDE:
    https://github.com/SpenceKonde/ATTinyCore/blob/mas...
    2) I suggest restarting the Arduino IDE at this point
    3) The Arduino IDE must now be configured for the board type we are using (attiny85): Click on the "Tools menu" item and select the "Board" item in that menu (which will show whatever board type the IDE is currently configured for). In the submenu that appears, you should see one item that is "ATTinyCore", which will only be there if you have successfully completed step 1 above. Select that item and another submenu will open with a long list of boards. Select the "ATTiny25/45/85 No bootloader" item.
    4) At this point, your Tools menu should look like the screenshot in step 1 of this Instructable. Go through each of the menu items in the "Tools" menu, starting with "chip" and going down through "BOD..." and configure them to match the settings shown in the screenshot.
    5) Select the programmer type from the "Tools" menu. USBtinyISP...SLOW..." for the sparkfun programmer.
    6)Select the "Burn Bootloader" item in the tools menu. As previously noted, confusingly, this step configures the chip fuses, it does not burn a bootloader.
    7) Now you should be able to upload the code to the chip using the normal Arduino sketch upload process and the fuses should be configured to give the correct output frequency.


    0
    ygribel
    ygribel

    Reply 6 weeks ago

    Great help, thanks!
    The steps you described are only for the new blank chip?
    If I need to add small changes to your code later (using the same chip) I don't need to use "Burn Bootloader" anymore?
    Should I also change in this case any of the parameters like "ATTiny25/45/85 No bootloader" or any others from Tools/Board menu?

    0
    wolfend
    wolfend

    Reply 6 weeks ago

    The process of configuring the fuses with the "Burn Bootloader" command typically only needs to be done once for a chip (such as when new) and would not have to be repeated if you were to make changes to the code and wanted to upload the new version. Once configured correctly, the fuse parameters should not have to be changed again. For the chips you have that are not outputting the correct frequency, you should be able to perform this process to change their fuse configurations (which I am guessing are not correct) with this process to get them working correctly.

    0
    ygribel
    ygribel

    Reply 6 weeks ago

    Great,
    I'm going to try now, but
    should I change programmer option from "...SLOW..." to "...FAST..."
    after Burn Bootloader before Uploading the code?
    or for reprogramming the chip which already went thru Burn Bootloader operation?

    0
    wolfend
    wolfend

    Reply 6 weeks ago

    I left it in the SLOW mode, but you can give it a try if you like. Even SLOW, the sketch loads very quickly.

    0
    ygribel
    ygribel

    Reply 6 weeks ago

    Done! And both IC's have the proper timing.
    You've been correct about the Bootloader!
    Two more questions:
    1. I didn't understand what direction the Receiver IC is facing? (is it completely inside of 440 electric cabinet?)
    2. How robust is the design? Have you ever broke the probe's pin while working with it?

    0
    wolfend
    wolfend

    Reply 6 weeks ago

    1) You need to ensure that the IR receiver sensor is pointing toward and is in line of sight of one or more of the IR LEDs in the probe. My receiver board with the IR sensor is mounted inside the top of the chip enclosure just inside the doors and angled down to generally point at the probe in the spindle. The picture shows how the board is secured by cable ties with the picture being taken from inside the mill enclosure, looking out. When the probe's IR LEDs light up, this sensor needs to be able to "see" the IR light they produce and needs to be positioned appropriately to do so.
    2) I believe that my current implementation of this design is robust, and I use it regularly with precautions implemented via appropriate operational procedures (like regular charging and checking it before each use). I, of course, take no responsibility for anyone implementing this design and any issues they may have or damages to equipment that might occur through its use. And that could happen. I did break a probe tip at one point when using this probe, but it was not the fault of the design but rather of my construction carelessness which ultimately led to a broken power connection. I did a bit of rework to bolster the mechanical integrity of some of the wiring and have not had issues since. The ATC of a PCNC440 is a pretty harsh mechanical shock and vibe environment for an electronics device and appropriate construction care must be taken.
    Ultimately, you must perform enough testing of any device like this to decide for yourself whether your implementation is reliable before deciding to trust the motion of your machine to it and even then you likely will want to hover over the estop every time you use it for quite some time. But it is a very nice feature to have once it proves itself.

    0
    ygribel
    ygribel

    Reply 6 weeks ago

    Thanks for the help, appreciate it!
    Could you make a picture of the Receiver IC (TSSP) from the Transmitter point?
    I also wanted to ask couple of questions about Fusion' probing and microARC,
    but don't want to overload this thread. I didn't find your email on you Channel/ About tab...

    0
    SubramanyamN
    SubramanyamN

    Question 7 months ago on Step 3

    Thanks for showcasing the wonderful project and the helpful instructable. What latency do you get with the IR setup? I guess that decides the accuracy of the probe.

    0
    wolfend
    wolfend

    Answer 6 months ago

    Thanks for the kind words. The measured latency from probe switch opening to relay contact opening is 280-320 usec (microseconds). I suspect it would be tough to get much less with any easy DIY wireless solution. In my experience, the difficulty of adjusting the probe for concentricity and the ability of the probe to hold that adjustment over a period of use seems to be more of a factor on its accuracy than anything else.

    0
    rey8801
    rey8801

    9 months ago on Introduction

    Hi! Thanks a lot for putting this out. I am ordering the parts and I would have few questions/suggestions:
    1- Maybe post a BOM at the beginning. That would help a lot with components sourcing.
    2- In the Transmitter schematic, I see only 4 x 39Ohm resistors but in the picture you have 5 resistors. Which one is correct?
    3- When the probe is in sleep mode, do we need to simulate a contact on the tip to wake it up or the processor is fast enough that will sense the first contact while probing (without breaking the tip)?
    4- In the Receiver schematic:
    a- Does "Accessory port" mean the INPUT and GND signal from the Breakout board (CNC control board)?
    b- Along the +5V line there is a second connection after the 1K resistor. Why is that?
    c- HE721C0510 reed relay is bit difficult to find for me. Do you think is possible to replace it with another 5V reed relay? For instance DIA050000 (https://www.aliexpress.com/item/1005002300043469.h...
    If not, what are the limiting factor that made you choose HE721C0510?
    d- In the battery box I see an additional small board, looks like a voltage regulator. I do not see it in the schematic. Reason for that?

    Thanks! 😊
    Best,
    Alessio


    EDIT: I have now found the extra hand written drawing for question 3d.

    0
    wolfend
    wolfend

    Reply 9 months ago

    Hi, thanks for your interest. I will try to help. I also should caution the obvious, that if something goes wrong in the implementation of this project, bad things can happen and damage can occur. I highly advise that anyone building this test their build very thoroughly and I can't be held responsible if problems occur. That said:
    1- yes a BOM would be good, just a matter of not having time
    2- Build the boards according to the schematic, which correctly documents the design. This applies to both Xmtr and Rcvr boards. The boards in the pictures may have parts that were not used in the final design. In the case of the Xmtr, I tried an external pull-up resistor on the probe input in an attempt to further reduce the standby current the circuit consumes (I found that the standby current consumption is dominated by the current dissipated in this pull-up). I decided not to do that, and the code enables the internal pull-up, but the unused resistor remains on the board. I think the Rcvr board in the picture also has an extra resistor that is not needed.
    3- the probe wakes up and goes back to sleep every single time it touches and releases. It does this very quickly. No pre-touch is needed (except maybe as a good practice test at the beginning of a session to make sure everything is working as expected).
    4a- Accessory port is the name Tormach uses for the input connector on the mill where the touch probe or ETS is plugged in. This port on the mill expects, and this design provides, Normally Closed switch contacts that open when the probe touches.
    4b- don't understand this question. As per schematic, +5V from battery box connects to IR receiver, relay, and LED current limiting resistor.
    4c- I was looking for a 5V relay that provided NC contact outputs and included an internal snubber diode. Other relays should work and you could add your own snubber diode if the relay does not include one. I purchased from DigiKey.

    0
    rey8801
    rey8801

    Reply 9 months ago

    Hi!
    Thanks for the reply. That helped a lot.
    Regarding the question number 4b, I am referring to the 5V connection just before the reed relay (picture attached). I do not understand why you need a second 5V there when it is already coming from the 5V VCC line.

    Separate question. I was wondering since the circuit is NC, does it mean that inside the probe there is a constant current flowing also when in sleep mode? Because that would accelerate contact oxidation, which is the main cause of precision loss over time for a touch probe.

    Thank you.
    Ale

    Capture.PNG
    0
    wolfend
    wolfend

    Reply 9 months ago

    That symbol is not intended to represent a second connection to 5V. You are correct that the only 5V comes from the battery box. I just drew it that way to designate to the tool that that particular net was +5V. Sorry for confusion.

    Re. your second question, you are correct about the fact that a current is always flowing through an NC probe. Even in a wired probe, this would be the case as long as the probe is connected to the controller and the controller is on. In the design that I show here, using the internal ATtiny85 pull-up, I have measured this current to be 0.09ma. It seems to me that any wireless NC probe design that does not require any sort of power switch and that is always ready to go will have some current flowing through the probe, I guess it's just a matter of how much.

    0
    rey8801
    rey8801

    Reply 9 months ago

    Thanks for the clarification!
    Now I got why you specify the extra 5V point there.

    Yes, I also believe all the wireless probes have a constant current flow. Your current is indeed rather low, but i have read multiple times that constant current flow makes the contacts go bad rather quickly (or at least affect the accuracy). I guess I will then add a tiny on/off switch to the battery just to avoid a constant flow even when I am not at the machine. Then turn it on for the day I use it.