Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Swap D3 from 1N4002 to a much faster 1N4148, it's still plenty big enough for that task as the relay back emf won't have much energy. Never use a slow relay diode with a micro circuit! D4 is not needed.
Replace D2 with a big cap, at least 470uF, this will decouple any relay current surge from your main supply AND supply the main current pulse to let the relay pull-in.
Then you can increase the value of R3 to reduce relay operating (hold) current to a value less than its pull-in current but safely above its drop-out current. This reduces FET heating AND reduces the back emf energy from relay turn off AND provides greater isolation between relay and PSU/micro in general.
Get rid of the inductor after the regulator (blech!), replace with a small resistor for filtering (assuming you are not using ADC and dont need a perfect 5.0v) drop about 0.1v on the resistor at normal micro operating current and add a 10uF tantalum across C5.
Finally if you are just driving the FET on/off (not pwm) then replace R2 with a safer value like 2k7 which will save your micro if the FET lets go and you get full PSU voltage where its gate used to be you will only get a couple mA into the micro pin internal protection diode.
Why not set it for landscape? It's much easier to read.
Available board space doesn't allow another big electrolytic cap.![]()
I've got hundreds of those micro-inductors. Using an additional tantalum I'll check if I can squeeze it in.
The FET is zener protected, so no reason to protect the MCU.
But do you really want all the potential problems of ringing and instability and inductor life (they are notoriously unreliable compared to a resistor) when there is absolutely no need? A 10 ohm resistor would perform so much better than a 10uH choke for suppression there unless you need high Vdd accuracy for ADC use.
But still, what's your reason for using such a low gate resistor to switch a relay? Again if there is no NEED for a low resistor why not use a higher value and reduce the micro output pin current to drive the gate capacitance? It's a few uS extra to turn the FET on (relay takes 10's of mS anyway) but is many times less current from the micro pin.