DIY 4kW Induction Heater
by Learning on Demand in Circuits > Electronics
217 Views, 1 Favorites, 0 Comments
DIY 4kW Induction Heater
Hello there! I made a 4kW induction heater capable of melting a wide variety of metals, such as copper, steel, brass, and aluminum, either in a graphite or ceramic crucible or in open air. It has also sustained ~5.2kW for several minutes (until the breaker tripped). For more info and footage, watch my 2 YouTube videos on the topic here.
This isn't a project for complete beginners in electronics; you will need to follow the schematic and install all components correctly. That being said, I hope this project motivates you to learn all you need to be able to understand and build it yourself. There is an endless supply of electronics knowledge on the internet, just a few clicks away; start with smaller and easier projects, and once you feel ready, come back to this one. I wish you the very best. You've got this!
In this Instructable, I just show you the way I built it; you are free to make your own changes as you see fit.
Supplies
These are the components I am using. Feel free to use different ones if you need to and if you know what you are doing. This is not a cheap project by any means. If you already have an oscilloscope, a soldering station, and a bench power supply, you may be looking at anywhere between $400 and $600, most of which will go toward the power capacitors and the inverter MOSFETs. If you don't, then factor in another $200-$600 for a decent oscilloscope, and another $100-$200 for a decent soldering station plus DC bench power supply. So in the worst-case scenario, you could be looking at $1500, not accounting for accidentally destroyed parts that would need to be replaced. For this reason, I suggest you try to get at least the most expensive components second-hand, for example, the power capacitors that go together with the heater coil to form the resonant LC tank.
Also, I didn’t add a link to every component on the list, just to a few; sorry bout that.
Bill Of Materials (BOM):
- 12V Power Supply (x1). Needed to power the PCB, fans, and water pumps; It should be capable of supplying at least 100W.
- A buck converter for converting 12V down to the 3.3V required by the microcontroller and OLED display.
- Oscilloscope, at least 2 channels. Handheld ones are cheaper.
- A decent soldering station. Don't buy the cheapest crap, or you'll go bald before you finish the build.
- A prototype solderable PCB. Needs to be big enough to fit all the PCB components on it. I use a 100x70mm one, I believe.
- A spool (> 20 meters) of ~0.22mm diameter (31 AWG) enameled copper wire. I wound the feedback transformer using this wire. I wound around 100 turns, and the thin wire makes that easier.
- 10-15 meters of 12AWG flexible wire to wind your coupling transformer. Litz wire is actually recommended here; it is a pain in the backside to make but here is a video on how to do it.
- STM32F103C8T (Blue Pill) Microcontroller (x1). If you use a different one, paste the code in ChatGPT/Claude/Gemini and tell the AI to adapt the code to your specific microcontroller. Try to avoid a microcontroller with a WIFI antenna, since it tends to pick up EMI from the power stage and crash, forcing you to reboot it, potentially mid-melt, which wouldn’t be very healthy for your MOSFETs.
- ST-Link V2 Mini Debugger And Programmer Emulator (x1). You will need this for communicating via USB with the STM32 microcontroller.
- MIC4421/MIC4422 pair (x1) (better grab a bunch, so you have spare ones). These are the gate driver chips. The signal coming from pin A8 of the STM32 is too weak to drive any MOSFETs or a gate-drive transformer, so it is the job of the MIC4421/MIC422 pair to receive that signal through one end, make it strong, and spit it out the other end, ready to drive anything in its way. Additionally, the MIC4422 will invert the signal (flip it upside down), so the combined signals gain even more strength.
- Ferrite ring B64290L45X830 (x1). This will be the ferrite ring for your Gate Drive Transformer (GDT). You can use a different one, but it needs to have high inductance per turn ( >2000 uH ). The GDT enables you to run the inverter (a full-bridge of 4 MOSFETs) while providing galvanic isolation, meaning there won’t be a direct current path between the power stage and the PCB, thus giving us a physical cut between high and low voltage circuits.
- Capacitors
- 6.8uF / 50V film x2 (I have MKPs)
- 100nF ceramic x2
- 22nF ceramic x2
- 1uF / 50V ceramic x1
- 470nF ceramic x1
- 20uF 900VDC MKP (Vishay MKP1848620094P5) x2
- 1.6uF/1100V/600A/500kvAr from Celem (x2). These are expensive, but you can use just one. I use 2 I found on Ebay @ 90$ a piece. I also have some from a Chinese company named Anxon, which are 10uF, 1000A, 700V. Higher capacitance will give you a lower Fres (Resonant frequency). Illinois Capacitors also have good ones. The important thing is that these capacitors need to be water-cooled and that they have a high kVAr rating, which is crucial for an induction heater.
- IXFN56N90P MOSFETs (x4). These MOSFETs will be used for our full-bridge of transistors, a.k.a H-bridge (because it looks like an H in the schematic)
- Water-cooled aluminum heatsink. To cool the MOSFETs.
- Thermal Pads 20 W/m*k. To be placed between MOSFETs and the aluminum heat sink.
- Ferrite ring ZP48613TC (x5 or x10 if you want to wind 2 transformers with different number of turns). These will form your coupling transformer.
- Ferrite ring FT 240-77 (x1). This one we’ll use to wind the feedback transformer. Mine is small in diameter, but there are big ones too. Smaller is easier.
- Resistors
- 100 Ohm 5W resistor x1
- 20 Ohm 5W resistors x4
- 10k 1/4W resistors x8
- 470 Ohm 5W resistor x1
- 330 Ohm 1/4W resistors x3
- 2k 1/4W resistor x1
- 1M /1/4W resistor x1
- Diodes
- Zener Diode 1N4744A 15V x8
- Fast Switching Diode 1N4148 x2
- Light Emitting Diode (LED) x2
- Schottky diodes DSEP60-12AR 60A 1.2kV x4 (Maybe a bit overkill)
- Momentary Push Buttons (x2).
- DPDT Switches (x2).
- LM339 Comparator (x1). This will make a clean square wave out of the feedback signal, which will then go on into the microcontroller for resonance tracking. If you know your comparators, feel free to pick a faster one; this one is pretty slow, although it still works for this application.
- I2C OLED 128x64 4-pin (x1). If you have a differently sized one, adjust the code accordingly or ask the AI for help
- Copper tube (soft). At least 8mm OD; Bigger diameter = more copper = less resistive heat losses, but trickier to bend without the tube collapsing. For better odds, fill it tight with sand or pressurise it up to 2-3 bar above ambient pressure.
- Copper bus bars (flat copper rod) x2. At least 3mm thick, they should be wide enough to cover a decent portion of the mounting surfaces of the resonant capacitors. (See pictures below)
- 12V water pump (x2). 0.5bar, 10L per minute.
- Silicon hoses for the water cooling.
- 12V cooling fans (x2). For cooling the PCB, especially the gate driver chips, they can get up to 40°C. This may be because I have the PDIP package. If you get the TO-220 package (you should), you can screw them to a heat sink.
- Water temperature sensor DS18B20 (x1).
- Aluminum Heat Exchanger Water Cooler with fans (x2 at least). One (or two, or three!) to cool down the water reservoir that keeps the work coil and capacitors cool, and another one to remove heat from the water reservoir that keeps the H-bridge (and full-bridge rectifier if you use one) cool.
- TO SUPPLY THE INVERTER (a.k.a H-bridge) WITH POWER
- Either a powerful DC power supply (I have a 3kW one from Mean Well that can deliver 12A at 250VDC). This is the safest option since you don't have to mess with AC mains.
- OR, you supply your own DC by rectifying the AC mains from your wall (dangerous!). For this, you will need a full-bridge rectifier; I use the GBPC5006. Then, for smoothing the voltage ripple, I use 3mF of electrolytic capacitance in the form of 3 1mF 400V B43305A9108M. Bad power factor is a problem here, so I improve it passively by adding a 5mH 20A choke inductor in series with the AC line, right before it goes into the bridge rectifier.
I hope I did not forget anything. If so, let me know in the comments or in an email (gesuendergeist@gmail.com)
Set Up Microcontroller & Gate Drivers
It all begins with a microcontroller, to which you will need to upload this code I wrote to get it working right for this project. I configured this code to work with the Arduino IDE, since that is what I expect most of you to use. You will need to use the ST-Link V2 Mini Debugger and Programmer Emulator for communication between your computer and the STM32. When testing it with your own hardware, do so at low power. When testing the feedback mechanism, you may have to make some fine-tuning so it locks perfectly at the resonant frequency of the LC tank. The fine-tuning process works as follows:
In the code, you will see the following line: `const float TARGET_PHASE = 22.0f`. This is because I am targeting 22 deg of phase discrepancy between the signal that I send out and the signal that comes in. Yours might be exactly 22 as well, a bit less, or a bit more. The way you check is by adjusting the frequency manually until both the inverter wave and the feedback wave are in phase with each other, while checking that the power draw has reached a maximum, then look at the OLED screen to see what the value of P is. In the image above, you can see I am at 25 °, which is almost at Fres in my case. Whatever value you end up with, that is what you will need to write as the value of TARGET_PHASE (plus 2 ° for extra security, to prevent the inverter from going down past Fres into the capacitive region, where a lot of nasty voltage spikes will develop and potentially damage the MOSFETs). If you are wondering why around 20 ° of phase difference and not something closer to 0° (since we want both signals in phase, right?), it is because the LM339 is a fairly slow comparator. There are faster ones like the TLV320* family (which I plan to upgrade to in a future improved build of my big inductor). You can choose to directly buy and test one of the fastest ones and then see how much closer to 0° the phase difference ends up. Anyway, once the code has been calibrated, you can run the induction heater again, push the button that activates the auto-locking mechanism, and watch the uC track and lock onto Fres by itself. To safely unlock, just push the button again. It could be the case that when you try the lock mechanism, the logic goes searching for Fres in the wrong direction. In order to avoid this, swap around the connections of the GDT to the gate driver chips so the signal goes in the opposite direction, and that should do the trick! Another way to accomplish the same result is to put the wire of the feedback transformer that goes to ground as the one that carries the signal into the LM339, while the other now goes to ground instead of into the LM339.
Have a look at the Pin Map in the README.md file to learn which pins put out what signals. For example, from pin A08, the program sends a PWM signal to both an inverting and a non-inverting gate driver chip (MIC4422/MIC4421); one inverts or flips the signal so it is the opposite of what it gets, whereas the other one passes it as it is, that way when one half-bridge closes, the other one opens up, and so on.
I know the PCB looks horrible, but if you can follow the schematic, wire it all up on a breadboard first, and you'll see it is not that complicated after all.
GDT
These gate drivers then amplify that signal enough to power a Gate Drive Transformer (GDT) with 1 primary winding and 4 secondary windings (around 15 turns, I twisted the 5 cables using a drill. Beware the correct phases!). I use the core B64290L45X830. The GDT allows us to run the inverter while also providing galvanic isolation, meaning there won't be a direct current path between the power stage (high voltage) and the PCB (low voltage). The 4 secondary windings drive the gates of the 4 MOSFETs that form the full-bridge inverter.
There is a fantastic video on how to wind a GDT by Kaizer Power Electronics on YouTube. Watch it.
Downloads
Inverter/H-bridge
The 4 secondary windings drive the gates of the 4 MOSFETs that form the full-bridge inverter, which, through a coupling transformer, is responsible for driving the resonant tank circuit that will heat the metals. The MOSFETs need to be water-cooled; that is what the water-cooled aluminum blocks are for. Between MOSFETs and the aluminum block are thermal pads with 20W/mK, 2mm thick; make sure they are at least 16W/mK since they need to conduct enough heat, and the thinner the better. I used zip ties to mount the MOSFETs to the aluminum block; they work great, but the honest reason I use them is that I tried tapping the aluminum block, hoping to then screw the MOSFETs in place, but that was a total disaster.
The material the coupling transformer is made of is of utmost importance; material P, which is a special mixture of manganese and zinc powder, is what I found to be the best so far and what I would recommend. 5 toroid rings stacked together. You will find a link to it in the materials section. I actually use 2 transformers, one with 15 primary turns for graphite crucibles because they have high resistivity, and one with 21 primary turns for less resistive loads (aluminum, brass, copper, steel, and iron…). Use Litz wire if you can; here is a video showing how to make it. Flexible wire will work too.
These are the MOSFETs that I use: IXFN56N90P; I’ve tried others that are also good enough and cheaper. Appropriate IGBTs are also a perfect fit for this application. Then there are also the DC-Link capacitors, and they are as important as the MOSFETs themselves; trust me, you don’t want to mess these up. I've added two images; one shows what the inverter output looks like when the DC-Link capacitors are present - a perfect square wave, and the other shows what remains of the square wave if they aren't present...CATASTROPHE! MOSFET DEATH GUARANTEED!
For the cooling loop, you won't need a very big water reservoir, since the inverter (and the full-bridge rectifier if you use one) won't lose that much energy. A small water-cooled aluminum heatsink with a small fan will also do.
Powering the Inverter
I first used a 3kW DC supply (250V @ 12A) from MeanWell (recommended if you don't feel comfortable handling mains AC). This worked well. However, I wanted to have a bit more power, so I switched to rectified 230V single-phase mains AC.
The rectifier itself is pretty simple: just a full bridge of 4 diodes mounted onto a water-cooled aluminum block, about 3 mF of capacitance after the bridge to smooth the ripple (with 100k, 5W bleed resistor for safe discharging), and a passive 5mH choke inductor rated for 20 amps in series with the AC input. I added the choke mainly to improve the power factor, so the system would not draw quite as much apparent power at higher loads, and also help tame the high peak current draw on every wave crest when the capacitors get charged up again.
It does help, but it also introduces a clear tradeoff: as the load increases, the rectified DC voltage sags quite a bit. At light loads I would see around 330 volts DC, which is roughly what you would expect from rectified 230AC mains voltage, but at roughly 15 amps DC that voltage would fall to around 250 volts, which brought me back to what my DC supply was giving me before, although only voltage wise, since I was able to pull more current and hence more power. Note that at high loads, the voltage would sag even without the inline choke, although not as much, and the power factor on the AC side would be much worse, causing the breaker to trip much sooner.
The 2 breakers you see in the picture: the capacitor bank gets charged up through a halogen lamp to limit the amount of inrush current, because an empty capacitor bank is basically a short circuit. Once charged up, I switch to the main current path instead of the halogen, (extra-)resistive one.
LC Tank
Then we have the resonant tank or LC Tank or RLC Tank, which, as I mentioned, will get its power from the coupling transformer (which basically acts as a step-down transformer). It consists of a coil of copper tubing in parallel with a capacitor or capacitor bank mounted on thick copper bus bars. It needs to be copper tubing because water cooling is non-negotiable here; it will literally melt otherwise. Also, colder copper will offer less electrical resistance than hot copper. These capacitors need to be water-cooled, and they need to have a high kVAr rating, which is crucial for an induction heater, since the reactive voltage and currents will be huge. Illinois Capacitors, Celem, Anxon are some good options. Alternatively, you can use 10 or 20 smaller ones (film capacitors, please. Don't even think about using electrolytic capacitors here!) soldered in parallel. Fewer turns in the work coil will allow you to push more current into the workpiece and vice versa. Generally, make the coil only as big as you need to; I made mine so my crucible fits nicely into it. The tighter you pack each turn together, without them touching, of course, the better. This will increase the concentration and strength of the magnetic field induced in the workpiece. Closer turns reduce magnetic flux leakage between the windings, ensuring more energy is transferred directly to the material rather than being wasted.
Use flare fittings for easy mounting and unmounting of different coils. Make sure the flare fittings are tightened properly because I already had it happen twice that they weren't making good enough contact and would get incredibly hot, wasting energy into the cooling water and limiting the amount of current I was able to push. The inductance of the coil and the capacitance of the capacitors (I have 2.8uF of capacitance) will give you the resonant frequency of the tank. This is with an unloaded work coil; if you introduce a workpiece, the resonant frequency will change. It will generally go down if the piece is magnetic until it gets hot enough and goes past the Curie point, thus losing its magnetism, after which it will become purely resistive, making the resonant frequency shift upwards; the same will happen with purely resistive loads, the resonant frequency will go up; the higher the resistivity, the higher the frequency. For example, my small work coil resonates at 52.5khz while empty, but goes up to around 56khz when I introduce a graphite crucible into it, which has a very high resistivity. This resonant frequency is what you will try to target with your PCB and inverter for maximum power transfer.
In terms of cooling, you will need a separate cooling loop for the LC tank alone, since it will heat up a lot. Cooling the inverter with the same water may feel tempting because it is easier to just do one, but you don't want to unnecessarily stress-heat your MOSFETs; they have enough to do already. So, separate them!
Resonance Feedback
Then we have the feedback mechanism to tell our microcontroller how far away from the resonant frequency we are. It is basically a current transformer made of a ferrite ring (FT 240-77) with 100 turns (although I've tried just 45 turns and it still works fine) of 31-gauge wire and a 100 Ohm burden resistor as a load. It is 'threaded' through one of the outputs of the switching nodes, i.e., one of the legs of the coupling transformer's primary winding. The sinusoidal signal of this current transformer then goes into an LM339 comparator, which makes it a square wave, and then passes it on to the microcontroller. When the inverter signal (square wave) is in phase with the feedback signal, it means you are now operating at the resonant frequency.
Finally, I added some buttons to control the frequency manually and another button to automatically lock onto the resonant frequency (the one with the green LED) and de-lock from it when desired — also, an on-and-off switch, and a temperature sensor to keep track of the temperature of the cooling water.
The Code
This part is a bit dull to explain just with words, but I hope it helps. The code itself is heavily commented as well, so you know what you are looking at in each section.
The code in the microcontroller controls the switching frequency of the H-bridge and tries to keep the system operating at exactly the resonant frequency of the LC tank. If you go below resonance into the capacitive region where the capacitive reactance dominates, you will start getting a lot of nasty voltage spikes due to hard switching and body diode reverse recovery, so it is very important that you stay perfectly at resonance. And exactly for this reason, as an extra layer of safety, it is also common practice to operate slightly above resonance, in the inductive region, where the inverter behaves more nicely, and the MOSFETs are less likely to get hit by nasty voltage spikes, although this comes at a not insignificant power cost. But in this build, I am not doing that because..YOLO (getting the DC-Link caps really close to the inverter helps a lot with eliminating most voltage spikes that appear due to parasitic inductances; the further away they are, the more safety you’ll need to program into the control logic). If you decide to download the code for your own build, you can adjust this and other parameters to your own needs.
What the code does, in steps:
Step 1 — Capture
So this is the basic idea.
Every time the PWM signal (the signal we send out to the gate drivers) rises, Timer 1 emits an update
trigger. Timer 2 is slaved to Timer 1 and configured in reset mode, which means Timer 2's counter gets reset
to zero at every PWM rising edge and then starts counting upward at 72 megahertz. That means one timer tick
is only about 13.9 nanoseconds.
Then, when the current-transformer (feedback) signal goes through the LM339 comparator and produces a rising edge on pin PA0, Timer 2's input capture hardware latches the current counter value into its CCR1 register
automatically, with zero software latency. There is no interrupt routine involved in the measurement — the
capture happens entirely in hardware. The main loop just polls a flag to check whether a new capture is
available.
So what gets stored here is basically the time gap between the PWM rising edge and the current-signal rising
edge. That raw number is not yet a phase angle. It is just the number of timer counts between those two
events.
If you have never looked at this kind of code before, a register is basically just a little block of bits
inside the microcontroller that controls some hardware function.
A nice example is the GPIO configuration register called CRH on this STM32.
That register is 32 bits wide, and it stores the configuration for eight pins: A8 through A15. Each pin gets
four bits. So four bits times eight pins gives us the full 32-bit register.
That means bits 3 down to 0 belong to pin A8, bits 7 down to 4 belong to pin A9, bits 11 down to 8 belong to
pin A10, and so on.
So if I want to configure only pin A8, I do not rewrite the whole thing. I only modify the first 4-bit
section and leave the rest alone.
And that is exactly what this line of code does:
GPIOA->CRH = (GPIOA->CRH & ~(0xFUL << 0)) | (0xBUL << 0);
This looks awful at first, but it is actually pretty logical.
The 0xF is hexadecimal for binary 1111. That is one complete 4-bit field, which is exactly the size of one
pin configuration field in this register.
Then the tilde (the ~) flips all the bits. So those four bits become zeroes, and everything else becomes
ones.
So when the code ANDs the register with that mask, it clears just the 4-bit field for A8 and leaves the
other pins unchanged.
Then the second part writes the new value.
0xB in hexadecimal is binary 1011.
And on this STM32, that bit pattern means alternate-function push-pull output at up to 50 megahertz.
So what this line is doing is: first, clear the old 4-bit configuration field for A8, then replace it with
the bit pattern that hands pin A8 over to the timer peripheral so it can output the PWM signal.
So that one ugly-looking line is the actual line of code that activates A8 as the timer-driven output pin.
Once the pin is configured, the timer still needs to know two things: how fast to run, and at what point in
the cycle the output should switch.
The frequency comes from the auto-reload register, or ARR.
In the code, that looks like this:
uint32_t arr = (TCLK / freq_hz) - 1;
TIM1->ARR = arr;
The timer clock here is 72 megahertz.
So if I want a switching frequency of 50 kilohertz, I divide 72 million by 50 thousand, which gives 1440
timer counts per cycle.
Since the timer count does not start from 1 but from zero up to the value in ARR, we need to subtract one,
so ARR becomes 1439.
That means the timer counts from 0 to 1439, then rolls over and starts again, and that repeating count
defines the PWM period.
Then for the duty cycle, the code uses another register called CCR1, which is the capture-compare register:
TIM1->CCR1 = (arr + 1) / 2;
If ARR is 1439, then ARR + 1 is 1440, and half of that is 720.
So the compare point is set right in the middle of the counting period, which gives a duty cycle of about 50
percent.
In other words, the output switches halfway through the cycle, so the waveform is high for half the cycle
and low for half the cycle. That gives us the symmetrical square wave I want for driving the H-bridge.
Now for the second timer — Timer 2 — the setup is a bit more involved but the idea is simple. Timer 2 is
told to use Timer 1's update event as its reset trigger. In STM32 terms, Timer 1's CR2 register is set so
that its TRGO output fires on every update event (that is, every time Timer 1's counter rolls over, which is
the same moment the PWM rising edge happens). Then Timer 2's slave mode control register is set to reset
mode with ITR0 as the trigger source, and ITR0 on Timer 2 is internally wired to Timer 1's TRGO. So every
time Timer 1 reloads, Timer 2's counter snaps back to zero and starts counting again. Meanwhile, Timer 2's
channel 1 is configured as an input capture on PA0, so whenever the LM339 output goes high, the hardware
copies Timer 2's counter into CCR1 automatically. The main loop just checks the CC1IF flag to see if a new
value is waiting.
So those are concrete examples of what the firmware is doing under the hood: one register configures the
physical output pin, another set of registers defines the timer period and the duty cycle, and a second
timer handles the phase capture entirely in hardware.
Step 2 — Degrees
The next step is converting that raw counter value into degrees.
One full PWM period corresponds to 360 degrees. So if the timer counts from zero up to the period value,
then the captured counter value is just some fraction of one full cycle. And from there, converting to
degrees is straightforward.
So the code takes the captured count from Timer 2's CCR1 register, divides it by the total counts in one
period (Timer 1's ARR + 1), and multiplies by 360.
Because the capture is done in hardware with no interrupt latency, the measured phase is very clean. The
only real offset in the measurement is the propagation delay of the LM339 comparator, which is on the order
of 1.3 to 2 microseconds. At 52 kilohertz, that corresponds to roughly 25 to 38 degrees of apparent phase
shift.
Step 3 — The target phase
Since the hardware input capture eliminates software jitter, the only systematic offset between the measured
phase and the true tank phase is the LM339 comparator delay. That delay is relatively constant across the
frequency range I care about, so the code uses a single fixed target phase constant — currently set to 22
degrees.
That number is determined empirically: you sweep the frequency manually, find the point where the tank is
truly at resonance (maximum current, best heating), read the phase value the code reports at that point, and
set TARGET_PHASE to that value. Once set, the PID controller tries to keep the measured phase at that
target by adjusting the switching frequency.
If you replicate this build with a different comparator or a different current transformer, you will likely
need to retune this value. A faster comparator would reduce the offset, and a slower one would increase it.
But as long as the delay is roughly constant with frequency, a single fixed target works well.
Step 4 — PID and noise rejection
The PID runs a few hundred times per second. Each time the main loop polls Timer 2 and finds a new valid
capture, it calculates the phase error relative to the fixed target and decides whether the switching
frequency needs to move up or down.
The controller has two modes. In tracking mode, it runs a full PID with gain scheduling — using higher gains
when the error is large to converge quickly, and lower gains when close to lock for stability. Once the
error stays below 6 degrees for 15 consecutive cycles, the controller enters locked mode, where it switches
to a gentle proportional-only correction to hold the frequency steady without overshooting. If the error
grows beyond 12 degrees, it drops back to full tracking.
There is also noise rejection. Zero-crossing edges that land too close to the PWM reload point or the
compare event, are thrown out, because those regions tend to produce spurious readings. If too many
consecutive edges get rejected (more than 15 in a row), the code assumes it is stuck in a dead zone and
sweeps the frequency upward to escape.
A large sudden phase jump of more than 120 degrees is treated as a resonance crossing — meaning the
frequency has drifted past resonance to the other side, and the controller forces an unlock and resets the
frequency to a safe starting point.
So overall, what the code is doing is actually pretty simple in principle: capture the phase in hardware,
reject the suspicious readings, compare the result with the target, and then adjust the frequency in real
time.
And most importantly, it saves me from having to manually babysit the frequency every second, which is
great, because I already have enough ways to destroy MOSFETs without getting any extra help from the
controller.
Aside from frequency control, the microcontroller also handles the smaller user-interface tasks: reading the
buttons, updating the OLED display, and monitoring the temperature of the cooling water reservoir.
The Final Product
The finished product looks like an absolute mess, but it works perfectly and is lots of fun! (watch my YT videos for more footage!) Nonetheless, I need to package it all up so it is easier to transport and takes up less space. I will do that for the next upgraded version, where I will use 3-phase mains AC for more power, and so I will try to package it all up in a big box.
It is up to you and your creativity to package/house your own version as you like. Have fun!
Thanks for reading this tutorial, and good luck with your own builds. See you around!
PS: If you would like a more hand-in-hand tutorial on building a small, 80W "tabletop" version that operates on the same principle as the larger one covered in this Instructable, I offer a PDF guide for $15 that covers exactly this.