584,854 active members*
4,388 visitors online*
Register for free
Login
IndustryArena Forum > MetalWorking Machines > Benchtop Machines > NO Touch Plate and NC Touch Probe switch inversion using an Arduino UNO
Results 1 to 13 of 13
  1. #1
    Join Date
    Jan 2013
    Posts
    630

    NO Touch Plate and NC Touch Probe switch inversion using an Arduino UNO

    Just thought since I have learned so much from this site that I would give a little back. With the help of one of our EE/Software guys at work we came up with this simple setup to handle the switching and signaling to Mach 3 for both the Probe and Plates.

    Simply using 4 of the digital input/output pins a ground pin we can achieve dealing with the NO and NC switches on the same input for MACH.

    Here is the code that gets loaded to the Arduino.

    /*
    Switch Inversion

    This example code is in the public domain.
    */

    // Pin 13 has an LED connected on most Arduino boards.

    int ledPIN = 13; //connected to LED
    int ProbePIN = 2; //connected to touch probe
    int mPlatePIN = 3; //connected to mobile touch plate
    int fPlatePIN = 4; //connected to fixed touch plate
    int tMillPIN = 12; //output connected to G540
    int led; //output variable
    int Probe; //output variable
    int mPlate; //input variable for mobile touch plate
    int fPlate; //input variable for fixed touch plate
    int tMill; //variable for output to G540


    // the setup routine runs once when you press reset:
    void setup() {
    // initialize the digital pins as an input/output.
    pinMode(ledPIN, OUTPUT);
    pinMode(ProbePIN, INPUT_PULLUP);
    pinMode(mPlatePIN, INPUT_PULLUP);
    pinMode(fPlatePIN, INPUT_PULLUP);
    pinMode(tMillPIN, OUTPUT);
    }


    // the loop routine runs over and over again forever:
    void loop() {
    Probe = digitalRead(ProbePIN);
    mPlate = digitalRead(mPlatePIN);
    fPlate = digitalRead(fPlatePIN);
    if ((Probe == HIGH) || (mPlate == LOW) || (fPlate == LOW))
    {
    tMill = HIGH;
    led = HIGH;
    }
    else
    {
    tMill = LOW;
    led = LOW;
    }
    digitalWrite(tMillPIN,tMill);
    digitalWrite(ledPIN,led);
    delay(1);
    }

    We left the LED connected in place so you can test at the board for operation of the output to Mach without being connected to the MACH PC. When either of the touch plates makes contact with a bit the circuit is closed and pulled high...this causes an active low on pin 12 on the board and light the LED on pin 13.

    When the probes breaks the circuit the input is pulled low and the output is then again sent to pins 12 and 13 giving MACH the active low signal it desires for triggering the probing events.

    The Arduino is a bit of overkill for what it's doing but all the breakout boards I found that would do this were more expensive than the Arduino at 30 bucks.

  2. #2
    Join Date
    Feb 2012
    Posts
    296
    Thanks for the post! I have been thinking about how to do something similar myself and this will help me out a bunch.

    Did you guys consider using a PICAXE?

  3. #3
    Join Date
    Jan 2013
    Posts
    630
    Didn't know about them until you mentioned it. I was looking for something easy to deal with and the Arduino fit the bill...easy to wire...easy to write code for and easy to power.

  4. #4
    Join Date
    Jan 2005
    Posts
    1943
    Couldn't this be done just with a simple relay for 99 cents?

  5. #5
    Join Date
    Jan 2013
    Posts
    630
    According to what I saw in the MSM manual I don't think so or it didn't appear to me to be able to be done that way. They have a diagram for a circuit built around 7406 chip as a solution.

  6. #6
    Join Date
    Jan 2005
    Posts
    1943
    I don't see why the attached would not work.

    Click image for larger version. 

Name:	untitled.jpg 
Views:	1 
Size:	44.6 KB 
ID:	185126

  7. #7
    Join Date
    Nov 2008
    Posts
    164
    I use a simple Axicom D2n for about $0.60
    Just used a shorting 3.5mm jack that cost about $1
    Attachment 185128
    Attachment 185130
    Yes it can be done for super cheap

  8. #8
    Join Date
    Dec 2007
    Posts
    2134
    I must admit I was surprised when I bought a probe a while back, and had a look inside expecting some Schottky circuitry inside to counter bounce and clean up the pulses, etc, but found it was just wires soldered directly to the pcb. But I guess it seems to work well so why complicate it?

    cheers, Ian
    It's rumoured that everytime someone buys a TB6560 based board, an engineer cries!

  9. #9
    Join Date
    Jan 2013
    Posts
    630
    Quote Originally Posted by aarggh View Post
    I must admit I was surprised when I bought a probe a while back, and had a look inside expecting some Schottky circuitry inside to counter bounce and clean up the pulses, etc, but found it was just wires soldered directly to the pcb. But I guess it seems to work well so why complicate it?

    cheers, Ian
    If you don't have switch bounce issues than it works. The Adruino will be useful if switch bounce is a problem.

  10. #10
    Join Date
    Dec 2007
    Posts
    2134
    Quote Originally Posted by Kenny Duval View Post
    If you don't have switch bounce issues than it works. The Adruino will be useful if switch bounce is a problem.
    That's the thing, I would never think to design something like that without de-bounce, and especially, something to clean the pulses up. That's why it surprised me greatly that the probes are such a crude design that still appears to work well.

    cheers, Ian
    It's rumoured that everytime someone buys a TB6560 based board, an engineer cries!

  11. #11
    Join Date
    Feb 2006
    Posts
    7063
    De-bouncing a probe signal will completely screw up timing, and cause inaccurate probe results. With proper design of the probe, no de-bounce is required. The very expensive professional ones have no debouncing.

    Regards,
    Ray L.

  12. #12
    Join Date
    Dec 2007
    Posts
    2134
    Quote Originally Posted by SCzEngrgGroup View Post
    De-bouncing a probe signal will completely screw up timing, and cause inaccurate probe results. With proper design of the probe, no de-bounce is required. The very expensive professional ones have no debouncing.

    Regards,
    Ray L.
    Proper design I fully agree, but what I was talking about was a crude device with springs, ballbearings, and bits of metal soldered to a pcb for contacts. While it falls into the "it works" category, I wouldn't extend "proper design" to it.

    cheers, Ian
    It's rumoured that everytime someone buys a TB6560 based board, an engineer cries!

  13. #13
    Join Date
    Jan 2013
    Posts
    630
    Just an update. This works quite well and no issues with switch bounce. We did have to add an NPN3904 transistor on the output pin to deal with the 11v signal on the G540 input pin. But it works.

Similar Threads

  1. CNC Touch Off Plate
    By bgriggs in forum DIY CNC Router Table Machines
    Replies: 6
    Last Post: 01-04-2014, 05:48 AM
  2. Looking for a touch probe/plate/mushroom
    By kbal in forum Want To Buy...Need help!
    Replies: 0
    Last Post: 06-12-2011, 11:11 AM
  3. Looking for a Dyna Probe or Touch plate
    By Fastest1 in forum Dyna Mechtronics
    Replies: 0
    Last Post: 02-28-2011, 02:06 PM
  4. Touch off plate
    By rich_cree in forum Benchtop Machines
    Replies: 2
    Last Post: 06-03-2010, 06:05 PM
  5. Touch Off Plate
    By gunlocators in forum Benchtop Machines
    Replies: 4
    Last Post: 10-07-2008, 07:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •