Welcome! Log In Create A New Profile

Advanced

Firmware evolution for TIG based Metal 3D Printer

Posted by kolergy 
Firmware evolution for TIG based Metal 3D Printer
June 17, 2014 05:47PM
Hi, I'm trying to develop a metal 3D printer based on the Tungsten Inert Gas (TIG) welding process you can find details there: StrongPrint.

To cut a long story short after some semi manual experimentation I arrived to the conclusion that I need to modify some features of the firmware:

- Control a solenoid valve
- Add measurement of the current or at least the presence of the Arc
- Perform extrusion/retract differently
- Add Arc ignition / extinguish commands

However it is my first time fiddling with the firmware so if you agree I will expose the way I intend to implement it and I will be interested by your comments & suggestions:

1) Starting by the easy bit: Control a solenoid valve, I have noticed that M126/M127 M128/129 commands were already implemented so I guess these can directly be used for the Argon solenoid valve, can even put two smiling smiley

2) Ultimately it will be necessary to integrate a measure of electric potential & current but it is a bit tricky as it needs to be insulated from the control broad due to the EMC generated by the arc so for now I am experimenting with a KY-018 photo resistor to detect the presence of the arc, I guess It can directly be connected in place of one of the temperature sensors. for that it is apparently required to:
  • Create a new calibration curve for the light sensor or when available the current sensor in thermistortables.h specially because I think it goes the opposite way of a thermistor resistance drop when light is present
  • Disable the PIDs in Temperature.cpp
  • Adapt the cold extrude feature as it would be good to prevent extrusion when no arc is present (I'm not sure where it is exactly)
  • Review the display of the values to Repetier (Not mandatory)


3) The TIG process requires filler wire to be melted in a weld pool, the arc being relatively powerful with slow extrusion speeds the wire would melt before arriving to the melt pool so the wire needs to be rapidly extruded (to speak in printer terms even-though no extrusion is going on here) then retracted to come out to the hot arc to deposit just the right amount in the melt pool without melting the wire before the weld pool. For the moment I have made a small python script that generate G-Code where a segment is cut into smaller segments where the movement is done in three times: rapid extrude, rapid retract, move at given speed. Ultimately I think this can be included in a similar way as the transformation to delta was introduced. Is it correct ? (This would be for later)

4) Finally the most important: Ignition / stop of the arc:
  • I could not find any suitable commands in the Marlin G-Code implementation, from the Wikipedia G-Code description the closest I found was G3 for spindle Start & G5 for Spindle Stop. Those G-Codes seems to be available in Marlin, is that correct ? Could those be used for that purpose ?
  • As there is not yet an HF ignition system on the welding power source a lift arc technique is used: the tungsten electrode is slowly descended toward the the surface until it makes contact then raised again to the weld height. All this is done while having a large tangential velocity not to stick to the surface. For the moment this done programed in G-Code but it requires knowing the z position to 0.1mm which is not very practical. the idea would be to perform back & forth tangential movements (X of Y) while slowly going down until arc detection information is provided through the photo-resistor.
  • I guess the implementation could be relatively similar to the M30 command with the Z probe & something inspired from run_z_probe(); however I do not fully understand how the planner is used to detect the contact & provide the Z position information.

Up to now I have failed to find document explaining the logic behind the implementation of the Marlin firmware and got all the information from the code, is there somewere a newbie guide to the Marlin or at least some resources describing the organization & logic of the firmware?

Thanks for reading this long post & feel free to provide your comments / advices.

Cheers

Kolergy
Re: Firmware evolution for TIG based Metal 3D Printer
June 18, 2014 06:17AM
Quote
kolergy
- Control a solenoid valve

This can be handled like a heater or a fan. M106 in Teacup firmware, M41 or M42 in Marlin. Make sure your electronics comes with a flyback diode on the MOSFET outputs, most have none. SevenSwitch, Gen7 and STB electronics do.

Quote
kolergy
- Add measurement of the current or at least the presence of the Arc

I'd try with a photo diode. Just like opto-endstops, but without the light diode on the other side. You can even cut an opto-endstop sensor in two halfs.

Quote
kolergy
I am experimenting with a KY-018 photo resistor to detect the presence of the arc, I guess It can directly be connected in place of one of the temperature sensors.

Almost all RepRap electronics have a voltage divider on the thermistor inputs to measure these. These resistors likely need adjustment to give a significant signal in the interesting range: [reprap.org]

Quote
kolergy
For the moment I have made a small python script that generate G-Code where a segment is cut into smaller segments where the movement is done in three times: rapid extrude, rapid retract, move at given speed. Ultimately I think this can be included in a similar way as the transformation to delta was introduced. Is it correct ? (This would be for later)

Likely you want some logic here. Like retracting not earlier than the arc exists.

Quote
kolergy
Up to now I have failed to find document explaining the logic behind the implementation of the Marlin firmware and got all the information from the code, is there somewere a newbie guide to the Marlin or at least some resources describing the organization & logic of the firmware?

It's said that Teacup firmware is easier to understand. Maybe because it concentrates on the important features and doing them superior instead of putting emphasis on feature-richness.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Firmware evolution for TIG based Metal 3D Printer
June 18, 2014 07:46AM
Thanks for your reply,

For the moment I use a Gen7 1.4.1 with the modified marlin from Johann as it is a delta printer.

I think I will use the following set-up:
- Argon solenoid valve command -> Bed heater
- Photo resistor -> extruder 0 thermocouple

The Gen7 is powered by an ATX power supply but the solid valve requires 24V, since the Gen7 has dedicated power line to the MOSFETs can it handles 24v safely?

I will have a look at the Teacup to see if it is simpler to understand

Cheers
Re: Firmware evolution for TIG based Metal 3D Printer
June 20, 2014 09:09AM
Quote
kolergy
since the Gen7 has dedicated power line to the MOSFETs can it handles 24v safely?

Yes, with the exception that you have to remove the indicator LED pre-resistor (R14, R22) or replace it with a 2200 ohms one. If you forget this, the LED will blow, no other harm expected.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Firmware evolution for TIG based Metal 3D Printer
July 01, 2014 07:35PM
Ok, thanks, I will change the resistor when passing to 24V

I have implemented the M3 command to ignite the arc, it is working perfectely except for one detail that needs to be sorted where I would have a question: Once the point touch the workpiece to initiate the arc this defines the 0 for Z. How to define this Z position as my new Zero ? I think I could use "current_position[Z_AXIS] = 0.0;" but I do not feel really comfortable with it as next time it performs an ignition if the part is slightly below the zero it will not go there as there is probably something preventing moves in negative Z...or not ?.

Here is the code if anyone is interested
Code added to Configuration.h
//===========================================================================
//============================== Metal Settings =============================
//===========================================================================
// Enable TIG based Metal 3D printer
#define METAL

#ifdef METAL
  // Uncoment this if using lift arc method for ignition
  #define METAL_LIFT_ARC
  #ifdef METAL_LIFT_ARC
    #define METAL_STROKE_LENGTH      20.0   // length of the oscilations in the x direction
    #define METAL_STROKE_Z_START      9.0   // Initiate oscilatory movment at this altitude
    #define METAL_STROKE_Z_AMPLITUDE  5.0   // height difference between the sides & the center low point
    #define METAL_STROKE_Z_PASS       0.15  // altitude reduction for each pass
  #endif // METAL_LIFT_ARC
  
  #define METAL_IGNITION_X          -20.0    // X position of the ignition point (center of oscilation)
  #define METAL_IGNITION_Y           35.0    // Y position of the ignition point 
  #define METAL_ARC_LIGHT_LEVEL      50.0    // Treshold light level  indicating arc is ignited
#endif  // METAL

Code added to Termistortables.h
#if (THERMISTORHEATER_0 == 99) || (THERMISTORHEATER_1 == 99) || (THERMISTORHEATER_2 == 99) || (THERMISTORBED == 99) // Light Sensor
const short temptable_99[][2] PROGMEM = {
// Only use for light sensor for TIG metal printing
// 
// Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
   {700 *OVERSAMPLENR,   200 }, 
   {800 *OVERSAMPLENR,    20 }, 
   {960 *OVERSAMPLENR,    10 }  
};
#endif


Code added to Marlin_main.cpp
#ifdef METAL
float lift_ignition() {
  #if defined(TEMP_0_PIN) && TEMP_0_PIN > -1
    float startPos = METAL_STROKE_Z_START;
    float lightLevel = -1;
    float Z_Ignit    = -1;
    feedrate = homing_feedrate[X_AXIS];
    
    // Position torch over ignition point
    destination[X_AXIS] = METAL_IGNITION_X;  
    destination[Y_AXIS] = METAL_IGNITION_Y;
    destination[Z_AXIS] = startPos;
    prepare_move_raw();
    st_synchronize();

    // Perform oscilatory movments until ignition occured
    int sign = 1;
    for (float i = startPos; i >= 0; i=i - METAL_STROKE_Z_PASS) {
      feedrate            = homing_feedrate[Z_AXIS];
      sign = -sign;
      destination[X_AXIS] = METAL_IGNITION_X + sign * METAL_STROKE_LENGTH; 
      destination[Y_AXIS] = METAL_IGNITION_Y; 
      destination[Z_AXIS] = i+METAL_STROKE_Z_AMPLITUDE; 
      prepare_move_raw();
      destination[X_AXIS] = METAL_IGNITION_X; 
      destination[Z_AXIS] = i; 
      prepare_move_raw();
      destination[X_AXIS] = METAL_IGNITION_X - sign * METAL_STROKE_LENGTH; 
      destination[Z_AXIS] = i+METAL_STROKE_Z_AMPLITUDE; 
      prepare_move_raw();
      st_synchronize();
      lightLevel = degHotend(tmp_extruder);
      SERIAL_PROTOCOLPGM("Z:");
      SERIAL_PROTOCOL_F(i,3);
      SERIAL_PROTOCOLPGM("\t Light:");
      SERIAL_PROTOCOL_F(lightLevel,3);      
      SERIAL_ECHOLN("");
      if(lightLevel > METAL_ARC_LIGHT_LEVEL) {
        Z_Ignit = i;
        SERIAL_PROTOCOLPGM("Ignited @ Z:");
        SERIAL_PROTOCOL_F(Z_Ignit,3);
        SERIAL_ECHOLN(" lets Weld");
        break;
      }
    }
  #else // TEMP_0_PIN
    SERIAL_ECHOLN("No light sensor available on TEMP_0_PIN");
  #endif // TEMP_0_PIN
  return Z_Ignit;
  
}
#endif // METAL.
.
.
.
#ifdef METAL
    case 3: // M3 - Arc Ignition
      #ifdef METAL_LIFT_ARC
        SERIAL_ECHOLN("M3 Sent");
        lift_ignition();
        SERIAL_ECHOLN("M3 After");
      #endif
      break;
#endif  //METAL
Re: Firmware evolution for TIG based Metal 3D Printer
July 02, 2014 07:50AM
Written for a different firmware, unfortunately, so I can't test.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Firmware evolution for TIG based Metal 3D Printer
July 09, 2014 07:14PM
Ok the M3 command is now working fine including the Z calibration.

Here is the new version of the lift_ignition() method in Marlin_main.cpp that calibrate the Z position at the ignition point.
#ifdef METAL
float lift_ignition() {
  #if defined(TEMP_0_PIN) && TEMP_0_PIN > -1
    float startPos   = METAL_STROKE_Z_START;
    float lightLevel = -1;
    float Z_Ignit    = -1;
    feedrate         = homing_feedrate[X_AXIS];
    
    // redefine Z position to set the new zero
    current_position[Z_AXIS] = current_position[Z_AXIS] + METAL_Z_MARGIN; // add a margin in the z direction such that it is able to ignite even if platform is slightly lower than expected
    calculate_delta(current_position);
    plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
    
    // Position torch over ignition poit
    destination[X_AXIS] = METAL_IGNITION_X;  
    destination[Y_AXIS] = METAL_IGNITION_Y;
    destination[Z_AXIS] = startPos;
    prepare_move_raw();
    st_synchronize();

    // Perform oscilatory movments until ignition occured
    int sign = 1;
    for (float i = startPos; i >= 0; i=i - METAL_STROKE_Z_PASS) {
      sign = -sign;
      destination[X_AXIS] = METAL_IGNITION_X + sign * METAL_STROKE_LENGTH; 
      destination[Y_AXIS] = METAL_IGNITION_Y; 
      destination[Z_AXIS] = i+METAL_STROKE_Z_AMPLITUDE; 
      prepare_move_raw();
      destination[X_AXIS] = METAL_IGNITION_X; 
      destination[Z_AXIS] = i; 
      prepare_move_raw();
      destination[X_AXIS] = METAL_IGNITION_X - sign * METAL_STROKE_LENGTH; 
      destination[Z_AXIS] = i+METAL_STROKE_Z_AMPLITUDE; 
      prepare_move_raw();
      st_synchronize();
      lightLevel = degHotend(tmp_extruder);

      if(lightLevel > METAL_ARC_LIGHT_LEVEL) {
        Z_Ignit = i;
        SERIAL_PROTOCOLPGM("Ignited @ Z:");
        SERIAL_PROTOCOL_F(Z_Ignit, 3);
        SERIAL_ECHOLN(" lets Weld");
  
        // redefine Z position to set the new zero
        current_position[Z_AXIS] = 0.0 + METAL_STROKE_Z_AMPLITUDE; // redefines the zero from the position of ignition
        calculate_delta(current_position);
        plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);

        break;
      }
    }
  #else // TEMP_0_PIN
    SERIAL_ECHOLN("No light sensor available on TEMP_0_PIN");
  #endif // TEMP_0_PIN
  return Z_Ignit;
}
#endif // METAL
A2
Re: Firmware evolution for TIG based Metal 3D Printer
July 10, 2014 07:51PM
Cool project thumbs up

Looks close to being finished, when will you print your first cool thing?

What are the advantages of using a Delta printer for CNC welding, and what would have to be done to mod this for a Cartesian printer?

Tks!
Re: Firmware evolution for TIG based Metal 3D Printer
July 11, 2014 04:55AM
Thanks for your interest A2,

Well now the auto ignition & Z level works this is a huge gain of time as before it required 10 mins set-up to be able to ignite it. But there is still two important things to do before doing a print:

- Switching the board to 24V & control solenoid valves to automate the Argon flow
- The system guiding the wire is not precise enough to make fine welds (<2mm) I have an idea that needs implementing

So I guess it will be sometime in september for the first print as I will not be able to work on it during the summer time. And there will be a lot to be done on top of that to make it practicle.

The first reason why it is a delta is that I find that the movements are gracious, the second one id that is is relatively easy to build a big Delta which when you have very hot metal parts it is good not to have everything packed together.

I do not see any reason why it would not work for a Cartesian, preferably one with a fixed plater as for welding it is good to have a 1cm thick metal baseplate plus the work piece + the clamping material which make it a bit heavy for a moving plater machine like a Prusa.

In terms of the code the only delta thing introduced in the code is the call to claculate_delta() in the redefinition of the Z position, I can put a #ifdef DELTA to switch between delta & cartesian but I will not be able to test the cartesian mode.

Edited 4 time(s). Last edit at 07/11/2014 04:59AM by kolergy.
A2
Re: Firmware evolution for TIG based Metal 3D Printer
July 11, 2014 05:44AM
Quote
kolergy
- The system guiding the wire is not precise enough to make fine welds (<2mm) I have an idea that needs implementing

I watched your videos, would using a MIG nozzle help? I also wonder if you diverted some gas into the wire feed tube would that help as well?

Quote
kolergy
I do not see any reason why it would not work for a Cartesian, preferably one with a fixed plater as for welding it is good to have a 1cm thick metal baseplate plus the work piece + the clamping material which make it a bit heavy for a moving plater machine like a Prusa.

I'm in the process of designing (conceptualizing) a fixed bed Cartesian, so I'm glad to hear you mention the advantages, and now I understand why you have chosen the Delta platform.

Quote
kolergy
In terms of the code the only delta thing introduced in the code is the call to claculate_delta() in the redefinition of the Z position, I can put a #ifdef DELTA to switch between delta & cartesian but I will not be able to test the cartesian mode.

Good to learn that minimal effort is required to switch it to Cartesian, please add the switch.
Re: Firmware evolution for TIG based Metal 3D Printer
July 24, 2014 02:20PM
Ok it is available on [www.thingiverse.com] it should work (in theory) for cartesian as well. but i'm not able to test it.
A2
Re: Firmware evolution for TIG based Metal 3D Printer
July 25, 2014 12:16AM
Tks thumbs up
Sorry, only registered users may post in this forum.

Click here to login