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
    Apr 23, 2017 at 18:41
  • 4
    Don'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
    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.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.