1
\$\begingroup\$

I want to control two LEDs (red and green). The circuit is powered by 5V DC. The green LED is active 3.2V/20mA when the ESP32 pin is LOW (0V). When the pin is HIGH (3.3V), the green LED is inactive and activates the red LED 2V/20mA. I am using only one pin on the ESP32. ONLY ONE LED is active at a time!

Everything works, but the MOSFET is in linear mode, not saturation mode. Is this a problem? The green LED is active 23/7 at around 13mA, the red LED is only active for 1 hour out of 24 at around 13mA. Is this a problem with continuous operation? Is this circuit good for all components? Does it not overheat or consume more power than necessary? Can I change some of the components or redesign the circuit for better performance? Is it necessary to put some kind of pull-up or pull-down resistor to prevent the red LED from being activated incorrectly? My circuit is on image below:

enter image description here

\$\endgroup\$

2 Answers 2

0
\$\begingroup\$

The mosfet gate needs a pull-up resistor (like 1k to 10k) , otherwise the gate is supplied through red Led (2V drop) that makes the mosfet turning-on unpredictable (the gate voltage can be somewhere between 0-5V.

enter image description here

\$\endgroup\$
9
  • \$\begingroup\$ is it better if change mosfet with BSS138? For what is for 22k resistor? \$\endgroup\$ Commented Jun 7 at 18:16
  • \$\begingroup\$ It makes no difference whether you use 2n7000 or BSS138 in this kind of app. The 22k pulls the bjt base down during ESP32 startup since its output can be floated (high impedance) during this time. \$\endgroup\$ Commented Jun 7 at 18:24
  • \$\begingroup\$ it is possible to change mode of mosfet of linear to saturation? Is it problem if it is in linear mode? \$\endgroup\$ Commented Jun 7 at 18:37
  • \$\begingroup\$ The pull-up in the gate of mosfet I added should maintain it in saturation mode (during mosfet turn-on). \$\endgroup\$ Commented Jun 7 at 18:48
  • \$\begingroup\$ I make simulation on this site: falstad.com but result for Mosfet is n-MOSFET (Vt=3.3 V, B=0.02 Ids = 12.592 mA Vgs = 5V Vds = 422.976 mV linear gm = 8.46 mA/V P = 5.326 mW Ib = -171.387 nΑ \$\endgroup\$ Commented Jun 7 at 19:01
0
\$\begingroup\$

The Rds of your 2N7000 when Q1 is in cutoff should be ~2 ohms or perhaps a little more, which is high compared to power MOSFETS switching big currents, but your 20 mA indicator LED current will generate less than 1 mW inside M1 so even with its rather large 312.5°C/W Rth(j-a), you will raise junction temperature by a minuscule amount. You are fine.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.