The gravity fan has 3 pins. I connected one pin to the ground, one pin to the digital pin numbered 2 on ESP8266. I uploaded this code but the fan doesn't run at all. The fan supposedly uses a 5V power supply but the ESP8266 only supplies 3.3V. Could this be the problem?
void setup() {
pinMode(2, OUTPUT);
}
void loop() {
digitalWrite(2, HIGH);
}
-
If the fan needs 5V power you need to give it 5V power. 3.3V logic is not 5V power.Majenko– Majenko2017年04月23日 18:41:55 +00:00Commented Apr 23, 2017 at 18:41
-
4Don't power stuff from I/O pins. An LED may work, but a fan will require too much power and also has a possibility to generate power (when turned by hand/wind) and may damage the pin.aaa– aaa2017年04月24日 06:40:14 +00:00Commented Apr 24, 2017 at 6:40
1 Answer 1
The ESP can only supply 12 milliamperes of current. The fan most likely uses a whole lot more. You could for example uses a transistor to turn on the fan.
answered Apr 23, 2017 at 20:18