Optoisolator for welder trigger

Hi there,

I have built a timing circuit that I want to use to trigger a pulse on a Tig welder, everything is working except interfacing with the welder.

I just need to close 2 pins together on the welder which I measured has 12v across them, I found this thread, and I have connected a PC817 optocoupler as shown but It is not triggering. Am I missing something here?

I would like to keep the circuits as isolated as possible, I have a couple HW-532 mosfet boards which I took the optoisolator from, so can use that if needed.

Thanks for your help!

Hi, @jackdavies

Can you please post a circuit diagram showing how you connected the opto to your controller and to the welder controls?

What model Arduino are you using?

Thanks... Tom... :grinning: :+1: :coffee: :australia:

1 Like

The circuit as shown should work for its original purpose. It may not necessarily work for your purpose, since we have no idea how much current flows through that "12V signal".

We'd also need to see the code you are using to trigger the sensor.

Basically at this point we can't offer anything but guesses.

Thanks for the replies @TomGeorge @cedarlakeinstruments I have attached a circuit diagram, code and picture of a similar trigger button that I am trying to replace with the arduino.


#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#include <Fonts/FreeMonoBold12pt7b.h>

Adafruit_SSD1306 display = Adafruit_SSD1306(128, 64, &Wire);

// INPUT: Potentiometer should be connected to 5V, GND and pin defined below.
int potPin = A0; // Potentiometer output connected to analog pin 3
int potVal = 0; // Variable to store the input from the potentiometer

const int triggerSwitch = 2; // Connected to the trigger on the torch
const int gasSolenoid = 3; // Connected to the SSR which triggers the gas solenoid
const int weldOutput = 5; // Connected to the welder switch input

const int gasPreflow = 1; // Hard coded gas preflow time
const int gasPostflow = 1; // Hard coded gas postflow time

void setup()
{
    display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
    display.setTextColor(WHITE, BLACK);
    pinMode(triggerSwitch, INPUT);
    pinMode(gasSolenoid, OUTPUT);
    pinMode(weldOutput, OUTPUT);
}

void loop() 
{
  potVal = analogRead(potPin);                // Reads the value of the potentiometer (value between 0 and 1023)
  potVal = map(potVal, 0, 1023, 500, 1);     // Scale it to use it get the right time (value between 10 and 500)

  display.clearDisplay();
  display.setFont();
  display.setCursor(14, 5);
  display.print("Batt Pulse Welder");

  display.setCursor(28, 55);
  display.print("Milliseconds");

  display.setFont(&FreeMonoBold12pt7b); // Sets larger font for the number display

// Move curser based on number of digits to ensure the value is centred
  if (potVal <10){ // Single digits
    display.setCursor(54, 40);
  }
  else if (potVal <100){ // Double digits
    display.setCursor(46, 40);
  }
  else{ // Tripple digits
    display.setCursor(40, 40);
  }
  display.print(potVal);

  display.display();

  if (digitalRead(triggerSwitch) == HIGH){ // Trigger on the button press
        digitalWrite(gasSolenoid, HIGH); // Start the gas flow
        delay(gasPreflow*1000); // Mulitply the seconds to get milliseconds
        digitalWrite(weldOutput, HIGH); // Start the welding pulse
        delay(potVal); // Duration of weld pulse
        digitalWrite(weldOutput, LOW); // Stop the weld pulse
        delay(gasPostflow*1000); // Mulitply the seconds to get milliseconds
        digitalWrite(gasSolenoid, LOW); // Stop the gas flow
  
    }
}

Did you try reversing pins 3 and 4 on your opto-isolator?

1 Like

@jackdavies by now you may have damage your opto.

Try this testing circuit, see if the LED does what it should:

Sry if it looks like I drew it with my finger. There's a reason for that.

a7

Too much code. Use the smallest amount of code you can to debug a problem. Try this.

void setup()
{
  pinMode(5, OUTPUT);
  while(1)
  {
      digitalWrite(5, HIGH);
      delay(10000);
      digitalWrite(5, LOW);
      delay(10000);
  }
}

void loop()
{
}

That should toggle it on and off every 10 seconds.

I'm too old for that. If all you are doing is checking, use a way smaller delay - waiting 10 seconds to see an LED go on or off is an eternity. :expressionless:

a7

Not sure how the welder will respond to short cycles.

I wouldn't connect the real welder to this project until all kindsa other issues were completely solved.

Thus my advice to use a proxy LED on the opto output, which opto as far as I remember has not shown itself to be functioning.

a7

Hi guys,

Thanks to all for the responses so far, I swapped out the opto and changed the resistor to 1k which was what was on the HW-532 mosfet board that I took the opto off.

With the 220ohm there was a measurable signal but not enough to light an LED, I put the LED on pins 1 & 2 of the opto to make sure the arduino was outputting to the pin. It is working now, however it feels like the switch is 'soft' and when plugging in the normal switch trigger, it is a much stronger pulse. As I am writing this now I kind of realise that the 1k resistor is probable not the right value, and could be causing this 'soft' behaviour. I did test two different 220ohm resistors though so thats also quite weird.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.