586,032 active members*
2,905 visitors online*
Register for free
Login
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2013
    Posts
    14

    Arduino controlled THC

    Figure I try this here sine the Arduino section isn't getting much attention.

    Trying to create a simple THC using an Arduino. I've seen the one program that's out there but it's definitely "out there".

    Here's my setup:





    Here's the code:

    int dirpin = 2; //stepper direction: HIGH=DOWN, LOW=UP
    int steppin = 3;
    int z_low_ls = 12; //Lower Z-axis limit switch
    int z_high_ls = 13; //Upper Z-axis limit switch
    int zero_torch = 6; //Zero torch on workpiece. HIGH: no contact with workpiece. LOW: Zero'd torch on workpiece
    int ready_thc = 8; //LOW: no signal to start cutting. HIGH: begin cut process
    int s_ready_thc = 0; //Condition
    int s_zero_torch = 0; //Condition
    int s_z_high_ls = 0; //Condition
    int s_z_low_ls = 0; //Condition

    //Setup the I/O
    void setup()

    {
    pinMode(dirpin, OUTPUT);
    pinMode(steppin, OUTPUT);
    pinMode(z_low_ls, INPUT);
    pinMode(z_high_ls, INPUT);
    pinMode(zero_torch, INPUT);
    pinMode(ready_thc, INPUT);
    }

    //Move the Z-axis down
    void move_down()
    {
    {
    digitalWrite(dirpin, HIGH);
    digitalWrite(steppin, LOW);
    digitalWrite(steppin, HIGH);
    delayMicroseconds(200);
    }
    }

    //Move the Z-axis up
    void move_up()
    {
    {
    digitalWrite(dirpin, LOW);
    digitalWrite(steppin, LOW);
    digitalWrite(steppin, HIGH);
    delayMicroseconds(200);
    }
    }

    //If Mach3 hasn't sent a "start cut" signal, return the torch to the top "home position"
    void home_pos()
    {
    s_z_high_ls=digitalRead(z_high_ls);
    if (s_z_high_ls == HIGH)
    {
    move_up();
    }
    }

    //Once Mach3 gets "start cut" signal, zero the torch to the workpiece
    void zero_workpiece()
    {
    s_zero_torch=digitalRead(zero_torch);
    if (s_zero_torch == HIGH)
    {
    move_down();
    }
    }
    /*
    void pierce_height()
    {
    for (int i=0; i<4000; i++)
    {
    digitalWrite(dirpin, LOW);
    digitalWrite(steppin, LOW);
    digitalWrite(steppin, HIGH);
    delayMicroseconds(500);
    }
    }
    */
    //Program loop
    void loop()
    {
    s_ready_thc=digitalRead(ready_thc);
    s_z_high_ls=digitalRead(z_high_ls);
    s_zero_torch=digitalRead(zero_torch);
    if (s_ready_thc == LOW) //If the THC hasn't received a signal from Mach3, go ahead and home by traversing the Z axis to the top until the Z upper limit switch is HIGH
    {
    home_pos();
    }
    while (s_ready_thc != LOW); //If the THC has received a signal from Mach3, start the cut process
    {
    zero_workpiece();
    }
    }
    If there isn't a signal to start the cut, then the program will jog the z axis to the top until there is a signal to start cutting. However, I can get it to jog to the top, stop when the contact switch is closed but I can't get it to exit out if I set the signal to start cut.

    I want to keep it simple at first then expand into the digital phase using the voltage readout.

    I have a Powermax 45 so I can use the start cut and arc OK signals between the Arduino and my Mach3 breakout board.

    I'm still relatively new to Ardunios. This is my first leap beyond the example sketches.

  2. #2
    Join Date
    Mar 2015
    Posts
    7

    Re: Arduino controlled THC

    sweet, thanks

Similar Threads

  1. Arduino controlled coolant nozzles
    By bozidar22 in forum Open Source Controller Boards
    Replies: 22
    Last Post: 11-01-2016, 09:37 PM
  2. Arduino CNC set-up
    By Palladin54 in forum DIY CNC Router Table Machines
    Replies: 22
    Last Post: 09-20-2014, 09:25 PM
  3. EMC with Arduino for USB I/O?
    By sansbury in forum LinuxCNC (formerly EMC2)
    Replies: 23
    Last Post: 05-05-2012, 09:27 PM
  4. My new CNC machine. Arduino controlled:
    By aventgps in forum Open Source CNC Machine Designs
    Replies: 45
    Last Post: 05-03-2012, 05:39 PM
  5. cnc controlled mandrel bender controlled by mach3
    By timmyb199 in forum Bending, Forging, Extrusion...
    Replies: 5
    Last Post: 05-31-2007, 12:35 AM

Tags for this Thread

Posting Permissions

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