Author Topic: Programming Arduino Pro Mini, TIG Pulse Add-On, missing some code  (Read 24863 times)

0 Members and 1 Guest are viewing this topic.

Offline Mackn918

  • Newbie
  • Posts: 4
  • Country: us
Re: Programming Arduino Pro Mini, TIG Pulse Add-On, missing some code
« Reply #100 on: October 29, 2019, 08:09:21 pm »
How about this code with the schematics TOT showed

"Hi everyone. I bit-banged out some code. This seems to be working for me. Note, I changed the scale values for my own purposes. I am running this on my Syncrowave 250. My welder is using ~9 volts. So I was able to use the multiplexer listed in his video. I tied my grounds together and only ran the TIG Vref though the multiplexer used a separate 5V power supply to power the Arduino. Never allow more than 5V into the Arduino. Here's the sketch I am using:"


//vars

int PWM_DutyCycle = 0;
int PWM_DutyCycle_Pin = A0;

int PWM_Period = 512;  //period in ms
int PWM_Period_Pin = A1;

//Scale the time of the period or duty by N*1024 milliseconds.
//e.g. PWM_PeriodScale=5 will allow a maximum PWM period of 5120 ms or ~0.195Hz
int PWM_PeriodScale = 3.5;
int PWM_DutyScale = 3.5;

int PWM_Out_Pin = 9; //31250 base freq. (Timer1)

unsigned long HighTime=1;
unsigned long LowTime=0;

//Setup PWM Output
void setup()  {
  pinMode (PWM_Out_Pin, OUTPUT);
  pinMode (PWM_DutyCycle_Pin, INPUT);
  pinMode (PWM_Period_Pin, INPUT);
}

void loop()
{
  PWM_DutyCycle= analogRead(PWM_DutyCycle_Pin);
  HighTime = PWM_DutyCycle*PWM_DutyScale;
  LowTime = PWM_Period*PWM_PeriodScale;
 
  //turn on the out pin
  digitalWrite(PWM_Out_Pin,HIGH);
  delay(HighTime);

  //turn pin off
  digitalWrite(PWM_Out_Pin,LOW);
  delay(LowTime);
}
 

Offline DennisCA

  • Contributor
  • Posts: 38
  • Country: fi
Re: Programming Arduino Pro Mini, TIG Pulse Add-On, missing some code
« Reply #101 on: October 31, 2019, 01:04:05 pm »
I'm no electronics expert, but doesn't this seem relevant:
https://www.ebay.com/itm/Adjustable-PWM-Pulse-Frequency-Duty-Cycle-Square-Wave-Signal-Generator-Module/401426669311?hash=item5d76e4deff:m:mnaul_Ap9qbVjPLk0sK6Stw

Seems to me you could just use this thing here and not bother with arduino or anything else, it alsoworks on a large range of voltages. I built my own pedal for my Kemppi TIG welder and replicated (with help from others) the circuit Kemppi used to set a lower and upper max value on their factory pedals. I think I could integrate a circuit like this into that setup (been on a bread board for 2 years now), all it really needs is to hook up between the pedal and welder.

EDIT; And this one looks even more polished and under 10 bucks:
https://www.ebay.com/itm/Square-Signal-Generator-1-150KHz-PWM-Pulse-Frequency-Cycle-Duty-Adjustable-Meter/312690277939?hash=item48cdcafe33:m:mDN4M2CcoqxdWPGwhTdYxFw
« Last Edit: October 31, 2019, 01:30:17 pm by DennisCA »
 

Offline DennisCA

  • Contributor
  • Posts: 38
  • Country: fi
Re: Programming Arduino Pro Mini, TIG Pulse Add-On, missing some code
« Reply #102 on: October 31, 2019, 05:34:07 pm »
I went and took a closer look now that I am home and I think my initial excitement was overstated. Frequency and duty cycle can be set, but the reduction of the value seems to be fixed, maybe it drops it completely. If so it does not look suitable for this purpose.
 

Offline DennisCA

  • Contributor
  • Posts: 38
  • Country: fi
Re: Programming Arduino Pro Mini, TIG Pulse Add-On, missing some code
« Reply #103 on: November 01, 2019, 09:39:33 am »
I believe the PWM module can still be used to drive the multiplexer howver.

I went out and measured the voltage of my pedal and it varies from 1.4 volts (max) to 10.4 volts (min) so I would have to power the PWR separately, that is doable I guess, but can the multiplexer handle voltages like this, I've searched and I believe it cannot.

Anyone know an alternative if so?
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6264
  • Country: fi
    • My home page and email address
Re: Programming Arduino Pro Mini, TIG Pulse Add-On, missing some code
« Reply #104 on: November 01, 2019, 12:42:34 pm »
My idea was to use a microcontroller with a small OLED display, so that you could control the TIG pulse frequency, duty cycle/balance, and pulse high and low levels.  To do this, the microcontroller uses a high-frequency PWM to chop the voltage the inverter provides using a totem-pole MOSFET pair (so that even the polarity does not matter), with a simple LC or RC filter so that the inverter really just sees 0% to 100% of its supply voltage, depending on the PWM duty cycle.  The microcontroller modulates that PWM to produce the actual TIG pulse train.  A second totem-pole MOSFET pair handles the inverter trigger.

The physical pedals are usually just 10kOhm potentiometers.  The pedal would be connected to the microcontroller, not to the inverter at all.  (It also means that the pedal is not directly tied to anything, so one could experiment with having it adjust other properties of the TIG pulse frequency as well.)

The microcontroller would be powered using an USB power bank.  On/off would be spliced into an USB (power) cable.  I like the Pro Micro clones (ATmega32u4); they work at 5V logic levels, are easy to program (either in Arduino environment, or on bare metal using avr-gcc and avr-libc).  As they have a native USB interface, no drivers are necessary; and the default bootloader (usually Arduino Leonardo on the clones) works with avrdude.  No programmers etc. needed.

I was thinking the microcontroller would have some three-pin inputs (VCC, Analog In, GND) for the pedal and 10kOhm potentiometers (anything between 1k and 47k should work) for controlling the TIG pulse properties (say, five of them); some two-pin inputs (GND, Digital In) for buttons (and the TIG trigger); four-pin I2C connector for the OLED display, and a four-pin output connector for the TIG interface (VCC, GND, Trigger, PWM).

Depending on the voltage levels the TIG uses, the components on the four-pin interface vary.  It could be as simple as two MOSFETs, two resistors, and some capacitors (and maybe some ferrites to filter out spikes).  Or, it could be a couple of optoisolators with totem-pole outputs, two resistors, and some caps.  For inverters using very high voltages (say 40-60 V), you could use optoisolated outputs, and a second battery or USB power bank to drive some really beefy MOSFETs via transistors.

In all cases the Trigger is the simple trigger signal output, and the duty cycle of the PWM the "pedal state" the TIG sees.  The output stage only depends on the voltage levels (and possibly amount of noise in the TIG voltage), but its purpose is always to modulate the voltage provided by the TIG, to produce the "pedal" and "trigger" voltages the TIG sees.

The microcontroller, OLED, and its input controls are very easy to implement, and the parts cost from eBay is under 10 USD.  Unfortunately, I don't have a welder, and I don't have any experience in using MOSFETs to PWM and then filter an external voltage, to generate a fractional voltage of that external voltage.
 

Offline Mackn918

  • Newbie
  • Posts: 4
  • Country: us
Re: Programming Arduino Pro Mini, TIG Pulse Add-On, missing some code
« Reply #105 on: April 10, 2023, 11:21:53 pm »
just going to leave this here. i made it using Chat-GPT.

//Here is an Arduino sketch that allows you to add an adjustable pulse welding feature to your TIG welder.
//This sketch requires an Arduino Nano V3 board and three potentiometers connected to the analog input pins A0, A1, and A2 for adjusting the background current, background time, and main time respectively.


Code: [Select]
// Adjustable Pulse Welding for TIG Welder using Arduino Nano V3

int backgroundCurrentPin = A0; // analog input pin for background current adjustment
int backgroundTimePin = A1; // analog input pin for background time adjustment
int mainTimePin = A2; // analog input pin for main time adjustment
int tigTorchPin = 9; // output pin for TIG torch
int backgroundCurrent = 0; // variable to store background current percentage
int backgroundTime = 0; // variable to store background time in milliseconds
int mainTime = 0; // variable to store main time in milliseconds

void setup() {
  pinMode(tigTorchPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  // read the potentiometer values and map them to appropriate values
  backgroundCurrent = map(analogRead(backgroundCurrentPin), 0, 1023, 0, 100);
  backgroundTime = map(analogRead(backgroundTimePin), 0, 1023, 0, 1000);
  mainTime = map(analogRead(mainTimePin), 0, 1023, 0, 1000);

  // turn on the TIG torch and set background current
  digitalWrite(tigTorchPin, HIGH);
  delay(backgroundTime * (1 - backgroundCurrent / 100));
 
  // pulse welding loop
  while (true) {
    // main current phase
    delay(mainTime);
    // background current phase
    delay(backgroundTime * (backgroundCurrent / 100));
  }
}


//In this sketch, we first define the analog input pins for the potentiometers and the output pin for the TIG torch. We also define variables to store the current and time values adjusted by the potentiometers.
//In the setup() function, we set the output pin for the TIG torch as an output pin and start the serial communication for debugging purposes.
//In the loop() function, we read the potentiometer values and map them to appropriate values for background current, background time, and main time.
//We then turn on the TIG torch and set the background current by delaying the program for a certain amount of time based on the background time and background current percentage.
//Finally, we enter into a pulse welding loop where the main and background currents alternate based on the main time and background time values.
//The main current phase is set by delaying the program for the main time value.
//The background current phase is set by delaying the program for a certain amount of time based on the background time and background current percentage.
//This loop repeats indefinitely until the Arduino is reset or turned off.
//Note: This sketch is provided as an example only and should be tested and modified as needed to fit your specific TIG welder and welding needs.
//It is also important to ensure proper safety precautions are taken when working with electricity and welding.
 

Offline Mackn918

  • Newbie
  • Posts: 4
  • Country: us
Re: Programming Arduino Pro Mini, TIG Pulse Add-On, missing some code
« Reply #106 on: April 10, 2023, 11:30:51 pm »
better yet.
Code: [Select]
#include <Multiplexer.h>

// Define the pins for the multiplexer
#define S0 2
#define S1 3
#define S2 4
#define S3 5
#define SIG A0

// Define the pins for the potentiometers
#define POT1 A1
#define POT2 A2
#define POT3 A3

// Define the pins for the tig welder and tig torch
#define WELDER_PIN 6
#define TORCH_PIN 7

// Define the variables for the pulse parameters
int backgroundCurrent = 50;
int backgroundTime = 100;
int mainTime = 10;

// Create a Multiplexer object
Multiplexer mux(S0, S1, S2, S3);

void setup() {
  // Set the pins for the tig welder and tig torch as output pins
  pinMode(WELDER_PIN, OUTPUT);
  pinMode(TORCH_PIN, OUTPUT);

  // Set the signal pin for the multiplexer as an input pin
  pinMode(SIG, INPUT);

  // Set the pins for the potentiometers as input pins
  pinMode(POT1, INPUT);
  pinMode(POT2, INPUT);
  pinMode(POT3, INPUT);
}

void loop() {
  // Read the values of the potentiometers
  int pot1Val = analogRead(POT1);
  int pot2Val = analogRead(POT2);
  int pot3Val = analogRead(POT3);

  // Map the values of the potentiometers to the pulse parameters
  backgroundCurrent = map(pot1Val, 0, 1023, 0, 100);
  backgroundTime = map(pot2Val, 0, 1023, 0, 1000);
  mainTime = map(pot3Val, 0, 1023, 0, 100);

  // Set the multiplexer channel to read the signal from the tig welder
  mux.setChannel(0);

  // Read the signal from the tig welder
  int welderSignal = analogRead(SIG);

  // Set the multiplexer channel to read the signal from the tig torch
  mux.setChannel(1);

  // Read the signal from the tig torch
  int torchSignal = analogRead(SIG);

  // If the signal from the tig welder is high and the signal from the tig torch is low, start the pulse
  if (welderSignal > 512 && torchSignal < 512) {
    // Set the output pins for the tig welder and tig torch to high
    digitalWrite(WELDER_PIN, HIGH);
    digitalWrite(TORCH_PIN, HIGH);

    // Wait for the background time
    delay(backgroundTime);

    // Set the output pin for the tig torch to low
    digitalWrite(TORCH_PIN, LOW);

    // Wait for the main time
    delay(mainTime);

    // Set the output pin for the tig welder and tig torch to low
    digitalWrite(WELDER_PIN, LOW);
    digitalWrite(TORCH_PIN, LOW);

    // Wait for the background time
    delay(backgroundTime);
  } else {
    // Set the output pin for the tig welder and tig torch to low
    digitalWrite(WELDER_PIN, LOW);
    digitalWrite(TORCH_PIN, LOW);
  }
}
```

To wire everything together, you will need the following parts:

- Arduino nano v3
- Multiplexer (e.g. CD4051)
- Three potentiometers (e.g. 10k ohm)
- Tig welder
- Tig torch
- Jumper wires

Here are the steps to wire everything together:

1. Connect the VCC pin of the multiplexer to the 5V pin of the Arduino.
2. Connect the GND pin of the multiplexer to the GND pin of the Arduino.
3. Connect the SIG pin of the multiplexer to the A0 pin of the Arduino.
4. Connect the S0, S1, S2, and S3 pins of the multiplexer to the 2, 3, 4, and 5 pins of the Arduino, respectively.
5. Connect the middle pin of each potentiometer to the A1, A2, and A3 pins of the Arduino, respectively.
6. Connect one leg of each potentiometer to the GND pin of the Arduino.
7. Connect the other leg of each potentiometer to the 5V pin of the Arduino.
8. Connect the tig welder to the WELDER_PIN (e.g. pin 6) of the Arduino.
9. Connect the tig torch to the TORCH_PIN (e.g. pin 7) of the Arduino.
10. Connect the power supply to the Arduino.

Once everything is wired together, upload the above sketch to the Arduino nano v3 and you should be able to use the three potentiometers to control the pulse parameters and add pulse functionality to your tig200 ac/dc!



Protecting the Arduino and other electronic components from high-frequency noise generated by the tig welder is important to prevent damage and ensure proper operation. Here are some ways you can protect the device from high frequency noise:


1. Use a shielded cable between the tig welder and the Arduino: A shielded cable has a conductive layer that helps to block high-frequency noise from entering the cable. It is important to ensure that the shield is properly grounded to prevent noise from entering the system.

2. Use a ferrite bead: A ferrite bead is a passive device that can be placed on the cable to attenuate high-frequency noise. It works by dissipating the noise energy in the form of heat, reducing the amplitude of the noise signal.

3. Use a low-pass filter: A low-pass filter can be used to attenuate high-frequency noise in the signal. This can be achieved by using a combination of resistors and capacitors to create a filter circuit that allows low-frequency signals to pass through while blocking high-frequency signals.

4. Use opto-isolation: Opto-isolation is a technique that uses a light-emitting diode (LED) and a phototransistor to isolate the Arduino from the tig welder. The LED is driven by the Arduino and emits light that is detected by the phototransistor. This provides electrical isolation between the two circuits, preventing high-frequency noise from entering the Arduino.

5. Use a metal enclosure: A metal enclosure can be used to shield the Arduino from high-frequency noise. The enclosure should be grounded to prevent noise from entering the system.

Using one or more of these techniques can help to protect the Arduino and other electronic components from high-frequency noise generated by the tig welder.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf