Electronic – Is this a sensbile way to switch a 12V line with 3.3V logic

esp8266microcontrollerswitching

I am just starting to learn about making electronic things, so this may be a foolish question. I think this is adequately different to similar questions here.

As a first project I am working on making a fan controller based around an ESP32/ESP8266 MCU (I'm coming from software development, so this feels like a comfortable route in). The fan is a 4-wire PC fan (SUNON PMD1206PMB3-A 12V 3.4W). I have a working system to send the PWM signal to control the fan speed and plan to work on getting back the fan's tacho, but am having an issue with system stability on start up that I believe is due to power stability caused by the fan drawing current while the MCU is booting. An approach that I'm thinking of is to get the MCU to control the power to the fan and only switch it on when the boot is complete (this has the advantage of allowing the fan to be turned off when the set speed is zero – the zero duty cycle oddly leaves the fan running at 20rpm).

Since the ESP32 uses 3.3V logic I cannot directly switch a MOSFET with a line from the MCU, so I was thinking of using something like this.

3.3V to 12V load switch

Is this a sensible approach? Is there a better way to do this?

Note that the +12V and +5V are already available in the circuit – though from looking at this related answer it appears I could draw from the 12V.

Best Answer

Lots of problems with your circuit:

  1. T1 is used as a emitter follower. Its output will therefore be less than the 3.3 V input. Figure 700 mV for the B-E drop, and the maximum the gate of Q1 is driven to is 2.6 V

  2. Q1 is used as a source follower. Its output will thefefore be less than its input. Unlike a BJT, as T1 is, the G-S voltage is not so easily known. To drive any substantial current, it must at least somewhat above the gate threshold voltage. With only 2.6 V on the gate, there may not be any voltage left at all to drive the motor. Basically, the motor will never be turned on by this circuit.

  3. Even if the above weren't problems, there is nothing driving the gate of Q1 low when the motor is supposed to be off.

A simple circuit that does what you want is to use a N channel FET that can be driven well from 3.3 V as a low side switch. For example, the IRLML6344 would be suitable here. It has a maximum RDSON of 37 mΩ with only 2.5 V gate drive.

Connect the motor (with diode as you show) between the 12 V power supply and the FET drain, source to ground, and drive the gate directly from the 0 to 3.3 V digital output. Yes, it's that easy:

Related Topic