0

I have a working fan control with the correct wiring that works with arduino.

I would like to change the arduino with a Wemos D1 mini board.

When I hook everything up. The fans are not activated.

The fan is driven by a 12v charger. And the irf540n cicruit powers that. They just share a common ground and the pwm pin D5

Is there something I need to know about the difference in both of them?

Below is the code, I've changed D5 in the code to 14.

Still nothing seems to work.

    #define fan D5

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.println("start");
  pinMode(fan, OUTPUT);

  digitalWrite(fan, LOW);
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(1000);
  digitalWrite(fan, HIGH);

  delay(1000);
  digitalWrite(fan, LOW);
}
  • Yes. The Wemos is 3.3V. Have you taken that into account with your circuit design? – Majenko Apr 15 at 14:19
  • What kind of Arduino did you use before? Arduino is a broad family of different boards with different chips – chrisl Apr 15 at 14:34
  • @Majenko I thought that didn't matter because the fan is driven by a 12v charger. And the irf540n cicruit powers that. They just share a common ground and the pwm pin D5 – LazyFatTree Apr 15 at 15:15
  • IRF540 is not a good choice. You want something that has a lower threshold voltage really. – Majenko Apr 15 at 15:28
  • Indeed just switched everything up with an Arduino and it works... @Majenko would a level bit shifter work for this? (pure out of interest) – LazyFatTree Apr 16 at 6:54
0

The IRF540 is not suitable to be controlled by a 3.3V device because it has a gate-source-threshold voltage of 2-4V (that's the voltage at which the mosfet starts to conduct, but you need to be above that voltage). While this worked at 5V logic level on the arduino, the 3.3V are not enough to make the mosfet switch entirely.

A suitable mosfet has a threshold voltage below 1V. Also for a fan, you eon't need a big mosfet rated for 30A, a tiny one will do it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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