I have a simple fan. When I plug it to GND and Vin it spins. I'd like to have the ability to turn it on / off with code. Any example will do, as long as it gets it to spin. I have a NodeMCU board, if that helps.
Asked
Active
Viewed 429 times
0
-
1Use a MOSFET as digital switch. Fan+ to Vin, Fan- to MOSFET drain, MOSFET source to ground, MOSFET gate to a digital pin of the Arduino. You can google MOSFET as a switch – chrisl May 21 '19 at 20:21
-
1Related if not dupe: https://arduino.stackexchange.com/q/54018/17196 and https://arduino.stackexchange.com/q/54145/17196 – Ghanima May 21 '19 at 20:46
-
1google images "mosfet switch low side" – dandavis May 22 '19 at 16:34
2 Answers
2
Depending of the type of fan you are using, two solutions exist.
- First one, use a MOSFET to drive the FAN from you nodemcu
- Second one, use a relay to drive the FAN from your nodemcu
Things to consider :
- The mosfet allow you to drive the fan without mechanical part moving.
- The relay require some transistor and feedback diode to be driven by your µc.
P0pR0cK5
- 179
- 2
-
-
Motor driver in the end is just several mosfets connected in a smart way. It's unnecessarly complicated and redundant if fan just spins when you supply power. There is a very good chance that the fan already has a driver inside it (all computer fans do) – Filip Franik May 24 '19 at 08:36
0
So I didn't have a transistor to do a MOSFET, but I did have a motor driver which I ended up using. From there it was just finding example code to use the motor driver, connecting it up and using it.
R0b0tn1k
- 187
- 1
- 2
- 7