Spot welder with Arduino

Some time ago I have decided to make myself a electric bike — e-bike as they are called now. However, buying a stock solution, I mean a stock e-bike, was not an option because mainly of two reasons. The stock e-bikes are quite expensive stuff, this is one. The second one is about the actual parameters of the electrical bicycle. Manufactures sell e-bikes which have limited power output to 250 Watts and are only meant to support you and not drive themselves. But wait a minute … This should be about a spot welder not the e-bike ;). Well, each electric devices ought to have a power source and this is how the idea about making my own spot welder was born.

Basics — what is a spot welder?

A spot welder is a device which works pretty much as a welder but is limited to a small area. You put two electrodes next to each other on top of a conducting material, like a nickel plated tape, and you allow current to flow — short circuit for a while. Because of the high current (hundreds of amperes) the spot where electrodes are placed gets really hot, thus the metal is melting and gets joined. You can use it to connect Li-Ion batteries together and that was the reason for my introduction.

Electric circuit

I have started with a schematic from “Nowy Elektronik 4/2004”. It was also used in a similar construction like here Zgrzewarka punktowa do zgrzewania pakietów ogniw Li-Ion Ni-MH itp. (in Polish).

In short, above does not work, at least not always. The problem with this is that a single thyristor was used. That is why people from “Nowy Elektronik” also have used a diode bridge because thyristors conduct only one way. The device works as follows, it gets an input signal through MOC3041 (optoisolator with zero-crossing detection) and then the thyristor opens and starts to conducts. This works like charm but it does not want to turn off. So when I have built it I have end up with a welder instead of a spot welder.

What is curious is a fact that spot welders based on similar design work. In normal conditions when there is no current flowing through thyristor and the gate is not triggered it should stop conducting. In my case I was unable to turn it off so I decided to go with a different approach and use two thyristors instead of one.

A proper electric circuit

Below you can see a design which uses two thyristors.

And here it is:

Now, each thyristor is driven correctly and conducts only for a half sinusoid in one period. When one thyristor is finishing the other one is taking over and it continues. Also proper turning off is provided because when the sinusoid crosses zero the current goes from positive to negative value (crossing zero on the way) and this turns the thyristor off.

So far I have shown only “end device” which is responsible for switching high currents. What is also needed is a driver. That was made with Arduino. This is yet another simple design like blinky. It involves a 7 segment display, and two micro switches for input, and a trigger — output to start the other part of the device introduced above.

Transformer

Another important part of the design is a transformer. In my case I have used one from a microwave which has power of 800 Watts. The problem with it is that you can not use it right away. You have to rewind it to actually meet the requirements. A transformer from microwave is used to create a high voltage from 230 Volts but we need a low voltage (a couple of volts) but a hundreds of amperes. So, you have to rewind it but only the secondary coil. It has a lot of wires and they seat there firmly. To get rid of the secondary winding you have to cut through the wires. Remember to not to cut through primary winding. After cutting one part of secondary winding which has stuck out you will have to use some force. A hammer and a piece of wood should work to knock it out. Once again, be very careful to not to destroy primary winding! After that you have to put 4 winds of a thick wire. I have used a wire with 25 mm^2. It will require some sweating but it is completely doable. My transformer has around 250 winds on the primary coil and only 4 on the secondary. You probably know below equation:

Np/Ns = Vp/Vs = Is/Ip

where N is number of windings, V is voltage and I is current. Lower index p means the primary winding and s means the secondary winding. So, at the secondary winding I should get something around 4 Volts and this in turn means that I should be able to produce around 200 Amperes!

The secondary winding has welder sockets as can be seen below. Those were used because of the very high current and they come also with impressive plugs 🙂

 

Electrodes

Another important thing after the transformer are electrodes. Below you can see mine:

I am using some welder plugs which can be inserted into the transformer directly.

Please also notice the endings of the electrodes. Those were ground to get a pointy ending so the process of spot welding would be easier and above all the current would run only through this tinny space.

Also to one of the electrode’s a micro switch was attached which triggers the welder — you can see this in the image above. The idea was taken from Zgrzewarka punktowa do zgrzewania pakietów ogniw Li-Ion Ni-MH itp.

Electrode itself was made of copper rod with diameter of 6 mm. Each was attached to the 25 mm^2 wire with eyelet connector, like this one below, the rod and the eyelet were soldered together.

One short remark about the electrodes. As I mentioned earlier I had to ground the electrodes’ endings. This pointy ending gets damaged over some work hours. Good idea is to use a bit longer copper rods so the electrode could be ground and cleaned in the future to maintain good conduction between the electrode’s ending and the working space.

Arduino

One might ask where is the Arduino. Don’t worry it is here. The most popular Arduino Uno was used and other peripherals were attached to it using ordinary wires.

Software

A simple program was written for Arduino. Below you can see the complete source code:

#include "SevSeg\SevSeg.h"

SevSeg sevseg; 
int change;
int number = 1;

#define SW_TRIGGER     3
#define SW_CHANGE      4
#define OUT_POWER      5

int sw_change_state;
int sw_tigger_state;

// the setup function runs once when you press reset or power the board
void setup() {
    byte numDigits = 1;
    byte digitPins[] = {2}; 
    byte segmentPins[] = { 6, 7, 8, 9, 10, 11, 12, 13 };

    sevseg.begin(COMMON_ANODE, numDigits, digitPins, segmentPins);
    sevseg.setBrightness(10);
    
    pinMode(SW_TRIGGER, INPUT);
    digitalWrite(SW_TRIGGER, HIGH);
    pinMode(SW_CHANGE, INPUT);
    digitalWrite(SW_CHANGE, HIGH);

    pinMode(OUT_POWER, OUTPUT);
    digitalWrite(OUT_POWER, LOW);
}

// the loop function runs over and over again until power down or reset
void loop() {
    int digit, comma;

    if (change > 10000)
    {
        ++number;
        if (number > 9)
            number = 0;
        change = 0;
    }

    if (digitalRead(SW_CHANGE) == 0 && sw_change_state == 0)
    {
        delay(40);
        if (digitalRead(SW_CHANGE) == 0 && sw_change_state == 0)
        {
            number++;
            if (number > 19)
                number = 1;
            sw_change_state = 1;
        }
    }
    if (digitalRead(SW_CHANGE) == 1 && sw_change_state == 1)
        sw_change_state = 0;

    if (number >= 0 && number < 10)
    {
        digit = number;
        comma = 1;
    }
    else {
        digit = number - 10;
        comma = 0;
    }
    sevseg.setNumber(digit, comma);
    sevseg.refreshDisplay();

    if (digitalRead(SW_TRIGGER) == 0 && sw_tigger_state == 0)
    {
        delay(40);
        if (digitalRead(SW_TRIGGER) == 0 && sw_tigger_state == 0)
        {
            digitalWrite(OUT_POWER, HIGH);
            delay(number * 10);
            digitalWrite(OUT_POWER, LOW);
            sw_tigger_state = 1;
        }
    }
    if (digitalRead(SW_TRIGGER) == 1 && sw_tigger_state == 1)
        sw_tigger_state = 0;
}

I have used SevSeg library to drive the 7 segment display which gets the job done and in addition I did not have to bother with it myself. Below you can find whole project for the Arduino. The only disadvantage to driving the display with this library is that during spot welder’s operation it flickers for a moment. It is because the whole service of the display is inside loop() function where delay’s are present. Although the flickering does not bother me a different library or even external driver, like this one described here Simple Dual Thermometer, could be used with success.

If you are interested in the whole project feel free to download it from here

SpotWelderProject.zip

How it works?

The hardware has two inputs in a form of two micro switches. For the sake of this post let’s call them like they ware named in the program SW_CHANGE and SW_TRIGGER. The first one (SW_CHANGE) is responsible for changing the time of impulse duration. You can tune it with a grain of 10 ms, from 10 ms to 190 ms. Current setting is shown on the 7 segment LED display. For times from 10 ms to 90 ms it shows a single digit from 1 to 9. Next setting is 100 ms but the display shows 0 and a dot. For 110 ms you get 1 and a dot and so on. When you reach 190 ms and press SW_CHANGE switch one more time it starts counting from 10 ms. Basically, when you see a single digit without a dot you have to multiply the value show on display by 10 and you get the outcome in milliseconds. If you see also a dot you should multiply the value by 10, like before, and add 100.

The other input is SW_TRIGGER. When you press it it puts OUT_POWER output to high state ‘1’ that in turn triggers the optoisolator. After that execution stops for a desired period and once again OUT_POWER is set but this time to a low state ‘0’.

Also some primitive debouncing for micro switches was implemented to avoid multiple changes of period and triggering the device.

Some more photos

 

Final remarks

Well, the only one thing that is bothering me is that the whole device has no case. It would be nice to have one 😉

Spot welding …

Since I started with my electric bike then here you have two accumulators spot welded by me. The configuration of a single accumulator is 6S12P. One 1S is made of those bricks

Here you have a single accumulator 6S12P with a balancer plug 🙂

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.