DIY Spot Welding With Bike Starter Relay and STM8

by sudipdatta2002 in Circuits > Soldering

155 Views, 2 Favorites, 0 Comments

DIY Spot Welding With Bike Starter Relay and STM8

IMG20260703075743.jpg
IMG20260703125112.jpg

Hey Everyone, tired of searching online for a cheap spot welding machine that costs over ₹6,000, or sketchier boards that have a very good reputation for MOSFETs blowing up?? Or have you already searched online for a DIY spot welding machine and felt overwhelmed by its complexity??

Well, if you have a drone battery lying around, then you can build a custom DIY spot welding machine with very few components on a prototype board for just ₹650 ($7 USD)! Even if you don't have a drone battery, you can buy one for ₹2,800 and use it for other projects as well—you just have to trouble yourself to disconnect the battery when you need it. No matter how you look at it, it is a win-win situation!

The entire project's circuit diagram and source code are in this GitLab project.


WARNING

Spot welding involves dumping massive amounts of current. Short circuits are extremely dangerous.

If you mess up, Lithium batteries will catch fire or explode. Seriously.

PROCEED ENTIRELY AT YOUR OWN RISK.


How It Is Different

After searching the Internet for a long time, I found two main DIY solutions for this:

  1. Microwave Transformer: Here, a microwave transformer is used to create high current, but this involves a lot of manual work, and working with 220V AC current is highly dangerous.
  2. Capacitor Method: This uses capacitors to store energy from 18650 cells and dumps the current instantly. We can completely avoid the LiPo battery price with this. However, these capacitors are not reliable. Plus, I already had a LiPo battery, so building it with capacitors would have cost more.


Inspiration

The idea that a bike's starter relay can do this came from this video: DIY Spot Welder Upgrade. I would highly suggest watching that video. It features the simplest DIY spot welder I could find on the internet.

But that method has two major problems:

  1. 555 Timer: A 555 timer is great because it removes the entire complex control circuit, but its lowest possible time limit is 100ms, which is too long for spot welding.
  2. Relay Controlling a Relay: The starter relay is a mechanical switch, so it has some delay when turning on and off. In that video, a small 5V relay switch is used to control the starter relay. Since each relay introduces its own delay of almost 5ms, precise spot welding at 10ms or 20ms is not possible with that setup.

In my system, I am using an STM8 to create a precise pulse time down to a minimum of 10ms. I can go even lower, but a 10ms minimum pulse is good enough for a spot welding machine. Additionally, I am replacing the 5V relay with an IRLZ44N N-channel MOSFET, which turns on and off instantly without any delay.

Supplies

Before we dive into the list, let’s clear something up: to stay under the ₹650 mark, I had to find unused starter relay from bike garage otherwise a brand new starter relay for bullet cost around ₹900 alone.

Core Components & Electronics

  1. 1x Secondhand Royal Enfield Bullet Starter Relay (₹200 / ~$2.40 USD): The power circuit of this project which will carry over 150 Amps for a short amount of time
  2. 1x STM8 Microcontroller (₹93 / ~$1.10 USD): Then brain of the circuit which controls the pulse and check battery voltage
  3. 1x Mini 360 Buck Converter (₹30 / ~$0.35 USD): 12 volt to 5 volt step down buck converter
  4. 1x TM1637 Display Module (₹45 / ~$0.55 USD): Display module to show pulse time and battery voltage
  5. 3x Push Buttons (₹15 total / ₹5 each): pulse time up button, down button and pulse trigger button. For checking battery voltage hold up and down button together.
  6. 1x IRLZ44N N-Channel MOSFET (₹39 / ~$0.45 USD) – ⚠️ CRITICAL WARNING: Do not buy IRFZ44N mosfet. It won't work with microcontroller pin voltages
  7. 1x 1N5408 Diode (₹4 / ~$0.05 USD): Flyback diode so relay does not kill the circuit
  8. 1x 9x15 Prototype Board (₹68 / ~$0.80 USD): we can use smaller prototype board too. circuit is much smaller
  9. 1x XT60 Male Connector (₹20 / ~$0.25 USD): plugging with drone battery
  10. 14AWG Silicone Wire (₹98 / ~$1.15 USD): wire to carry this massive 150 amps current, I think 12AWG will be much safer.
  11. 2x Copper Tips (₹30 total / ₹15 each): tips for soldering
  12. Resistors: (1x 10kΩ, 1x 220kΩ, 1x 29kΩ, 1x 9.2kΩ)
  13. LiPo Battery (₹2800 / ~$30 USD): 5200mAh 35C LiPo battery. batteries that can deliver over 150Amps is preferable.


Required Tools & Accessories

  1. Soldering Iron
  2. Multi-meter
  3. ST Link V2: To programme stm8
  4. Variable Power supply(If possible): Variable power supply with current limiting feature is useful in development. In we plug the lipo battery directly and short circuit happens then everything will burn including the battery. In my case I used my DIY power bank,it does not have current limiting feature but it disconnects when short circuit happens and it helped me to make this project in one go without blowing up some components.

Salvaging the Engine of This Project: Starter Relay

starterRelayLabel.jpg

If you skip this step, you have basically gathered the entire body of a sports car but forgot the engine. The starter relay is the absolute heart of this build. If it fails, your welder fails. Because we are buying a cheap, unused, or secondhand relay from a local motorcycle garage, the chances of getting scammed are high. Here is how this relay works and how to get a working relay out from the garage.


Starter Relay 101

A motorcycle starter relay is just a massive, heavy-duty switch. When you start a motorbike, the starter motor needs a huge amount of current to turn over the heavy engine. The relay safely passes that current for a short amount of time, the exact requirement for our project.

The relay has 4 connections:

  1. Two Thick Wires/Terminals: These pass the massive current to your welding tips.
  2. Two Thin Wires: These are the control wires.

When current passes through the two thin wires, an internal electromagnet moves a heavy metal plate inside the relay. That plate slams shut, connecting the two thick wires. When power is cut, the plate snaps back and disconnects them. It is simple, brutal, and incredibly effective.

For this project I chose royal enfield bullet classic starter relay. It is much more beefy and sturdy than normal 100cc scooter or motorcycle.


Why not use Mosfets

First you have to understand this relay on off is a mechanical process. No mater how good and efficient the relay is, it will waste some time to on and off the relay. I checked online and I found out it takes aroud 5ms. Some of you may ask why not use multiple mosfets then, it also serves the same purpose.

Yes In ready made circuit board this power circuit consists of multiple mosfets. these are small components that can be easily fitted in circuit board. But I am not using any circuit board at all, I am only using a prototype board. And my only 1 week soldering skill does not help either. yes mosfet eliminates the delay entirely, but is the complexity for a prototype board worth it??

I have to solder multiple mosfets in the prototype board at first and that is the easy part. I have to create proper current path so that it can safely carry this large current and does not burn my prototype board. The amount of calculation and assumption was too much for me. so went with starter relay with minor delays.


Now for the boring part, salvaging working unused starter relay from garage.

Before buying, follow this steps so that you don't get scammed while buying.

  1. Check Label of the relay: Check the label on the back of the relay and search for it in google or ask chatgpt if it is bullet relay or not. attaching my relay switch relay label.
  2. Check the internal resistance: Place a multimeter between two thin wires and measure the resistance. A working bullet starter relay have 3 to 5 ohms of resistance.
  3. Check the sound: Ask the shop owner to show if it is working. When you connect and disconnect 12 volt between then thin wires, you will hear a sharp metal clink sound from the relay. If you are not hearing any sound or sound is dull then don't buy it.

Design the Circuit Board

circuit.png

Before going into circuit board let's understand first how this brain and other supporting components of this spot welding machine is working.


First the absolute basic of this circuit board. Forget about the display and buck converter and voltage divider circuit to measure battery voltage. Let's understand the bare minimum of this circuit.


STM8(blue pill) is the brain of this controller circuit. Look at the A3 pin of the circuit it goes directly to IRLZ44N mosfet gate pin and this mosfet is controlling the bike relay. As mentioned before the resistance inside the relay switch is very low near 3 to 5 ohm and it needs around 12 volt to turn on. First of all the microcontroller pin will only output 3.3 volt and if we connect it directly to relay switch the amount of current flowing through the microcontroller will instantly fry it. So I am using the mosfet as a small switch to turn on the big relay switch.


IRLZ44N is a N channel mosfet which turns on with low voltage in gate. when gate is high it connects the source and the drain, so current passes through source and drain and relay switch is connected to the 12 volt lipo battery directly. We could use a small 5v relay switch, but it'll again have delay. So using mosfet in this case is much smarter choice. 220 Ohm resistor is connected between gate and the pin to limit the current and 10 ohm between gate and the source to pull down the mosfet when A3 pin is low.


IN5408 diode is used to protect the circuit from back EMF current from the relay. So from battery to relay it is placed in reverse bias. When back emf comes the diode is in forward bias and it loops the current back into the relay.


Buck converter is used to convert 12 volt to 5 volt for the microcontroller. And 29kOhm and 9.2kOhm are the voltage divider to calculate the battery voltage.

WARNING: Be extremely careful when placing the resistors with the pin, If you swap there position, the microcontroller will be damaged.


One push button is used to increase the pulse time and other to decrease and the last push button to trigger the pulse. When both up and down button is pressed together battery voltage will show up.

Programme the STM8

voltageDividerLogic.png

I have already linked the circuit diagram and code for this project in the above link in Introduction. I am using Vs code and platform.IO to programme the STM8. you can search online how to setup stm8 with platform.IO. Also ST-Link V2 is needed to programme the STM8. I won't say it is as easy as programming esp but it is not that much hard.


One thing to note I could not figure how to use System.debug to read message from vs code. So I have used the inbuilt led as indicator to check if the code is working while in development.

Also I could not use standard TM1637 library due to some c++ compilation issue, so I created a very basic file to display numbers and some characters.


I am not using delay in the main code. I am only using delay when connecting to display and display is updated only when value changes. I did it to remove any duplicate trigger so that the pulse is precise and no duplicate pulse comes and ruins it. So the code may look complex but it is a very easy code. I am using start time to store when button is pressed and calculating if certain amount of time has passed then triggering the pulse. If you understand how the pulse is firing the entire logic is very easy.


The voltage divider logic is added in the comment of the code. This explains why I chose those two resistor values in my case. To calculate the voltage precisely I am using a 20 integer array to calculate average voltage. It is much more accurate.


The pulse will only trigger only when the voltage is between a certain range in my case 10v to 13v. Check the attached image to see how the calculation is done.

Assemble the Components

circuit-back.jpg
IMG20260703122802.jpg

Before moving to soldering all the components in the board, I would suggest look at the circuit diagram closely and use pen and paper to create a diagram to place the components in correct way and design the circuit path. As you can see in the image I tried to use very less wires to avoid short circuit. so after the soldering is complete there is no way to change the path.


While assembling the components try not to use Lipo battery at all, if any short circuit happens then the entire project is for nothing. So while testing it use other 12 volt power source with low current output.


I made this list to assemble the components in order.

Buck Converter: First place the buck converter in the prototype board and connect the ground, input and enable pin with power source. Adjust the output voltage with a screw driver and measure it with multi-meter. The output voltage should be between 5 to 5.5 volt.

STM8 Micro-controller: Place the micro-controller board now. I would suggest solder female pin holder in the prototype board and place the STM over it, so we can remove it for another project if we want. While placing the stm8 check carefully the pin alignment, otherwise have to use wires to connect the components.

  1. A3 pin is used to control the mosfet for starting the relay switch
  2. D5 ADC pin is used to calculate the battery voltage
  3. 5v and GND pin is connected to buck converter for power
  4. D3, D1 and C3 are used to connect increase, pulse trigger and decrease button
  5. C6 and C5 is used to connect to display for communication

TM1637 Display: place the display module beside the stm and connect CLK and DIO pin with C6 and C5 respectively. Connect VCC with 5v and connect to common ground in GND pin.


After attaching these three components connect to power. Check if display is working. Right now the display will show error message because we have not attached the voltage divider yet. But this confirms that all three components are working correctly.


Voltage Divider Resistors: I am using 29kOhm and 9.2kOhm resistors for voltage dividers. When placing the resistors follow this step very carefully. Attach 29 kOhm one end to positive terminal of power source and other end to pin D5 of stm. And attach one end of 9.2 kOhm with D5 pin and other pin with common ground.


Check again now default pulse time 30ms would be displayed in the display.


Connect buttons: Attach Increase and decrease buttons in the board and connect to D3 and C3 pin respectively. so all the switches are connected to ground. when the button is pressed the pins read low. use thin wires to connect the trigger button, we'll attach this button with one end of soldering wire.


Test again with increase and decrease button if the pulse time is increasing and decreasing and displaying correctly in the display. Test the trigger button also, right now only the on board led will glow for the pulse time.


IRLZ44N Mosfet: Check in the internet how to identify which pins are gate, source and drain. Connect 220Ohm with A3 pin and gate pin and source with common ground. Add 10KOhm pull down resistor between gate and source.


IN5408 Diode: Be very careful when adding the diode in the circuit. Connect the cathode pin(gray strip) with positive 12 volt and anode pin with ground so when current passing from battery to relay switch diode is in reverse bias, no current flows. When back EMF comes diode is in forward bias and loops back the current to relay.

So the controller circuit is complete now.

Starter Relay: Before adding the starter relay in the circuit make sure to insulate the thick wires properly first. Add the thin wires of relay with the diode, direction does not matter.


Attach the power source and now when when trigger is pressed the relay switch will now turn on for that pulse duration and automatically turn off.


LiPo Battery: Generally all lipo batteries come with XT60 female connector. Check the attached male connector photo. One end of male connector is connected with thick wire of relay switch and other end with the 14AWG wire. And two thin wires are connected also to XT60 male connector, those wires are connected to prototype board which is powering all the controlling circuit and switching the relay switch. The 14AWG wire's other end is connected with a copper tip and same for the other thick wire of the relay switch. These two wires are acting as welding probe and the trigger switch is connected with one of them. Be very careful when connecting the XT60 connector, check the positive and negative marking and connect the wires accordingly, especially for the thin wires.


Now check again if everything is working, try spot welding too. If everything is correct pack it. Use heat shrink tube where copper tips are connected.

Calibration

The default pulse duration in the code is 30ms. With my battery it is the sweet spot for 0.1 mm nickel strip. But for the first time use, reduce it to 10ms and test if it is working correctly or not. Then increase the time gradually.

Conclusion

output-rot.gif
out1.png

So there you have it! A fully functional, budget-friendly spot welding machine.

This build is absolutely perfect if you already have a drone battery lying around. Designing and building this entire project taught me so many things about circuit design, MOSFET logic, STM8 programming, and a whole lot more. The 4 days I spent building this project were painful, true, but an absolute blast as well!

If anyone else tries to create their own spot welding machine, hopefully, you will have a great time too.

Attaching this cool frame and GIF for those lucky adventures.


Before you go

  1. Always unplug the battery after spot welding finishes. This is a plug and play system.
  2. Use sandpaper to keep the copper tip sharp.
  3. Test the battery and the soldering wire temp after some welds. In my case after 10-15 welds the 14AWG wire starts to heat up a little while battery remains cool. That's why I think 12AWG wire would be perfect fit for this.