Help with NodeMCU based smart switch

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. I've a few doubts:

  1. I want to power the MCU from the AC mains using an HLK-PM03 AC to DC converter with a 220mA fuse at input AC and a varistor and a 220uF capacitor at DC output. These will cost 3$, as much that MCU. Is there any other alternative?

  2. Can the 3.3V NodeMCU control a 5V relay like this (1 Channel 5V Relay Module buy online at Low Price in India - ElectronicsComp.com) since I can't find any 3.3V relays in India. Or must I use a logic level shifter? Or just use an ESP32 board (double price). [This is the main question]

  3. I want a physical override ie- even when the MCU system is off I can use the fans and lights (mostly for my technologically challenged parents). I can just replace the regular switches on the switchboard with two way SPDT switches, right? I also have inverter wire coming, will the wiring change in any way?

  4. Is it possible to get the status of either switch (physical as well as MCU controlled relay) whether it's powered on or not?

  5. If I want to scale the system to say 5 boards, is writing my own code with MQTT worth it or would Tasmota firmware suffice?

coldbreeze16:
3. I want a physical override ie- even when the MCU system is off I can use the fans and lights (mostly for my technologically challenged parents). I can just replace the regular switches on the switchboard with two way SPDT switches, right? I also have inverter wire coming, will the wiring change in any way?

No, you do not what to shut off the MCU control. Absolutely no reason to do so.

What you want is Sonoff Minis. It's all done for you, all your questions answered.

Aliexpress item.

If I wanted ready-made solutions, local market has cheaper smart switches than SONOFF. I want to DIY. Besides seems like aliexpress is blocked in India and any shipment from China won't easily pass through customs here.

Best to design small relay/triac boards that can also power the nodes, to put in the wall either behind the switch or in the junction box yourself, with switches to bypass the relay/triac if your system dies, it is a highly specialized part, that you probably wont find anywhere, I would probably do some construction work beforehand to lay some UTP, expand the boxes, and use PoE…

also what about the app to interface it to the smartphone

lot of work, but if you do it, you can think about starting a company that installs smart homes xD

Going bit too far into electronics territory there, haha. But I'll do some research. Also planning to use a simple HTML/PHP made web interface. Time permitting I plan to integrate it with Alexa.

As Paul said, the Sonoff Mini (flashed with Tasmota, of course) does everything you ask.
You can duplicate the Mini with a Wemos D1 Mini or NodeMCU - I did a few around my house before discovering the Sonoff Mini.

But since these are 3.3V devices you have to use 3.3v relays.

You may be able to use relay modules that take 3.3V as a control signal.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.