Post topics, source code that relate to the Arduino Platform

User avatar
By Amorphous
#92220 I am trying to drive a MOSFET using ESP-01 to control 12V supply. Schematic is attached. Here is my simple code -

Code: Select all#include <ESP8266WiFi.h>

#define MOSFET 2
#define SWITCH 0
#define DEBUG True

void setup() {
  pinMode(SWITCH, INPUT);     // Initialize the GPIO2 pin as an output
  pinMode(MOSFET, OUTPUT);
  digitalWrite(MOSFET, HIGH);

void loop() {

  // put your main code here, to run repeatedly:


But its not switching. What am I doing wrong? Pls help
You do not have the required permissions to view the files attached to this post.
User avatar
By Michaelo
#92303 You should be able to drive the MOSFET directly via a 10k current limiting resistor to its Gate?

The Gate Threshold Voltage (Vgs(th)@Id) : 3V 250uA...
Drain Source On Resistance (RDS(on)@Vgs,Id) : 0.009Ω 30A,10V

What's happening with the current circuit?
User avatar
By schufti
#92310 with a 10k resistor the gate (dis)charges much to slowly and mosfet will slowly pass through linear region, causing lots of powerdissipation -> defect.
for mosfets and digital signal you want the gatecurrent as high as possible. So for 3.3V and Igpio (max) 10mA you want 330Ohm resistor in series with the gate.