Page 1 of 1

NPN transistor to drive a relay and IRF520 by ESP32 digital pin (3.3v)

Posted: Fri Apr 17, 2020 10:02 pm
by emmefreeze
hi all, i'm working on an automatic grow system that use sensors and actuators to keep cultivation in its optimal state, managing growth parameters dynamically.

My first prototype was made with ESP8266 (nodemcu 0.9) but 3.3v of digital pins are too low to switch well relays and MOSFET in saturation and i needed more pins for all components.

After i decided to use a strange Mega2560 + esp8266 pre-soldered (All in one) but it seems to me a unreliable solution also if 5v make relays and MOS works well. (https://win.adrirobot.it/wemos_mega/wemos_mega.htm).

i thinks ESP32 DEV KIT can works well in this configuration (it has several analog and digial gpio) but it remains the problem about 3.3v of GPIO.

Here is the list of actuators that I would like to drive by digital pins of an esp32:

PC fan ---> MOSFET IRF520 (on a board) to use PWM
water pump -----> mosfet board as switch (relay make noise)
LED lamp ------> 5v relay on board (with led and some resistors)
my best solution was use a NPN transistor (np2222a) connected to 5v between ESP32 and relay and all works well. Also MOSFET seems to open well but i think it isn't in saturation.

I'm here to ask someone more expert for advice and maybe suggestions

Moreover, anyone can help me to understand the value of resistors that i have to put in this circuit?? Now I have put "common" values ​​looking on the internet but I have not understood if they are correct. I don't know also if the circuit i'have made is right. The photo is limited to actuators part

p.s. sorry for my english ;)

Image