Switch 5VDC/3A with ESP32 Output

Woffels's picture

Offline

Joined: Aug 30, 2020

Replies: 3
Switch 5VDC/3A with ESP32 Output
August 30, 2020 - 1:05pm

Hello,

I want to switch the power supply of a component (5V/3A) with an GPIO output of a ESP32 (3V3/10mA). I have read about a mosfet or solid state relay solution but i am not sure how this looks like on the ESP. Esspecially, can this be done with a 3v3/10mA output and how does the circuit look like. The idea is to use the logic hig state of the output to interrupt the the supply of the 5V component.

Thanks in advance,

William Offels

Debashis Das's picture

Offline

Joined: Dec 02, 2019

Replies: 98

The above schematic is a very common way to drive a Mosfet with ESP32. don't forget to put on a heat sink, cause the mosfet is going to get really hot!Annotation 2020-08-30 154552.png

Sourav Gupta's picture

Offline

Joined: Feb 12, 2018

Replies: 318

Additonally, The MOSFET in Debasish schematic, you can use MOSFET with very low RDSon MOSFET that could reduce the heat dissipation. You can also avoid the transistor and directly connect the ESP pin across the MOSFET gate.

Woffels's picture

Offline

Joined: Aug 30, 2020

Replies: 3

Does this also work with 5V as Vin and 3v3 coming from the ESP32 output.

 

Woffels's picture

Offline

Joined: Aug 30, 2020

Replies: 3

Dear Sourav Gupta,

Can you send me a drawing/sketch with you solution with only a MOSFET and the type of mosfet you recommend.

Debashis Das's picture

Offline

Joined: Dec 02, 2019

Replies: 98

As mr sourav recommends. A single mosfet can be used to drive the load very easily, but its way cheaper this way. I have used generic parts which can be found in any electronic store. the BC588 can also be replaced by a BC548.

Sourav Gupta's picture

Offline

Joined: Feb 12, 2018

Replies: 318

You can use any mosfet, Just make sure it has low rds on. As Debasish describe he used generic components, you can also find a low rds on mosfet with atleast 5-10A drain current rating.

The drawing is perfect made by debasish. You could remove the transistor and the 10k resistor. Directly connect the 1k resistor into the Mosfet gate. Thats fine.

Debashis Das's picture

Offline

Joined: Dec 02, 2019

Replies: 98

Hi sourav, my intention is not to offend you, but did you somehow forget the output and transfer characteristics of a N-Channel Enhancement Type MOSFET.

Because with my limited knoledge, i know that if i try to turn on a Mosfet like IRFZ44N with 3.3V logic, it will always operate on the Ohomic Region. i did a simulation on proteus, with a 3.3V logic input the drain current was 0. is I am wrong? 

Annotation 2020-08-31 101025.png

Sourav Gupta's picture

Offline

Joined: Feb 12, 2018

Replies: 318

You are absolutely right. Thats why I said your design is perfect.

I have also said to use a low RDs on mosfet first. I did not re-draw the schematic. One can use the 3.3V logic directly if the RDSon resistance is much lower.

Most common low RDSon MOSFET found in the market FQP30N06L. It can directly be drived as low as 1.8 Vgs.

The thing is, IRFZ44N is generally used for High Amp rating. In such High Amp it is unusual to have a system logic voltage less than 10Vgs. (Typically Motor control + Power Amplifier or Inverter with SPWM). It is not made to use with a low vgs applications.

I will not use transistor to drive a mosfet at any case where my mcu is a very low voltage low current one. I will choose a MOSFET with proper rating for the application. The reason is very simple, Transistor consumes current and you need hefty amount of current to drive one (Its hefty if you compare with the application of a mcu that works with battery powered operation, the modualrity will lost if the user want to use the application from a battery source in future he needs to change a lot of things) where as the MOSFET use Voltage (Current also but less than 250uA not matter unless it is absolutely necessary).

When you have logic voltage of really low, and the interfaced MOSFET is going into ohmic region and you need additional translator (Transistor in this case) to convert the simple Vgs level, I think the design need to be checked once again. For hobby project its ok, for a serious one its not. But It is good to be perfect from the first time I think.

Woffels's picture

Offline

Joined: Aug 30, 2020

Replies: 3

Looks like, it is getting close to a perfect solution. I am not such an expert in electronics, so if you (Sorav Gupta) would be so kind to sketch me your final toughts in a circuit, then i wil built it, test it and report my findings back to you all.

 

Sourav Gupta's picture

Offline

Joined: Feb 12, 2018

Replies: 318

Insted of the STP36NF06L, use FQP30N06L mosfet. Mind it - FQP30N06 and FQP30N06L are two different MOSFET. FQP30N06L - L stands for logic level Mosfet.

 

Capture-FQ.JPG

 

Ashutosh's picture

Offline

Joined: Aug 27, 2018

Replies: 19

Hey guys intresting discussion. So according to the schematic shared by sourav if I use the STP36NF06L MOSFET then what is the maximum load current for my circuit? I pulled the Outptu characteristcs and Transfer characteristics graph from the datasheet 

With referance to above graph is it safe to assume that with 3.3V GPIO pin of my ESP32 I will be able to drive 15V through the mosfet at 5V Vds?

I know my graph is very rough, so is there are formulae to calculate the value of Id accurately?

Also how much current will be drawn from my gpio pin on ESP32 in this set-up?

 

Thanks in advance 

 

 

acelectric103's picture

Offline

Joined: Sep 07, 2020

Replies: 2

Can you please provide some pictures ?

Sourav Gupta's picture

Offline

Joined: Feb 12, 2018

Replies: 318

As per the figure 4 at 3VGS with 15V VDS you could transfer 10A of load current. But actual scenario is diifferent because there are lots of dipendencies lies within including the junction temparature, heatsink, ambient temparature etc.