Problem DIY Torch Height Control - Page 2


Page 2 of 2 FirstFirst 12
Results 21 to 34 of 34

Thread: DIY Torch Height Control

  1. #21
    Registered
    Join Date
    Oct 2010
    Location
    USA
    Posts
    317
    Downloads
    0
    Uploads
    0

    Default

    Here it is! Still tuning it but its something, phone cant focus good enough to see the piece past the arc but the part is on a 6* incline and the torch is climbing. Once it catches up to height it does pretty good. Thats only 30 ipm, that thickness is rated for 140ipm so im still working some things out.

    http://www.youtube.com/watch?v=vZWv4OYLs1Q]THC Test - YouTube



  2. #22
    Registered
    Join Date
    Oct 2010
    Location
    USA
    Posts
    317
    Downloads
    0
    Uploads
    0

    Default

    Here is the Arduino code, its a WIP but its good enough to use at this point.

    Code:
    double values[8];
    boolean firstRun=true;
    double tip=0;
    double realVoltage=0;
    int j=0;
    int led12 = 8;
    int led13 = 9;
    
    void setup(){
      Serial.begin(9800);
      Serial.println("Serial Started w00t");
      pinMode(led12, OUTPUT);
      pinMode(led13, OUTPUT);
    }
    
    void loop(){
      tip=analogRead(0);
      if(tip>80){ 
        //   Serial.print("Incoming Voltage is ");
        // Serial.println(analogRead(0));
    
        if(firstRun){
          for(int i=0;i<8;i++){
            values[i]=tip;
          }
          firstRun=false;
        }
        values[j]=tip;
        tip=0;
        for(int i=0;i<8;i++){
          tip+=values[i];
        }
        tip/=8;
        realVoltage = ((((tip*(5.0/1023.0))*7000)/5000)*50);
        //Serial.print("Real voltage: ");
        Serial.println(realVoltage);
        if(realVoltage >= 118.5){
          digitalWrite(led12, LOW);
          digitalWrite(led13, HIGH);
        }
        else if(realVoltage <= 115.5){
          digitalWrite(led12, HIGH);
          digitalWrite(led13, LOW);
        }         
        else if(realVoltage <= 118.5 && realVoltage >= 115.5){
          digitalWrite(led12, LOW);
          digitalWrite(led13, LOW);
        }
    
    
        j++;
        if(j>=8){
          j=0;
        }
      }  
      else {
        digitalWrite(led12, LOW);
        digitalWrite(led13, LOW);
      }
    }
    This code takes 8 values into memory and uses the average of them to calculate the voltage. This is based off 7 volt max out of plasma cutter which goes though a 2000/5000 voltage divider for a max of 5v. The math in the "realVoltage" line takes the 1-1023, converts it back to input voltage, then to the plasma cutter output voltage then finally the arc voltage. The 5000 and 7000 need to be adjusted based on your voltage divider.

    The led pins are names I was using when I was testing the outputs with just leds, change them if you like but they work. Led12 is torch-up, 13 is torch-down. These are high activated inputs, im using a C10 breakout board and have the inputs PULLED LOW on that board. The Arduino is currently powered by my computer and the C10 and Arduino share a ground for the inputs to work. Input is to analog input 0. The serial information can be removed, it was used for testing and I am still using it to verify voltages.

    The input to the Arduino is filtered based on my earlier testing. I am using 1660k worth of resistor and a 1uF capacitor. The wiring is as follow...

    Code:
    Voltage Divider Output -> 1660k resistors -> One leg of Capacitor -> Same leg of Capacitor -> Arduino Analog Input
    
    Other leg of Capacitor -> Arduino Ground
    The filter was based off some "extensive" testing...below is just two of the graphs I made using different filters and number of values in average.

    The first one compares the unfiltered input to an input filtered with 1k resistor and 1uF cap, both of these use 15 values for the average.
    http://sphotos-b.xx.fbcdn.net/hphoto...17269642_o.jpg

    The next is the best I could get with filters, both use 1660 resistors and 1uF caps, the red is storing 8 values, the other 7. I believe the voltage offset and erratic behavior at the end of the red one is due to consumables wearing out. I did quite a bit of testing and torch firing today.
    http://sphotos-b.xx.fbcdn.net/hphoto...70837243_o.jpg

    Not sure why I cant direct post images anymore but I have uploaded them to the thread also.


    I will post my HAL file, INI file, and the comp file once I get a chance to get them all together and post exactly what needs done.

    Attached Thumbnails Attached Thumbnails DIY Torch Height Control-1660k-jpg   DIY Torch Height Control-filtervsnot-jpg  


  3. #23
    Registered
    Join Date
    Oct 2010
    Location
    USA
    Posts
    317
    Downloads
    0
    Uploads
    0

    Default

    Had to remove the divider...it was messing up horribly and I have no idea why but now the Arduino can possibly receive 7v on the input. I have tried my hardest with a hand torch to get above 5 and I couldn't. If it breaks I will look into a new way to handle it, the filter should capture any voltage spikes also.

    Short video of THC working - "http://www.youtube.com/watch?v=hRBCV_OhEoY"]DIY Plasma Cutter with Torch Height Controller - YouTube



  4. #24
    Registered
    Join Date
    Mar 2007
    Location
    UK
    Posts
    534
    Downloads
    0
    Uploads
    0

    Default

    The code is taking a rolling average, hence firstRun to fill the 8 number array.

    The *50); implies the plasm cutter is dividing the voltage by 50 before it gets to your voltage divider, hopefully they are using an op-amp, if they are using a pair of resistors you can smooth it before it enters your voltage divider.

    The ADC probably has protection diodes to VCC and GND to keep the input between -0.8 and 5.8V if not you could add them.

    The code is using doubles to allow you to type in real resistor values and give you actual voltages which is friendly but totally unnecessary. I'd suggest an integer array and do the clever stuff working out your switching points against the sum total of the array. That way the compiler does all the work and the calculation will go a zillion times faster. Best to avoid floating point maths if you want speed.



  5. #25
    Registered
    Join Date
    Oct 2010
    Location
    USA
    Posts
    317
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by Robin Hewitt View Post
    The code is taking a rolling average, hence firstRun to fill the 8 number array.

    The *50); implies the plasm cutter is dividing the voltage by 50 before it gets to your voltage divider, hopefully they are using an op-amp, if they are using a pair of resistors you can smooth it before it enters your voltage divider.

    The ADC probably has protection diodes to VCC and GND to keep the input between -0.8 and 5.8V if not you could add them.

    The code is using doubles to allow you to type in real resistor values and give you actual voltages which is friendly but totally unnecessary. I'd suggest an integer array and do the clever stuff working out your switching points against the sum total of the array. That way the compiler does all the work and the calculation will go a zillion times faster. Best to avoid floating point maths if you want speed.
    Can you demonstrate what you mean? I have since gotten rid of the voltage divider because the Arduino quit sampling voltage and after direct input it started working again...the max out of the plasma cutter is 7 but i have tried and never gotten it above 4 let alone 5 so the Arduino should be fairly safe.



  6. #26
    Registered
    Join Date
    Mar 2007
    Location
    UK
    Posts
    534
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by tjb1 View Post
    Can you demonstrate what you mean?

    Which part?

    I think your only worry is arc strike pulses which the filter should remove before they reach the ADC. OTOH it is perfectly possible that the cutter is already removing them. If they are getting through then the odd one you catch could be hidden by the rolling average.

    If they are dividing by 50 using a pair of resistors then the circuit is dubious because adding that extra 7k to ground puts it out of whack and may drop the cutting head below optimum height. Might explain why you never get the full 7V.

    If I was designing the ciruit I'd probably go for a high impedance input but what you have sounds good to go. Hopefully your 100n capacitor is not an aluminium electrolytic or you might have problems a few years down the line when it dries out.



  7. #27
    Moderator
    Join Date
    Jan 2008
    Location
    USA
    Posts
    2247
    Downloads
    0
    Uploads
    0

    Default

    If you are using the internal 50:1 voltage divider on the Hypertherm Powermax45...there is some internal filtering and isolation. On our larger industrial systems we provide a filtered, isolated analog DC output that provides a stable divided DC output (usually 50:1) for height control requirements. On our newest systems we filter, isolate and then convert the analog to a digital signal for better height control accuracy....and elimination of losses between the plasma and height control electronics. Hypertherm has been building industrial height control systems for plasma cutting since 1985.


    Jim Colt Hypertherm



  8. #28
    Registered
    Join Date
    Oct 2010
    Location
    USA
    Posts
    317
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by Robin Hewitt View Post
    Which part?
    "I'd suggest an integer array and do the clever stuff working out your switching points against the sum total of the array. That way the compiler does all the work and the calculation will go a zillion times faster. Best to avoid floating point maths if you want speed."

    I couldn't reach 7v just measuring off the wires direct with a multimeter. I tried everything with the torch, starting and pulling it up until it lost the arc, different thicknesses...everything. But the maximum voltage I seen in the book was 156 I believe and thats just a hair over 3v so of course if the THC is functioning correctly it should protect itself. The arc start was roughly 30volts higher than the cutting voltage but the voltage would have to reach 250 before it would even damage the Arduino so I don't see the need for the divider at this point.

    By the way Jim, the Linux comp file takes care of corner locking. May not work as fast or as accurate as a commercial setup but I didnt see any plug and play setups for LinuxCNC and this only cost me about $60. Question though, how important is the voltage? Right now I have a tolerance of about +-1.5v. With the addon that increases the correction amount I should be able to drop that tolerance even more.



  9. #29
    Registered
    Join Date
    Oct 2010
    Location
    USA
    Posts
    317
    Downloads
    0
    Uploads
    0

    Default

    Here is the comp file, if you have any questions just ask...some pieces of this file reach into the HAL file so I will add those soon. Nothing really to add to this except the 2x-3x correction based on an input.

    Code:
    component thcud "Torch Height Control Up/Down Input";
    
    
    
    description 
    """
    to install open a terminal and cd to where the file is and use the following command
    
    sudo comp --install thcud.comp
    
    Torch Height Control
    This THC takes either an up or a down input from a THC
    
    If enabled and torch is on and X + Y velocity is within tolerance of set speed
    allow the THC to offset the Z axis as needed to maintain voltage.
    
    If enabled and torch is off and the Z axis is moving up remove any correction
    at a rate not to exceed the rate of movement of the Z axis.
    
    If enabled and torch is off and there is no correction 
    pass the Z position and feed back untouched.
    
    If not enabled pass the Z position and feed back untouched.
    
    Physical Connections typical
    parport.1.pin-12-in <= THC controller Plasma Up 
    parport.1.pin-13-in <= THC controller Plasma Down
    parport.0.pin-12-in-not  <= Plasma Torch Arc Ok Signal
    parport.0.pin-17-out => Plasma Torch Start Arc Contacts
    
    HAL Plasma Connections
    thcud.torch-up <= parport.1.pin-12-in
    thcud.torch-down <= parport.1.pin-13-in
    motion.spindle-on => parport.0.pin-17-out (start the arc)
    thcud.arc-ok <= motion.digital-in-00 <= parport.0.pin-12-in-not (arc ok signal)
    
    HAL Motion Connections
    thcud.requested-vel <= motion.requested-vel
    thcud.current-vel <= motion.current-vel
    
    """;
     
    author "John Thornton";
    
    license "GPL";
    
    option singleton yes;
    
    
    
    
    
    // Input Pins
    pin in bit torch_up "Connect to parport.1.pin-12-in";
    pin in bit torch_down "Connect to parport.1.pin-13-in";
    pin in float current_vel "Connect to motion.current-vel";
    pin in float requested_vel "Connect to motion.requested-vel";
    
    pin in bit torch_on "Connect to motion.spindle-on";
    pin in bit arc_ok "Arc Ok from Plasma Torch";
    pin in bit enable "Enable the THC, if not enabled Z position is passed through";
    pin in float z_pos_in "Z Motor Position Command in from axis.n.motor-pos-cmd";
    
    // Output Pins
    pin out float z_pos_out "Z Motor Position Command Out";
    pin out float z_fb_out "Z Position Feedback to Axis";
    pin out bit vel_status "When the THC thinks we are the requested speed";
    pin out bit removing_offset "Pin for testing";
    
    // Parameters
    
    param rw float correction_vel "The Velocity to move Z to correct";
    
    // Global Variables
    variable float offset;
    variable float last_z_in;
    
    function _;
    
    ;;
    
    #include "rtapi_math.h"
    
    FUNCTION(_) {
        if(enable){
            float min_velocity = requested_vel -(requested_vel*(.8)); //.8 is velocity tolerance, change as needed
            if(current_vel > 0 && current_vel >= min_velocity){vel_status = 1;}
            else {vel_status = 0;}
            
            if(torch_on && arc_ok && vel_status){ // allow correction
                if(torch_down){
                    offset -= correction_vel;
                }
                if(torch_up){
                    offset += correction_vel;
                }    
                last_z_in = 0;
            }
            if(!torch_on){ // remove any offset
                float z_diff;
                z_diff = z_pos_in - last_z_in;
                if(z_diff > 0 && offset != 0){ // torch is moving up
                    removing_offset = 1;
                    if(offset > 0){ // positive offset
                        if(offset > z_diff){ // remove some
                            offset -= z_diff;
                        }
                        else {offset = 0;}
                    }
                    if(offset < 0){ // negative offset
                        if(offset < z_diff){ // remove some
                            offset += z_diff;
                        }
                        else {offset = 0;}
                    }
                }
                else {removing_offset = 0;}
                last_z_in = z_pos_in;
            }
            z_pos_out = z_pos_in + offset;
            z_fb_out = z_pos_in; // keep axis motor position fb from being confused
        }
        if(!enable){
            z_pos_out = z_pos_in;
            z_fb_out = z_pos_in; // keep axis motor position fb from being confused
        }
    }




  10. #30
    Registered
    Join Date
    Mar 2007
    Location
    UK
    Posts
    534
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by tjb1 View Post
    "I'd suggest an integer array and do the clever stuff working out your switching points against the sum total of the array. That way the compiler does all the work and the calculation will go a zillion times faster. Best to avoid floating point maths if you want speed."
    I thought that was clear, I'll drop back a few levels, apologies if I drop too many

    If you have an "8 bit" computer chip the largest number it can handle without effort is 256.

    If you ask it to work in 16 bits you can have numbers 0 to 65535 but it has to do twice as much to get to the answer.

    Next level up is floating point which starts to take time, but if you really want huge numbers and high precision you can ask to work in "double precision floating point".

    Multiplies and divides are tedious loops with lots of bit shifting and loops, best avoided.

    So, can you do this without floating points and multiplies? Yes you can.

    The plasma cutter is dividing by 50 to get 7 Volts so your ADC is resolving 350 Volts in 10 bits and has a resolution of 350 / 1024 = 0.3418 V

    Meaning, when it reads 100 you have 34.18 Volts across the arc.

    However the plasma cutter isn't accurate to .34 Volts, it is jittering about all over the place which is why we need to take that rolling average.

    Suppose you saved the ADC output as an integer. No floating point stuff to make it complicated.

    When you come to the up/down/hold decision, simply total the integer array, no multiplies or divides needed, simple addition. You end up with a number which repersents the average voltage in units of .3418 / 8 = 0.0427V which is no more complicated than .3418V

    realVoltage = ((((tip*(5.0/1023.0))*7000)/5000)*50);

    When a C compiler sees this it doesn't create a program to do all that maths every time, it simplifies it to

    realVoltage = tip * 0.342;

    We can use the compiler to introduce real world numbers without complicating the program.

    If we wanted to know if the tip Volts are > 185.5V using my integer tally thing, we can say:-

    if(tally > (int)(185.5 / 0.0427)) ...

    The compiler sees the (int)(...) and resolves the floating point sum then inserts the nearest round number in to your program...

    if(tally > 4344) ...

    No floating point, no multiplies, no divides, no loss of accuracy. Simples.



  11. #31
    Registered
    Join Date
    Mar 2007
    Location
    UK
    Posts
    534
    Downloads
    0
    Uploads
    0

    Default

    Probably full of typo's...

    Code:
    unsigned values[8];
    boolean firstRun=true;
    unsigned j, tally;
    int led12 = 8;
    int led13 = 9;
    
    void setup()
    {
    //  Serial.begin(9800);
    //  Serial.println("Serial Started w00t");
    	pinMode(led12, OUTPUT);
    	pinMode(led13, OUTPUT);
    }
    
    /*
     * define the switching Voltage levels for up and down
     */
    
    #define UP	 115.5
    #define DOWN 118.5
    
    /*
     * Without the Voltage divider your ADC reads 50*5 Volts full scale
     * So the tally ADC resolution is 50*5/1024/8  
     */
    
    #define resADC 0.0305
    
    
    
    void loop()
    {
    
    	unsigned tip = (unsigned)analogRead(0);
    
    	if(tip > 57)					// 80 corrected for no scaling resistors
    	{ 
    		if(firstRun)				// First time around, fill the array
    		{
    			for(int i = 0; i < 8; i++)
    				values[i] = tip;
    			tally = tip * 8;			// and save the array tally
    			firstRun = false;			// only do this bit once
    		}
    
    		if(++j > 7)				// wind on array pointer
    			j=0;				// j doesn't need to be initialised if unsigned
    
    		tally -= values[j];				// subtract old value from tally
    		tally += tip;				// add new value into tally
    		values[j] = tip;				// save new value
    
    	    if(tally > (unsigned)(DOWN/resADC))
    		{
    	      digitalWrite(led12, LOW);
    	      digitalWrite(led13, HIGH);
    	    }
    	    else if(tally < (unsigned)(UP/resADC))
    		{
    	      digitalWrite(led12, HIGH);
    	      digitalWrite(led13, LOW);
    	    }         
    	    else
    		{
    		  digitalWrite(led12, LOW);
    		  digitalWrite(led13, LOW);
    		}  
    	}
    	else
    	{
    		digitalWrite(led12, LOW);
    		digitalWrite(led13, LOW);
    	}
    }


    Last edited by Robin Hewitt; 11-20-2012 at 12:57 PM. Reason: Spotted a typo


  12. #32
    Registered
    Join Date
    Jun 2012
    Location
    USA
    Posts
    3
    Downloads
    0
    Uploads
    0

    Default

    I've been working on the same thing (Arduino THC) for a couple of months now. Here are a number of "ramblings" related to the ongoing discussion.

    My plasma (Everlast Power Plasma 50) has a CNC port output that provides a positive voltage that I believe is isolated. You can use full voltage, divide by 50 or divide by 16.

    Because of the noise on the signal, I decided to use the full voltage. The one problem I had was that it took me a while to figure out why the voltages I read weren't as high as I expected.

    The CNC port has a 100K resistor on each side of the voltage output (+ and -) to preventing arcing.

    Using a voltmeter or scope I had been seeing pilot arc voltages in the 60 volt range. I thought it was due to the resistors but didn't know how to calculate the effect they had on the output voltage.

    I finally figured it out with a circuit simulator (LtSpice). I was then able to calculate the A/D counts per volt based on the voltage divider and the 100K resistors on each side of the torch output (with the 10 bit Arduino A/D and my voltage divider, I ended up with about 7 counts/volt).

    One of the challenges with the Arduino is getting the voltage as high as possible to have better resolution in your voltage reading. I assumed that the pilot arc voltage would be the highest and then added about 20 volts as a safety margin and calculated the voltage divider so that max input voltage would be 5 volts.

    There is limited input protection in the stock arduinos. To deal with any over voltages due to spikes or bad calcuations on my part, I put a zener diode on the output of the voltage divider to protect the Arduino.

    To clean up the torch voltage signal I started with an analog filter circuit using an op-amp (designed with a free filter design program from TI). That didn't work because the op-amp didn't go "rail-to-rail", even though it was supposed to. (It never went lower than about 1.3 volts or higher than about 3.8 volts)

    The second pass of the hardware filter used a dedicated filter chip. That did a really good job cleaning the signal up, but slowed the response to well over 1 second. I figured that was way too slow to be useful.

    The third pass used the circuit from the first pass with a different op amp. (I had simulated it with LtSpice and it looked good.) It seems to be performing well in the initial tests. But.... I've been having trouble with either Mach and/or Sheetcam because it gets to a point where it is still too high, but won't respond to "torch down" signals.

    The image below shows the filtered output I've been able to achieve.

    The testing was done with just the pilot arc voltage. It used the hardware filter and a software sliding window average of 5 values (the sample rate was about 1 millisecond) - the voltage is within a 2 volt range (actual torch voltage before dividing). I figured I could filter it more, but don't yet know what kind of lag to voltage responses can be tolerated.

    Attached Thumbnails Attached Thumbnails DIY Torch Height Control-ltc-opamp-5-sample-filter-jpg  
    Last edited by PghGuy; 12-22-2012 at 06:06 PM. Reason: typo


  13. #33
    Registered
    Join Date
    Oct 2010
    Location
    USA
    Posts
    317
    Downloads
    0
    Uploads
    0

    Default

    Pgh, sorry I haven't been posting updates to this. I'm not sure if you seen the other thread but I ended up moving to a Mesa A-D converter and let LinuxCNC handle all the math and control. I still have issues with this and haven't had any time to look at it, I have since moved after getting out of college so I am not even near the table 90% of the year. It has been sitting not running because of the difficult of using LinuxCNC and with me being the only one that knows how. I plan on converting it to Mach3 when I get money/time and getting a commercial THC from candcnc so that my dad can operate the table with the only real learning curve being Sheetcam instead of having to learn Linux.



  14. #34
    Registered
    Join Date
    Dec 2016
    Posts
    2
    Downloads
    0
    Uploads
    0

    Default Re: DIY Torch Height Control

    hi
    diagram plz THC



Page 2 of 2 FirstFirst 12

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
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

DIY Torch Height Control

DIY Torch Height Control