The project I'm planning is to use a NodeMCU at each electrical board in house to control lights and fans via relays. Each MCU will communicate via MQTT over WiFi to a Raspberry Pi 4 from where I can control all lights and fans in the house. My doubt is:

Can the 3.3V NodeMCU drive a 5V relay like this 1 Channel 5V Relay Module with Optocoupler since I can't find any 3.3 V relays in India. Or must I use a logic level shifter? Or just use an ESP32 board (double price).

  • not drive, which means that the NodeMCU would supply power to the relay solenoid , but control, which means that the NodeMCU would operate a relay driver circuit
    – jsotola
    Feb 8, 2021 at 20:07
  • in my experience, 3.3v compat with those types of relay modules (i've tried 4 or 5 styles) will vary; some will be fine, some won't like it at all, and some will be spotty. For lower wattage loads like lighting, you can actually just use a triac-based optocoupler, some of which handle a few 100ma.
    – dandavis
    Feb 8, 2021 at 21:18
  • You don't need the typical level shifter. A.simple little transistor in combination is totally sufficient for the signal line of the relay module. Then you only need to provide 5V power (with which you can power the relay and the NodeMCU)
    – chrisl
    Feb 8, 2021 at 21:48

1 Answer 1


The relay I linked to couldn't be operated with 3v3 from the NodeMCU board. I was powering the NodeMCU via a breadboard power supply that had both 3v3 and 5v output (https://www.electronicscomp.com/mb102-breadboard-power-supply-module). I connected the Vcc and GND of relay to 5V supply on that module. the IO pin relay was connected to NoddeMCU. It worked fine and NodeMCU could switch it on and off.

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.