Wemos D1 doesnt drive Relay I recently bought a Wemos D1 board and tried to connect a relay and test its connection.

I got an example server from here and executed. I connected D5 to a Relay's data and 5v and GND from Wemos board.

But this does not change the state of relay, it always remains high. I connected a LED for D5, it works perfectly with client's response.

Then I powered relay using an external 5v and ground connection, but the same result.

I have checked for possible solution, but coulnt find an answer.

The relay I am using is this one
The board which you are using is operating on 3v3. Even if you try to run the relay using the D5 or any other pin on the board, you may not be able to run it successfully at all times. In this case, you can go for either MOSFETs or Pull-up resistors so that you can hold the voltage to 5V for triggering the relay. I would personally suggest to go for a PNP type.

As requested by Sachith, here is the circuit suggested for the problem stated. Just note that the voltage source should be +5 V (which is +1 V in the schematic). Also, the MOSFET is not the specific one, it is just for the schematic purpose.







simulate this circuit &ndash; Schematic created using CircuitLab