Practical engineering, original measurements and technical references. Articles

English
ElectronicsPower

12 V LED Strip PWM Control with ESP32, TC4420, SN74HC14, and IRF3205

Learn how to control a 12 V LED strip with ESP32, TC4420, and IRF3205 while understanding PWM, gate drive, power losses, protection, power-supply sizing, and the optional role of the SN74HC14.

12 V LED Strip PWM Control with ESP32, TC4420, SN74HC14, and IRF3205

How can a small 3.3 V signal control a 12 V LED strip drawing several amperes? The answer brings together three ideas: a digital command, a circuit that drives the transistor, and an electronic switch that carries the load's power.

In this lesson, we will build a brightness controller for a five-meter LED strip. The project uses an ESP32, a TC4420 driver, and an IRF3205 MOSFET. We will include the SN74HC14N to study signal conditioning and compare the circuit with a simplified version without this component.

You will learn to read the relevant datasheet parameters, size the power supply, understand PWM, calculate losses, and carry out bench experiments. The aim goes beyond copying connections: you should be able to explain why each component is there and recognize when it can be removed or needs to change.

Project scope and validation status. This is a calculated educational design that has not yet been physically validated. The plots are theoretical models, not oscilloscope captures. The assumed load is a constant-voltage, single-color, non-addressable, two-wire LED strip with internal resistors. We use 14.4 W/m as an example, not as an identification of your strip. Power: a regulated, isolated 12 V supply; the ESP32 is powered by USB. RGB strips, addressable strips, and power LEDs without current limiting require adaptations.

1. What you will learn and how to organize the practical work

By the end, you should be able to distinguish control signals from power current; explain voltage, current, resistance, and power; relate frequency and duty cycle; explain the gate, drain, and source terminals; justify the driver; recognize the benefits and limits of hysteresis; calculate supply current, losses, and cable voltage drop; and check waveforms without shorting the circuit through the instruments.

Stage
Activity
Suggested time
1
Fundamentals and project overview
25 min
2
PWM, MOSFET, and gate driver
30 min
3
SN74HC14N and datasheet reading
20 min
4
Assembly and checks without a load
30 min
5
Experiments and measurements
45 min
6
Exercises and review
20 min

Allow approximately 2 hours and 50 minutes, which can be split across sessions. Assembly may take longer if you have never used a multimeter or soldering iron. You can perform the basic tests with a multimeter; an oscilloscope reveals fast phenomena that a multimeter cannot show.

2. Before the circuit: four essential quantities

Voltage is an electric potential difference between two points. Always ask: “12 V between which points?” At the supply, it is 12 V between the positive and negative terminals. For the MOSFET, the relevant control voltage is between gate and source.

Current is the rate of flow of electric charge. A strip drawing 6 A requires a path capable of carrying that current without excessive heating. The ESP32 pin provides a signal; it does not power the strip.

Resistance relates voltage and current in a resistive element. For an ideal resistor:

V=RIV=RI

Power describes how quickly energy is transferred or converted. Under steady-state DC conditions:

P=VIP=VI

A 12 V load drawing 6 A consumes:

P=12×6=72WP=12\times6=72\,\mathrm{W}

This means 72 joules of energy are transferred per second. Some becomes light and some becomes heat. Resistor dissipation can be calculated as:

PR=I2R=V2RP_R=I^2R=\frac{V^2}{R}

These relationships do not mean every component can be treated as a fixed resistor. LEDs are nonlinear, and a MOSFET behaves differently depending on its drive and temperature. We will use models with explicit assumptions.

3. What does power electronics mean in this project?

Power electronics uses electronic devices to control the flow of electrical energy. Here, the ESP32 decides when the strip receives energy, while the MOSFET establishes or interrupts the current path.

The diagram below separates two coexisting paths: control information and load power. The TC4420 also draws energy from the 12 V supply to move electric charge into and out of the gate.

flowchart TB;
E["ESP32: PWM command"] --> H["SN74HC14N: two inversions"];
H --> T["TC4420: gate drive"];
T --> Q["IRF3205: electronic switch"];
F["12 V supply and fuse"] --> L["LED strip"];
L -->|"Load current"| Q;
Q --> N["Supply negative"];
F -->|"Gate-drive energy"| T;
Control and power paths

There is no electrical isolation between the ESP32, driver, and MOSFET in this circuit: they share a GND reference. The driver increases drive capability; it does not create an isolation barrier.

4. Understanding the 12 V LED strip

A typical constant-voltage strip contains many small groups connected in parallel. A common example is three LEDs in series with a resistor. Other constructions exist; check your strip before applying this model.

An illustrative LED strip group
An illustrative LED strip group

For learning purposes, suppose each LED has a 3 V forward drop and the resistor is 150 Ω. The approximate current in this group would be:

Igroup=123×3150=0.020A=20mAI_{\mathrm{group}}=\frac{12-3\times3}{150}=0.020\,\mathrm{A}=20\,\mathrm{mA}

This example explains the mechanism but does not determine the current of a real strip. LED forward voltage varies with current and temperature; the number of groups and the resistors vary between models.

Our circuit controls how long power is applied. It does not measure or actively regulate LED current. Current limiting depends on the strip's construction and the correct supply voltage. This project therefore must not be applied directly to a standalone power LED without a suitable constant-current circuit.

5. PWM: controlling time to control energy

PWM stands for pulse-width modulation. The switch receives a periodic command that alternates between on and off.

The period, represented by T, is the duration of one complete cycle. The frequency, f, tells us how many cycles occur per second:

T=1fT=\frac{1}{f}

At 2 kHz:

T=12000=0.0005s=500μsT=\frac{1}{2000}=0.0005\,\mathrm{s}=500\,\mu\mathrm{s}

The symbol µ means “micro,” or one millionth. Thus, 500 µs is half a millisecond.

The duty cycle, D, is the fraction of the period for which the command is on:

D=tonTton=DTtoff=(1D)TD=\frac{t_{\mathrm{on}}}{T}\qquad{}t_{\mathrm{on}}=DT\qquad{}t_{\mathrm{off}}=(1-D)T
Duty cycle
On-time at 2 kHz
Off-time
0%
0 µs
500 µs
25%
125 µs
375 µs
50%
250 µs
250 µs
75%
375 µs
125 µs
100%
500 µs
0 µs
Ideal PWM at three duty cycles

Plot 1 — Ideal model: the amplitude remains 12 V while the pulse width changes. Switching times are omitted.

If the current during each pulse is approximately 6 A and current during the off interval is negligible:

IavgDIonPstrip,avgDVIonI_{\text{avg}}\approx D I_{\mathrm{on}}\qquad{}P_{\text{strip,avg}}\approx D V I_{\mathrm{on}}

At 50%, this gives approximately 3 A and 36 W. Current during the pulses remains close to 6 A. A smaller power supply does not automatically become suitable just because you intend to use reduced brightness: there is a pulsed demand, there are transients, and a 100% command remains possible.

The ideal average voltage is 6 V at 50%, but the strip receives 12 V pulses. Applying 6 V DC can produce a completely different result, potentially leaving the LED groups off.

Perceived brightness is not strictly proportional to duty cycle either. Human vision and the strip's thermal response affect perception. We will first study the electrical relationship; perceptual correction can be a later extension.

6. Why start at 2 kHz?

2 kHz is an initial choice for bench work: the period is easy to observe on an oscilloscope, and switching losses tend to be lower than at much higher frequencies, with other conditions unchanged.

This frequency does not guarantee the absence of camera banding or audible noise in every setup. For comparison, the program also supports 20 kHz. In that case:

T=120000=50μsT=\frac{1}{20000}=50\,\mu\mathrm{s}

At 50%, the pulse lasts 25 µs. Increasing frequency means switching the transistor on and off more often each second, placing greater demands on the drive circuit and making layout even more important. A higher frequency does not automatically mean greater brightness.

7. IRF3205: the switch that carries the current

The IRF3205 is an N-channel power MOSFET. Its terminals are the gate, which controls it; the drain, connected to the load; and the source, connected to the negative supply terminal in this project. The decisive voltage is:

VGS=VGVSV_{GS}=V_G-V_S

Because the source is close to 0 V, applying about 12 V to the gate produces approximately 12 V between gate and source. With the gate at 0 V, the transistor is commanded off.

This arrangement is called low-side switching: the switch sits between the load and the supply's negative terminal. This allows the drive to be referenced directly to source/GND and permits a continuous 100% command, provided the thermal and electrical limits are respected.

The datasheet specifies a 55 V drain-source limit, an absolute gate-source limit of ±20 V, and a maximum on-resistance of 8 mΩ under test conditions of 10 V gate drive, 62 A, and a junction temperature of 25 °C. The 2 to 4 V threshold is measured at only 250 µA. These values serve different purposes. Infineon, IRF3205PbF, ratings and static electrical characteristics tables.

Why not drive the gate directly with 3.3 V? Because the onset of conduction does not guarantee low resistance at the strip's current. The transistor may be insufficiently driven, have a larger voltage drop, and heat up. This project uses the TC4420 powered from 12 V to provide suitable drive.

Think of a faucet: the threshold marks the start of opening, not a fully open passage. The analogy helps with visualization, but the parameter we need for the conducting switch is its on-resistance under defined conditions.

The 110 A figure on the datasheet assumes specific thermal conditions, including a controlled case temperature; the documentation also states a package limitation of 75 A. Neither number authorizes carrying that current through thin wires or a solderless breadboard. In this article, the target current is 6 A.

In power electronics, we avoid spending a long time in the transition where voltage and current are simultaneously high. The MOSFET's low-resistance state is its ohmic region; the “saturation” terminology used for a BJT switch should not automatically be applied to it.

8. TC4420: why does the gate need a driver?

The gate is insulated and ideally draws little DC current, but it has capacitance. Changing its voltage requires moving electric charge. A driver rapidly charges and discharges this input.

The TC4420 is non-inverting: a high input produces a high output. It supports a 4.5 to 18 V supply and recognizes a high input from 2.4 V and a low input up to 0.8 V. Its output sources and sinks current pulses. The advertised 6 A refers to capacitive drive under the test conditions, not to powering the strip. Microchip, TC4420/TC4429, electrical characteristics and section 3.

The energy delivered to the gate comes from the 12 V supply. The ESP32 only commands the input. A 3.3 V signal therefore controls an output that switches approximately between 0 and 12 V.

The basic relationship between charge, current, and time is:

IΔQΔtI\approx\frac{\Delta Q}{\Delta t}

If we moved 150 nC in 300 ns, the average current during that movement would be:

I150×109300×109=0.5AI\approx\frac{150\times10^{-9}}{300\times10^{-9}}=0.5\,\mathrm{A}

The 150 nC figure is a rounded calculation assumption. The IRF3205 datasheet gives a maximum total gate charge of 146 nC, measured at a drain current of 62 A, a drain-source voltage of 44 V, and a gate-source voltage of 10 V—conditions different from those in this circuit. Do not use the result above as an exact prediction of switching time.

Gate charge depends on voltages and the operating point. During the drain-source transition, a Miller plateau may appear: a portion of the waveform where gate voltage changes little while charge continues to move. Representing the entire gate as a fixed capacitor is therefore only an approximation. Texas Instruments, Fundamentals of MOSFET and IGBT Gate Driver Circuits, sections 2 and 3.

9. SN74HC14N: an educational stage, not a requirement

The SN74HC14N contains six inverters with Schmitt-trigger inputs. In this project, we use two in series and power the IC from 3.3 V. Its recommended supply range is 2 to 6 V. Texas Instruments, SN74HC14, recommended operating conditions and pinout.

An inverter turns zero into one and one into zero. With two gates:

Y1=AY2=Y1=AY_1=\overline{A}\qquad{}Y_2=\overline{Y_1}=A
GPIO
First gate output
Second gate output
Strip
0
1
0
Off
1
0
1
On

The double inversion preserves logic polarity while adding a small delay. The gates regenerate the signal within the levels of the 3.3 V supply; they do not raise the output to 12 V or replace the TC4420's drive capability.

What is hysteresis? A thermostat can turn heating on at one temperature and off at another. The difference prevents rapid toggling around a single point. A Schmitt input does something similar with voltage: it has one threshold for a rising input and another for a falling input.

ΔVT=VT+VT\Delta V_T=V_{T+}-V_{T-}

This separation reduces unwanted switching caused by small fluctuations. It does not block noise of any amplitude and does not replace isolation, input protection, or a suitable interface for long cables. Texas Instruments, Understanding Schmitt Triggers.

Slow noisy input and hysteresis response

This illustrative model uses a triangular ramp from 0 to 3.3 V and back over 10 ms, with sinusoidal noise of 0.18 V amplitude at 4 kHz, clipped to the supply range. The comparison without hysteresis uses a 1.6 V threshold. These values define only the educational plot.

Plot 2 — Illustrative model with chosen thresholds of 2.0 V and 1.2 V, not guaranteed specifications for the SN74HC14N at 3.3 V. The final trace represents two inversions, preserving the original logic. The comparison without hysteresis uses an ideal comparator with a single threshold.

The datasheet does not provide a table that lets you copy guaranteed thresholds at exactly 3.3 V directly from a 4.5 V row. The plot's thresholds explain the behavior; measure the actual component in the experiment described later.

When should you use it? When receiving a slow transition, conditioning an RC network, or improving tolerance to certain noise. When can you omit it? When the ESP32 GPIO delivers clean PWM over a short connection to the TC4420. Experimenting with both versions will let you observe the difference.

10. Power supply: sizing for five meters

For the example strip:

Ptotal=5m×14.4W/m=72WP_{\mathrm{total}}=5\,\mathrm{m}\times14.4\,\mathrm{W/m}=72\,\mathrm{W} Istrip=7212=6AI_{\mathrm{strip}}=\frac{72}{12}=6\,\mathrm{A}

Using a design margin of 25% above the strip current:

Ireference=1.25×6=7.5AI_{\text{reference}}=1.25\times6=7.5\,\mathrm{A}

A regulated 12 V/10 A supply provides margin in this example. The 25% margin is an engineering choice for this exercise, not a universal rule. Check temperature, ventilation, and derating for the selected supply. The ESP32 will be powered separately by USB.

Power per meter
Power over 5 m
Current at 12 V
Illustrative supply
4.8 W/m
24 W
2 A
12 V/3 A
9.6 W/m
48 W
4 A
12 V/5 A
14.4 W/m
72 W
6 A
12 V/10 A
19.2 W/m
96 W
8 A
12 V/10 A; check thermal conditions

A 10 A supply does not necessarily “push” 10 A through the strip. This is its current capability; consumption depends on the load and voltage. In a short circuit, however, the available energy can rapidly heat the conductors.

For the 6 A example, F1 will be a 7.5 A fuse suitable for DC, with a voltage rating of at least 32 V. Its time-current curve, startup current, and cable capacity must be checked. It primarily protects the supply wiring and does not replace fast electronic protection for the MOSFET. Install it near the supply's positive terminal.

11. Resistors: each one solves a different problem

Reference
Initial value
Location
Purpose
R1
330 Ω
GPIO → U1A input
Limit transient currents and damp the short signal connection
R2
10 kΩ
U1A input → GND
Define a low command when the GPIO is high-impedance
R3
100 kΩ
TC4420 input → GND
Prevent a floating input when disconnected
R4
22 Ω
TC4420 output → gate
Control gate transition speed and reduce ringing
R5
10 kΩ
Gate → source
Provide a discharge path and a reference for the gate

R1 and R2 form a small voltage divider when the GPIO is high. Neglecting input current:

VA3.31000010000+3303.19VV_A\approx3.3\frac{10000}{10000+330}\approx3.19\,\mathrm{V}

The signal is not exactly 3.3 V, but remains close to the logic supply voltage. This illustrates why any pull-down resistor should be analyzed together with the output resistance and series components.

At the gate, R4 limits peak current and changes the transition. Ignoring the other resistances, a simplified upper bound would be:

IG,initial12220.55AI_{G,\mathrm{initial}}\lesssim\frac{12}{22}\approx0.55\,\mathrm{A}

In practice, the driver's internal resistance, the internal gate resistance, and the instantaneous gate voltage reduce this value. It is not a constant current throughout the pulse.

R5 dissipates little power when the gate is at 12 V:

IR5=1210000=1.2mAPR5=12210000=14.4mWI_{R5}=\frac{12}{10000}=1.2\,\mathrm{mA}\qquad{}P_{R5}=\frac{12^2}{10000}=14.4\,\mathrm{mW}

Quarter-watt resistors satisfy the average-power estimates for this project. For R4, prefer a non-inductive part with suitable pulse capability. The 10 kΩ resistor provides a supporting discharge path; the TC4420's active output is what turns the MOSFET off quickly during PWM.

12. Capacitors: why use several values?

A capacitor stores charge and responds to voltage changes. If an approximately constant current is drawn from a capacitor over a short interval:

ΔVIΔtC=ΔQC\Delta V\approx\frac{I\Delta t}{C}=\frac{\Delta Q}{C}

Using the assumed 150 nC of gate charge and an ideal 1 µF capacitor:

ΔV150nC1μF=0.15V\Delta V\approx\frac{150\,\mathrm{nC}}{1\,\mu\mathrm{F}}=0.15\,\mathrm{V}

The capacitor close to the driver supplies part of the current pulse without immediately relying on a long wire to the supply. Microchip recommends local decoupling and suggests at least 1 µF in section 3.1. This project uses 100 nF and 1 µF ceramic capacitors, accompanied by 10 µF. TC4420/TC4429, supply recommendations.

Reference
Value
Connection
Purpose
C1
470 µF/25 V, electrolytic
+12V_F → GND
Local energy storage for supply transients
C2
100 nF, ceramic, ≥10 V
U1: pin 14 → pin 7
SN74HC14N decoupling
C3
100 nF/25 V, ceramic
U2 supply → U2 GND
Fast decoupling
C4
1 µF/25 V, ceramic
U2 supply → U2 GND
Local energy storage for the gate driver
C5
10 µF/25 V
U2 supply → U2 GND
Local supply support
C6
100 nF/25 V, ceramic
+12V_F → GND, near C1/the connector
High-frequency support at the power stage

The value in microfarads does not tell the whole story. Real capacitors have parasitic resistance and inductance; ceramic capacitors may lose capacitance under applied voltage. Physical distance also matters. Place C3 and C4 within a few millimeters of the driver's supply terminals, with a short return path.

C1 cannot supply the full 6 A by itself for half a period at 2 kHz. If it tried to deliver 6 A for 250 µs:

ΔV=6×250×106470×1063.19V\Delta V=\frac{6\times250\times10^{-6}}{470\times10^{-6}}\approx3.19\,\mathrm{V}

This result shows that the supply and wires remain essential. The 470 µF value is a starting point for decoupling, not a universal ripple calculation. The capacitor's allowable RMS ripple current must also suit the actual circuit.

13. Diode D1: the strip is not a coil, but the wires have inductance

When current changes rapidly, an inductance produces a voltage:

VL=LdidtV_L=L\frac{di}{dt}

Here, “di/dt” represents the rate of change of current. The faster we interrupt current in an inductive path, the larger the resulting voltage can be.

For illustration, 1 µH with a 6 A change in 0.2 µs corresponds to a magnitude of:

VL1×10660.2×106=30V|V_L|\approx1\times10^{-6}\frac{6}{0.2\times10^{-6}}=30\,\mathrm{V}

This does not predict a 30 V spike on your board: capacitance, the diode, resistance, and layout alter the waveform. The calculation highlights the issue.

D1 provides a transient path from the drain to the positive bus when the drain tries to rise above it by the diode's forward voltage. We will use the STPS10L60D, a 60 V, 10 A-class Schottky diode in the TO-220AC package. Its continuous current rating depends on specified thermal conditions. STMicroelectronics, STPS10L60, tables 1 to 3 and package information.

Connect the anode to the drain and the cathode to +12V_F. Check the A/K identification in the datasheet for the part you purchased. Place it on the board near the strip connector, with a short loop.

It limits an overvoltage condition associated with the load path. It does not protect against reversed supply polarity, does not guarantee clamping of every local spike, and does not replace checking VDS on an oscilloscope. The circuit assumes a regulated bench supply; it should not be connected directly to an automotive bus subject to transients.

14. Complete schematic, divided for readability

The following three drawings form one circuit. Identical net names indicate electrically connected points: GND, +12V_F, PWM_IN, and DRV_OUT.

14.1 Power stage

Power stage and protection
Power stage and protection

The strip's positive terminal receives +12V_F: 12 V after the fuse. Its negative terminal connects to the drain. The source completes the path to the supply's negative terminal. The gate resistor and its pull-down belong close to the transistor.

On the IRF3205 TO-220 package, viewed from the marked face with the leads pointing down: 1 = gate; 2 = drain; 3 = source. The metal tab is connected to the drain. A metal heatsink can therefore be electrically connected to the load; if it shares a grounded structure or other devices, suitable insulation is required.

14.2 Driver and decoupling

TC4420 and decoupling
TC4420 and decoupling

The drawing uses the eight-pin PDIP/SOIC TC4420. Connect both supply pins, both ground pins, and both output pins. Leaving one disconnected can impair the current path. The five-pin version has a different pinout.

14.3 Conditioning with the SN74HC14N

SN74HC14N logic conditioning
SN74HC14N logic conditioning

Gates U1A and U1B belong to the same package. The wire between output 2 and input 3 is external. The four unused inputs connect to GND; their outputs remain unconnected.

Component
Pins
Connect to
SN74HC14N
14 / 7
3.3 V / GND
SN74HC14N
1
R1 and R2
SN74HC14N
2 → 3
Connection between gates
SN74HC14N
4
PWM_IN
SN74HC14N
5, 9, 11, 13
GND
SN74HC14N
6, 8, 10, 12
No connection
TC4420, 8-pin
1 and 8
+12V_F
TC4420, 8-pin
2
PWM_IN and R3
TC4420, 8-pin
4 and 5
GND, short return to source
TC4420, 8-pin
6 and 7
Tied together at DRV_OUT
TC4420, 8-pin
3
No connection

Pinouts were checked in the corresponding sections of the Texas Instruments and Microchip datasheets. DIP numbering is viewed from above and follows the notch or pin 1 marking.

14.4 Simplified version without the SN74HC14N

For this version, remove U1, C2, and the R1/R2 network from the previous circuit. Connect GPIO → 330 Ω resistor → PWM_IN. Replace the 100 kΩ R3 with 10 kΩ. Keep the rest of the circuit unchanged.

The new input has only one 330 Ω series resistor and one 10 kΩ resistor to GND. Do not connect the GPIO and the SN74HC14N output to PWM_IN at the same time, because the two outputs can contend.

This alternative is suitable for clean PWM over short connections. The circuit with U1 remains the main educational setup for the hysteresis experiments.

15. How hot does the MOSFET get? Average and RMS are different

The MOSFET has resistance when on. A first estimate of conduction loss is:

PcondIon2RDS(on)DP_{\mathrm{cond}}\approx I_{\mathrm{on}}^2R_{DS(on)}D

With 6 A, 8 mΩ, and 100%:

Pcond62×0.008×1=0.288WP_{\mathrm{cond}}\approx6^2\times0.008\times1=0.288\,\mathrm{W}

At 50%:

Pcond62×0.008×0.5=0.144WP_{\mathrm{cond}}\approx6^2\times0.008\times0.5=0.144\,\mathrm{W}

Why not simply use 3 A in the I²R formula? Because 3 A is the average current, while instantaneous current alternates between approximately 0 and 6 A. To calculate resistive heating, we use RMS current, also called the effective value:

IRMS=IonDI_{\mathrm{RMS}}=I_{\mathrm{on}}\sqrt{D}

At 50%:

IRMS=60.54.24AI_{\mathrm{RMS}}=6\sqrt{0.5}\approx4.24\,\mathrm{A} Pcond=IRMS2R4.242×0.0080.144WP_{\mathrm{cond}}=I_{\mathrm{RMS}}^2R\approx4.24^2\times0.008\approx0.144\,\mathrm{W}
Average and RMS current versus duty cycle

Plot 3 — A model of rectangular 6 A pulses in the strip/MOSFET path. Current at the power supply terminals may have a different waveform because of the capacitors.

The 8 mΩ resistance is a reference under datasheet conditions, not a fixed value at all temperatures. Using 16 mΩ as a sensitivity scenario doubles the calculated loss; this factor of two is a comparison assumption, not a claim about a specific component temperature.

A simple thermal estimate without a heatsink uses:

TJTA+PMOSFETRθJAT_J\approx T_A+P_{\mathrm{MOSFET}}R_{\theta JA}

The datasheet's 62 °C/W reference gives a temperature rise of approximately 18 °C at 0.288 W. This does not certify the actual temperature: mounting, ventilation, additional losses, and increasing resistance affect the result. Measure temperature and consider a heatsink if needed. Surface temperature and junction temperature are not the same.

16. Switching losses and gate-drive consumption

During turn-on and turn-off, voltage and current may exist simultaneously in the transistor. The general definition of instantaneous power is:

p(t)=vDS(t)iD(t)p(t)=v_{DS}(t)i_D(t)

The energy lost in a transition corresponds to the area under this curve:

Etransition=p(t)dtE_{\text{transition}}=\int p(t)\,dt

A first-order approximation, useful for understanding the influence of frequency, is:

Psw,approx12VIon(tr+tf)fP_{\mathrm{sw,approx}}\approx\frac{1}{2}V I_{\mathrm{on}}(t_r+t_f)f

Here, tr and tf represent the model's effective overlap times, not simply the GPIO rise times. This approximation is common in switching estimates; a strip containing resistors and LEDs does not necessarily exhibit the assumed overlap. It does not replace integration of the actual waveforms or include all parasitic energies.

Hypothetically assuming tr + tf = 0.4 µs:

Psw,2kHz12×12×6×0.4×106×2000=0.0288WP_{\mathrm{sw,2kHz}}\approx\frac{1}{2}\times12\times6\times0.4\times10^{-6}\times2000=0.0288\,\mathrm{W} Psw,20kHz0.288WP_{\mathrm{sw,20kHz}}\approx0.288\,\mathrm{W}
Estimated losses versus frequency

Plot 4 — Estimates at 50% duty, 6 A during the pulse, and a hypothetical total overlap of 0.4 µs. The 8 and 16 mΩ curves are resistance scenarios. They do not represent IRF3205 test results.

At steady 0% or 100%, there are not two transitions per period; do not automatically apply the switching formula at these extremes. For very short pulses, the assumption that transitions are completed can also fail.

For the dynamic consumption associated with gate charge, consider the average current drawn from the driver's supply to charge the gate each cycle:

Isupply,gate,avgQgfPgateQgVdrivefI_{\text{supply,gate,avg}}\approx Q_gf\qquad{}P_{\mathrm{gate}}\approx Q_gV_{\mathrm{drive}}f

With 150 nC, 12 V, and 2 kHz, we obtain approximately 0.3 mA and 3.6 mW. At 20 kHz, the figures are 3 mA and 36 mW. The peaks during the edges are much larger than these averages. At the gate terminal itself, current reverses direction between charging and discharging; its ideal signed average over a complete cycle is zero.

This energy is dissipated in the drive circuit and gate resistances; it should not all be added as heat at the MOSFET junction. The driver's total consumption also includes its internal current and the current through R5. The relationships between charge, drive, and losses are discussed in the Texas Instruments gate-driver application note.

17. Wires, connectors, and current return paths

A wire has resistance. For a supply pair, include both the outgoing and return conductors:

Rpair=ρ2LAR_{\mathrm{pair}}=\rho\frac{2L}{A}

Using copper at approximately 20 °C, with an approximate resistivity of 0.0175 Ω·mm²/m, a one-way distance of 2 m, and a cross-sectional area of 1.5 mm²:

Rpair0.017541.50.0467ΩR_{\mathrm{pair}}\approx0.0175\frac{4}{1.5}\approx0.0467\,\Omega

At a continuous 6 A:

ΔV6×0.04670.28VPwire62×0.04671.68W\Delta V\approx6\times0.0467\approx0.28\,\mathrm{V}\qquad{}P_{\mathrm{wire}}\approx6^2\times0.0467\approx1.68\,\mathrm{W}

This example addresses resistive voltage drop, not certification of thermal current capacity. Insulation, bundling, temperature, and connectors also affect sizing. For the 6 A example and short connections, 1.5 mm² is a starting point to check under these conditions.

The main path should be supply positive → fuse → strip → MOSFET → supply negative. The ESP32 GND connects to the reference near the source through a separate connection from the section carrying strip current. The driver needs an even shorter return to the source so the power return path does not alter the drive voltage.

Do not use a solderless breadboard or Dupont jumper wires for the 6 A path. The logic can be tested on a breadboard with power to the output stage off; the driver/gate/MOSFET assembly needs a compact, soldered layout to assess switching properly.

If brightness drops along the strip, power may need to be fed to both ends. Both positive terminals connect to +12V_F and both negative terminals to the drain. Connecting either negative terminal directly to GND bypasses the switch and prevents control. Each branch needs suitable conductors and protection. Do not leave the five-meter strip rolled up during power tests.

18. Bill of materials and instruments

Item
Quantity
Specification for the example
ESP32 board
1
USB-powered; an available output GPIO
U1
1
SN74HC14N, PDIP-14
U2
1
TC4420, PDIP-8 version for hand assembly
Q1
1
IRF3205, TO-220
D1
1
STPS10L60D, TO-220AC
R1 / R4
1 each
330 Ω / 22 Ω, 1/4 W
R2 / R5
2
10 kΩ, 1/4 W
R3
1
100 kΩ, 1/4 W
C1
1
470 µF/25 V, suitable ripple-current rating
C2 / C3 / C6
3
100 nF ceramic; using 25 V parts throughout simplifies selection
C4
1
1 µF/25 V ceramic, preferably X7R
C5
1
10 µF/25 V
Power supply
1
12 V/10 A, regulated, isolated, with short-circuit protection
F1 and fuse holder
1 set
7.5 A DC for the example; check curve and cables
Strip
5 m
12 V, two wires, known power rating
Connections
As required for the assembly
Appropriately rated terminals and wires; soldered board
Instruments
As available
Multimeter; oscilloscope recommended; temperature measurement
Schmitt experiment
1 set
Extra 10 kΩ resistor and 100 nF capacitor

Prices are not included because they vary by supplier. Verify the origin and full part numbers of the semiconductors. Suffixes can change the package and temperature range.

19. ESP32 program: controlled brightness adjustment

The firmware uses Arduino-ESP32 3.x, the LEDC peripheral, 10-bit resolution, and an initial frequency of 2 kHz. It is not a native ESP-IDF project. The setup, duty, and frequency calls follow Espressif's official LEDC documentation.

With 10 bits, the numeric command ranges from 0 to 1023:

Nmax=2101=1023Nround(1023B100)N_{\max}=2^{10}-1=1023\qquad{}N\approx\operatorname{round}\left(1023\frac{B}{100}\right)

B is the requested percentage. At 50%, we use approximately 512. The library handles the full-scale value as a continuously on command according to its implementation.

The code selects GPIO 23 for the classic ESP32 and GPIO 18 as an example for the ESP32-C6-DevKitC-1. Confirm that the pin is exposed and available on your board, with no peripheral conflicts. On the C6, GPIO 4 is also MTMS and participates in the strapping configuration sampled during reset; we therefore use GPIO 18, available on this DevKitC-1's J3 header and without that strapping function. This choice does not automatically apply to every C6 board. See the official ESP32-C6-DevKitC-1 guide, header pinout, and strapping notes. For other models, the code requires you to define a suitable GPIO.

#include <Arduino.h>
#include <stdlib.h>
#include <string.h>

// Arduino-ESP32 3.x. Check your board pinout before connecting.
#if CONFIG_IDF_TARGET_ESP32
constexpr uint8_t PWM_PIN = 23; // Classic ESP32
#elif CONFIG_IDF_TARGET_ESP32C6
constexpr uint8_t PWM_PIN = 18; // ESP32-C6-DevKitC-1; check your board
#else
#error "Define an available output GPIO for your ESP32 model."
#endif

constexpr uint8_t RESOLUTION = 10;
constexpr uint32_t DUTY_MAX = (1UL << RESOLUTION) - 1;
uint32_t frequency = 2000;
uint8_t brightness = 0;
bool pwmReady = false;
char line[32];
size_t used = 0;
bool lineTooLong = false;

bool applyBrightness(uint8_t value) {
if (!pwmReady) return false;
const uint32_t duty = (DUTY_MAX * value + 50) / 100;
if (!ledcWrite(PWM_PIN, duty)) {
Serial.println("PWM write failed. Turn off the 12 V supply and check.");
return false;
}
brightness = value;
Serial.printf("Command: %u%% | PWM: %lu Hz | duty: %lu\n",
(unsigned int)brightness, (unsigned long)frequency, (unsigned long)duty);
return true;
}

void processCommand(char *text) {
if (strcmp(text, "off") == 0) {
applyBrightness(0);
return;
}
if (strncmp(text, "f ", 2) == 0) {
char *end = nullptr;
const long newFrequency = strtol(text + 2, &end, 10);
if (end == text + 2 || *end != '\0' || (newFrequency != 2000 && newFrequency != 20000)) {
Serial.println("Use f 2000 or f 20000.");
return;
}
// Reconfigure only if writing the zero command succeeds.
if (!applyBrightness(0)) return;
const uint32_t actualFrequency = ledcChangeFrequency(PWM_PIN, newFrequency, RESOLUTION);
if (actualFrequency == 0) {
pwmReady = false; // Block further commands until restart and inspection
Serial.println("Frequency change failed. Turn off the 12 V supply and restart to check.");
return;
}
frequency = actualFrequency;
Serial.printf("PWM: %lu Hz. Send a new brightness command.\n", (unsigned long)actualFrequency);
return;
}
char *end = nullptr;
const long value = strtol(text, &end, 10);
if (end == text || *end != '\0' || value < 0 || value > 100) {
Serial.println("Send 0 to 100, off, f 2000 or f 20000.");
return;
}
applyBrightness((uint8_t)value);
}

void setup() {
pinMode(PWM_PIN, OUTPUT);
digitalWrite(PWM_PIN, LOW);
Serial.begin(115200);
pwmReady = ledcAttach(PWM_PIN, frequency, RESOLUTION);
if (!pwmReady) {
digitalWrite(PWM_PIN, LOW);
Serial.println("PWM setup failed. Do not power the strip.");
return;
}
frequency = ledcReadFreq(PWM_PIN);
if (!applyBrightness(0)) {
pwmReady = false;
return;
}
Serial.println("Send 0 to 100, off, f 2000 or f 20000; end with a newline.");
}

void loop() {
if (!pwmReady) { delay(100); return; }
while (Serial.available()) {
const char c = (char)Serial.read();
if (c == '\r') continue;
if (c == '\n') {
if (!lineTooLong && used > 0) {
line[used] = '\0';
processCommand(line);
} else if (lineTooLong) {
Serial.println("Command too long; discarded.");
}
used = 0;
lineTooLong = false;
} else if (used < sizeof(line) - 1 && !lineTooLong) {
line[used++] = c;
} else {
lineTooLong = true;
}
}
}

Open the serial monitor at 115200 baud, configured to send a newline. The program starts with a zero command and does not automatically ramp up brightness. Send 10, 25, 50, 75, or 100 to select the command. off turns it off. f 20000 changes to 20 kHz and leaves brightness at zero; then send the desired percentage. f 2000 returns to the initial frequency.

The brightness function reports whether the PWM write succeeded. A frequency change proceeds only after a successful write of the zero command; if reconfiguration fails, further commands are blocked until restart. This checks the library's return value; it does not measure whether the strip has physically switched off. If an error occurs, turn off the 12 V supply and check the assembly before restarting.

The firmware is provided for experiments; it was not run on a physical board during preparation. Starting at zero does not by itself eliminate every hardware boot pulse. For a strip, a brief flash is a functional issue; applications where this is unacceptable require a dedicated enable or interlock circuit.

20. Assembly sequence and first power-up

  1. Read the strip's power rating and confirm that it is a two-wire, 12 V model. Cut a short segment at the marked cutting points for the first test.
  2. With all power disconnected, check gate, drain, and source, IC orientation, electrolytic capacitor polarity, and D1's A/K connections. Check for a persistent short between +12V_F and GND. A capacitor may cause a temporary indication during a continuity test.
  3. Assemble the driver, capacitors, and MOSFET with short connections. Connect the ESP32 GND to circuit GND. Do not apply 12 V to the board's 3V3 or 5V pins.
  4. Upload the firmware and keep the command at zero. For initial tests, power the ESP32 first, then the 12 V supply. When finished, turn off the 12 V supply before disconnecting USB. Keep the command at zero while the 12 V supply is off: the TC4420 input must not exceed its VDD supply by more than 0.3 V. This is a bench procedure, not a guarantee for every possible supply failure.
  5. Without the strip, check the supply voltages. Briefly use commands 0 and 100 to measure static VGS: close to 0 V and close to 12 V. An unloaded drain may float and is not a useful reference in this test.
  6. Return to zero and turn off the supply. Connect the short segment. If using a bench supply, set its current limit slightly above the expected consumption of that segment.
  7. Power up and test 10%, 25%, 50%, and 100%. Observe current, brightness, and temperature. A strip that fails to light is not a reason to raise the supply voltage above 12 V.
  8. Only then turn off the supply and replace the segment with the full strip. Adjust the current limit and check cables, the fuse, and connectors for the total current.
flowchart TB;
A["Assemble with power off"] --> B{"Correct pinout and polarities?"};
B -->|"No"| C["Check with power off"];
C --> A;
B -->|"Yes"| D["Test gate without strip"];
D --> E{"Correct VGS?"};
E -->|"No"| C;
E -->|"Yes"| F["Test a short segment"];
F --> G{"Normal current and temperature?"};
G -->|"No"| C;
G -->|"Yes"| H["Test the full strip"];
Bench verification sequence

21. What to measure and what to expect

Ideal waveforms at a 50% command

Plot 5 — Reference model at 2 kHz/50%, without delays, ripple, or transients. The strip voltage is differential, between LED+ and LED−; it is not the drain voltage relative to GND.

Point
Measurement reference
Expected result
GPIO
GND
PWM of approximately 0 to 3.3 V
U1A output, pin 2
GND
Inverted signal
U1B output, pin 4
GND
Signal with the original logic polarity
Gate
Source
PWM of approximately 0 to 12 V
Drain
Source
Low when conducting; may rise close to the supply when off, depending on the load
Strip
LED+ minus LED−
Close to 12 V when on; when off, depends on the LEDs and capacitances, idealized as zero in the plot
Driver supply
Driver local GND
Close to 12 V; check ripple and spikes

In a real strip, LEDs and capacitances make the off-state voltage dependent on the circuit. Do not interpret every small deviation from the ideal waveform as an automatic failure.

On many bench oscilloscopes, the channels' ground clips are connected to one another and to protective earth. Connect them to GND/source, never to the drain or positive supply. To measure strip voltage, use a suitable differential probe or two channels referenced to the same GND and the CH1−CH2 math function, respecting the instrument's limits. Do not remove the oscilloscope's protective earth connection.

Measure VGS with a ×10 probe and a short return connection. A long probe ground lead can create apparent ringing. Measuring switching losses requires voltage and current measurements with suitable bandwidth and time alignment; a simple multimeter reading does not provide this energy.

With a multimeter, current is measured in series. Never connect the current input directly across the supply's positive and negative terminals. Check the instrument's fuse, range, and maximum measurement time; the “10 A” range on some meters does not allow continuous measurement at that current. A suitable DC clamp meter is an alternative.

22. Experiments to understand each component

Experiment A — Brightness, average current, and power

Keep the frequency at 2 kHz and record 0%, 25%, 50%, 75%, and 100%. Measure supply voltage and average current in the strip or supply branch, noting where the instrument was inserted. Compare with the prediction of D times the current at 100%. Driver consumption, ripple, and heating explain some of the differences.

Command
Predicted current for 6 A at 100%
Measured current
High-state VGS
Temperature after a defined interval
0%
≈0 A in the strip
To be measured
Not applicable
To be measured
25%
≈1.5 A
To be measured
To be measured
To be measured
50%
≈3 A
To be measured
To be measured
To be measured
75%
≈4.5 A
To be measured
To be measured
To be measured
100%
≈6 A
To be measured
To be measured
To be measured

Use the same stabilization time and record ambient temperature. None of the cells in this table contains a previously performed measurement.

Experiment B — What changes from 2 to 20 kHz?

Repeat 50% at both frequencies, starting with the short segment. Compare the period, VGS amplitude, and temperature. The ideal average current changes little; the number of transitions per second increases tenfold. Film the strip only as a supplementary observation: the camera has its own shutter behavior and frame rate, so bands in the image are not a direct PWM measurement.

Experiment C — With and without the SN74HC14N

Disconnect all power and build the direct-drive alternative from section 14.4. Repeat the tests. With short connections and a clean signal, brightness should be similar. This shows that a component can be useful for a specific function without being mandatory in every application.

Experiment D — Making hysteresis visible

Perform this experiment only on the logic circuit, with the 12 V supply off and U1B's output disconnected from the TC4420. This keeps the strip out of the experiment and prevents a slow signal from reaching the driver.

Disconnect the GPIO from the U1A input and remove R2 from the test node. Connect an extra 10 kΩ resistor between a control jumper and the U1A input, and an extra 100 nF capacitor between that input and GND. Keep U1 powered at 3.3 V with C2 installed.

τ=RC=10000×100×109=1ms\tau=RC=10000\times100\times10^{-9}=1\,\mathrm{ms}

With the capacitor initially discharged, connect the control jumper to 3.3 V. The input voltage will rise approximately according to:

vC(t)=3.3(1et/τ)v_C(t)=3.3\left(1-e^{-t/\tau}\right)

When the jumper is connected to GND, starting with the capacitor charged:

vC(t)=3.3et/τv_C(t)=3.3e^{-t/\tau}

Observe the input and U1A output simultaneously. Record the input voltage at the instant the output changes, first during the rising transition and then during the falling transition. These are thresholds measured on your component under your supply conditions.

Charging and discharging an educational RC network

Plot 6 — Ideal 10 kΩ and 100 nF network. The crossings use the same illustrative 2.0 V and 1.2 V thresholds as the hysteresis plot; the actual thresholds must be measured.

With the purely illustrative thresholds used in the plot, the charging curve crosses 2.0 V after approximately 0.93 ms and the discharging curve crosses 1.2 V after approximately 1.01 ms. These are predictions for the ideal RC network, not measurements of the SN74HC14N.

The output will transition quickly despite the slow input. Jumper contacts may bounce, so examine the capture instead of assuming there is a single edge. When finished, remove the extra network, reinstall R2, and restore the original connection before energizing the power stage.

Do not place this 100 nF capacitor in the normal 2 kHz PWM path: a 1 ms time constant strongly alters pulses whose period is 0.5 ms. A conditioner useful for one experiment may impair another function.

Experiment E — Gate resistance and speed

Only with an oscilloscope and a short strip segment, compare 22 Ω and 47 Ω for R4, changing parts with all power disconnected. Observe VGS and VDS. Higher resistance tends to slow switching and may reduce ringing, but it can also increase losses. Do not remove R4 or increase current to “force” a visible effect.

23. Troubleshooting: what to check when it does not work

Symptom
Possible causes
Initial check
Strip always on
Negative terminal connected to GND; drain-source short; permanently high command
Check LED− and measure VGS with a zero command
Strip always off
No 12 V; blown fuse; incorrect pinout; unpowered driver
Check the supply and test VGS at 0/100%
MOSFET heats up rapidly
Insufficient gate drive; poor source reference; slow transitions; damaged component
Power off and check VGS, current, and pinout
ESP32 resets
Shared power return path; unstable supply; interference
Review GND, cables, and decoupling
Brightness drops at the far end of the strip
Voltage drop in the strip traces and cables
Measure voltage along the powered strip
Fuse blows
Short circuit, overload, or startup current incompatible with the fuse curve
Power off and investigate; do not fit a larger fuse without checking the design
A brief flash occurs at power-up
Sequencing, boot GPIO behavior, or a floating input
Observe the command and VGS during startup
Waveforms show spikes
Layout, wire inductance, or probe artifact
Shorten the probe return and check current loops

A failure of the supply, transistor, or software can leave the load on. This project has no active overcurrent protection, temperature sensor, or independent shutdown. Those are extensions for the next stage, not features already implemented.

24. Worked exercises

1. A 9.6 W/m strip is five meters long. What is its nominal current?

P=9.6×5=48WI=4812=4AP=9.6\times5=48\,\mathrm{W}\qquad{}I=\frac{48}{12}=4\,\mathrm{A}

With an illustrative 25% margin, the reference supply capacity is 5 A. The supply must maintain 12 V under the actual operating conditions.

2. At 20 kHz and 30% duty, how long is the MOSFET commanded on?

T=50μston=0.30×50=15μsT=50\,\mu\mathrm{s}\qquad{}t_{\mathrm{on}}=0.30\times50=15\,\mu\mathrm{s}

3. With 6 A pulses and 25% duty, what are the average and RMS currents?

Iavg=6×0.25=1.5AIRMS=60.25=3AI_{\text{avg}}=6\times0.25=1.5\,\mathrm{A}\qquad{}I_{\mathrm{RMS}}=6\sqrt{0.25}=3\,\mathrm{A}

4. What is the conduction loss in that case, using 8 mΩ?

Pcond=32×0.008=0.072WP_{\mathrm{cond}}=3^2\times0.008=0.072\,\mathrm{W}

Using the average current of 1.5 A would produce an incorrect estimate of 0.018 W.

5. Why use two inverters? To retain HIGH as the on command and demonstrate Schmitt conditioning without inverting the final logic. A single gate would invert the command, including the state imposed by the pull-down.

6. Why not connect the gate to the SN74HC14N output and remove the TC4420? Because at this supply voltage, the logic output is close to 3.3 V and does not provide the gate-drive voltage and current chosen for the IRF3205 in this project.

7. Does the MOSFET's body diode replace D1? No. In this N-channel arrangement, the body diode conducts from source to drain. D1 is placed to conduct from drain to the positive bus during a transient. They are different paths.

8. Where can this architecture be used? In constant-voltage LED strip dimmers and other DC switching applications compatible with the topology and ratings. Motors, solenoids, and other loads require a fresh analysis of startup current, inductive energy, protection, and control. A working strip does not automatically validate the circuit for an injector or motor.

25. Guided datasheet reading

Before copying a value, ask: is it minimum, typical, or maximum? Is it a recommended condition or an absolute maximum rating? What is the temperature? What is the supply voltage? Was the measurement made with DC or pulses? Is the package the same?

A typical value describes representative behavior, not a guarantee for every part. An absolute maximum rating is a boundary that should not be used as a normal design point. Curves help explain trends but must be read with their stated conditions.

Document
Where to look
Design question
IRF3205PbF
Static characteristics; gate charge; thermal curves; SOA
Does the drive reduce resistance sufficiently? What thermal and electrical stresses are present?
TC4420/TC4429
DC characteristics; section 3; pin function table; test application
Does the input recognize 3.3 V? How should the supply, output, and decoupling be connected?
SN74HC14
Pinout; recommended conditions; thresholds; application
Is the supply compatible? Which inputs and outputs are in use?
STPS10L60
Ratings; forward voltage; package
Are reverse voltage, pulses, and polarity suitable?
LEDC
ledcAttach, ledcWrite, ledcChangeFrequency
Does the firmware use the API of the installed version?

26. References and further study

  1. Infineon — IRF3205PbF, official datasheet. MOSFET electrical and thermal parameters and pinout.
  2. Microchip — TC4420/TC4429, DS21419D. Driver, logic interface, supply, pinout, and decoupling.
  3. Texas Instruments — SN74HC14, SCLS085. Schmitt-trigger inverters, recommended conditions, and pinout.
  4. Texas Instruments — Understanding Schmitt Triggers, SCEA046. Hysteresis, thresholds, and interpretation of slow signals.
  5. Texas Instruments — Fundamentals of MOSFET and IGBT Gate Driver Circuits, SLUA618A. Gate charge, Miller plateau, drive, and parasitic effects.
  6. STMicroelectronics — STPS10L60, DS1593. Schottky diode used as the reference for D1.
  7. Espressif — Arduino-ESP32, LED Control (LEDC). PWM peripheral API.

The references were consulted when preparing the article. The drawings and plots were created for this lesson and do not reproduce manufacturers' figures. Numerical estimates apply to the assumptions stated in the text.

A natural next step is to add current measurement, log temperature, implement fault shutdown, and study how layout changes the waveforms. This turns an educational dimmer into a platform for understanding control and protection in power electronics.

Share

Subscribe

Engineering knowledge worth keeping

Receive new technical articles and field notes.