The reliable way to build this project is to use the NodeMCU ESP8266 as a Wi-Fi relay controller and Sinric Pro as the bridge to Google Home and Alexa. Physical switches can still operate the relays locally, while the cloud connection makes the same devices available in the Google Home and Alexa apps.
This is an excellent low-voltage maker project, but a bare relay board and breadboard are not automatically suitable for permanent household mains wiring. Test the controller with a low-voltage load first. For fixed 120 V or 230 V installations, use an enclosed, suitably rated device and have the mains work completed or checked by a qualified electrician.
As an Amazon Associate I earn from qualifying purchases.
What you are building
The finished controller has four parts:
- NodeMCU ESP8266: connects to Wi-Fi, reads local switches and controls relay outputs.
- Relay module: electrically isolates the low-voltage controller from the switched circuit when properly designed and installed.
- Sinric Pro: provides the cloud connection and virtual smart devices.
- Google Home and Alexa: expose those virtual devices in their apps and, optionally, through Nest or Echo speakers.
Google Assistant and Alexa do not run directly on the ESP8266. The actual path is:
Physical switch ─┐
├─> NodeMCU ESP8266 ──Wi-Fi──> Sinric Pro ──> Google Home
Relay output <──┘ └──────> Alexa
Manual control can continue when the internet is unavailable, provided the NodeMCU, relay supply and local firmware remain powered. Remote control requires working power, Wi-Fi, internet access, the Sinric Pro service and correctly linked assistant accounts.
#1 Best Overall
- Powered by SmartThings: Connect, monitor, and automate your home through the SmartThings app. Build a reliable, unified smart home using Samsung's proven ecosystem
- Matter + Zigbee Smart Home Hub: Supports the newest Matter standard plus Zigbee for lighting, sensors, plugs, switches, thermostats, and more - thousands of compatible devices. PLEASE NOTE: Z-Wave not supported
- Easy Setup with Wi-Fi or Ethernet: Get started in minutes using Wi-Fi or a wired Ethernet connection for apartments, houses, and expanding smart home systems - Z-Wave not supported
- Automations That Work for You: Create custom routines for security, lighting, comfort, and energy savings. Many local automations continue working even if your internet goes offline
- Wide Device Compatibility: Connect compatible smart devices from Aeotec and many other brands to build a unified system for lighting, voice control, energy management, and climate settings
You can use the Google Home and Alexa apps without owning a Nest or Echo speaker. A speaker is optional hardware for hands-free voice commands in the room.
Sinric Pro currently documents support for ESP8266 and ESP32, Alexa, Google Home, mobile apps, Home Assistant, Node-RED, Homebridge and APIs. See the current Sinric Pro documentation and its official ESP8266/ESP32 SDK rather than relying on old library downloads.
Parts and tools
Low-voltage prototype
- NodeMCU development board based on the ESP8266.
- Four-channel 5 V relay module, or a smaller board matching the number of outputs required.
- Regulated 5 V power supply with adequate current capacity.
- Momentary push buttons or physical switches.
- USB cable for programming.
- Jumper wires, terminal blocks and a suitable enclosure.
- A low-voltage test lamp or other isolated load for initial testing.
The reference project uses a NodeMCU, a four-channel 5 V SPDT relay module and switches or push buttons. Echo Dot and Google Nest Mini devices are optional. The relay board must be compatible with 3.3 V GPIO control; do not assume every “5 V relay module” will reliably recognize an ESP8266 output.
For a custom relay PCB
The published custom design includes individual 5 V relays, BC547 transistors, PC817 optocouplers, resistors, LEDs, 1N4007 flyback diodes, push buttons, terminal connectors and a 5 V supply. Treat these as reference components, not a universal bill of materials. Coil current, transistor drive, isolation spacing, PCB layout and load ratings must all be designed for the exact hardware.
Safety before wiring
Never connect household AC directly to an ESP8266 GPIO. The NodeMCU is a low-voltage controller; it does not make mains wiring safe.
- Start with an isolated, low-voltage test load.
- Use a properly enclosed relay assembly with appropriate terminals, insulation and spacing.
- Keep mains conductors physically separated from USB, GPIO and switch wiring.
- Use strain relief, suitable fusing and insulated terminals.
- Check relay voltage, continuous current, inrush current and load type.
- Take extra care with motors, pumps, compressors and LED drivers because their startup current may exceed their apparent wattage.
- Disconnect power before making or changing wiring.
- Do not place exposed mains wiring on a breadboard.
- For permanent household wiring, follow local electrical codes and use a qualified electrician.
A certified enclosed smart relay or smart switch is generally a better choice for a permanent construction or renovation project than a bare hobby relay board.
GPIO map and relay logic
The reference NodeMCU design uses the following board labels:
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Rank #2
- 2 MODES IN 1 GATEWAY: This Smart home hub support Bluetooth mesh (SIG) + Zigbee3.0 multi-protocol communication. Only one gateway is needed to connect devices of different protocols to the 2.4Ghz network.
- APP REMOTE CONTROL: Smart Bluetooth Zigbee hub works with smart life/Tuya App, Support Adding devices, device reset, third-party control and group control. You can manage and remotely control the device through the Smart Life App. You can manage and remotely control your lights, fingerbot and other smart devices via the app, even when you're not home.
- VOICE CONTROL: The smart hub Support voice control, Simply give a voice command to Alexa or Google home to control devices(such as turn on/off the smart plug, turn on/off the Finger Bot).
- SMART HOME AUTOMATION: Sub-devices of the gateway act as trigger conditions for Interacting with devices such as ZigBee, Bluetooth, Wi-Fi, for device linkage. Featured as one powerful network bridge for whole house linkage in a real sense for all smart home devices.
- SUPPORT 128 DEVICES: Support up to 128 Tuya smart home devices, such as ZigBee Motion Sensor, Leak Detector, BLE Finger Bot, Zigbee Door Sensor, BLE Thermometer, ZigBee Window Gate Sensor, etc. NOTE: Supports Tuya/SmartLife devices only.
| Function | NodeMCU label | Important qualification |
|---|---|---|
| Relay 1–4 | D1, D2, D5, D6 | Verify the board’s label-to-GPIO mapping. |
| Switch 1–4 | SD3, D3, D7, RX | Several pins are boot- or serial-sensitive. |
Board labels are not raw GPIO numbers. For example, a label such as D1 must be translated according to the particular NodeMCU board and Arduino core configuration. Consult the ESP8266 Arduino Core documentation and the board’s pinout.
The reference firmware uses:
INPUT_PULLUPfor switches.- A switch connected between the input pin and ground.
- Active-low relay control:
LOWenergizes the relay andHIGHturns it off.
Relay modules vary. Some are active-high, some active-low, and some have input thresholds that are unreliable with 3.3 V logic. Confirm the behavior with a meter or a low-voltage test load before connecting anything hazardous. If your board is active-high, reverse the output constants in the firmware.
D3 and SD3 are associated with ESP8266 bootstrapping. Pulling a boot-sensitive pin to the wrong level during reset can prevent the board from starting. RX is also the serial receive pin and may interfere with programming or debugging. Safer GPIO choices depend on the exact board and peripherals, so test the board with switches and relay inputs disconnected before finalizing the pin assignment.
Set up Sinric Pro
- Create an account through the Sinric Pro portal.
- Create a module or device setup using the current dashboard.
- Add one virtual smart switch for each relay channel.
- Record the application key, application secret and every device ID.
- Install the current ESP8266/ESP32 SDK and follow its dependency instructions.
- Put the Wi-Fi and Sinric credentials into the firmware.
- Flash the NodeMCU and confirm that it appears online.
- Test each virtual switch in the Sinric app or dashboard before connecting Alexa or Google Home.
Sinric Pro’s current website advertises three free devices and lists premium devices at $3 per device per year, checked August 18, 2026. Pricing, limits and account screens can change, so verify the current terms before designing around them. A four-channel relay board does not automatically mean four permanently free cloud devices.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →One physical module can host multiple virtual devices, allowing separate names such as “Kitchen Light,” “Porch Light,” “Desk Lamp” and “Bedroom Fan.”
Install the Arduino environment
- Install the current Arduino IDE from the official Arduino website.
- Add the current ESP8266 board package through Board Manager.
- Install the current Sinric Pro ESP8266/ESP32 library and its dependencies from the official repository.
- Select the correct NodeMCU or ESP8266 board and serial port.
- Compile an official Sinric example before adding custom relay and switch logic.
- Keep credentials out of screenshots and public repositories.
Older tutorials mention particular WebSockets and ArduinoJson versions. Those instructions are historical and should not be treated as a reason to pin a new installation to old packages. Use the versions and dependency instructions maintained by the official SDK.
Firmware behavior
The firmware should perform five jobs:
- Connect to Wi-Fi and retry if the connection is lost.
- Maintain the Sinric Pro connection and process cloud events.
- Initialize relay outputs to an explicitly safe state.
- Read and debounce the physical switches.
- Report every local state change back to the cloud.
The desired logic is:
Cloud command received:
change the relay output
report the resulting state
Physical switch changes:
debounce the input
change the relay output
report the resulting state
Wi-Fi lost:
keep local control working where possible
retry without repeatedly chattering the relay
Use short, non-blocking timing logic instead of long delays. Add serial logging for connection status, device IDs, switch events and relay state. A watchdog or automatic restart strategy can help recover from faults, but it should not conceal an unstable power supply or poor wiring.
Rank #3
- 【2 Modes in 1 Gateway】Support MOES/Tuya Bluetooth mesh (SIG) + Zigbee3.0 multi-protocol communication. Only one gateway is needed to connect devices of different protocols to the 2.4Ghz network.
- 【Support 128 Devices】 Support up to 128 Tuya smart home devices, such as Bluetooth Door Lock, ZigBee Light Switch No Neutral, Bluetooth Finger, Zigbee Power Monitor Plug, Bluetooth Thermometer, ZigBee Window Gate Sensor, etc.
- 【Sound & Light Alarm】 Support sound and light alarm.Support Local Scenario / Support Local Automation / Support Security Function and be integrated into the Tuya Security Saas Platform.
- 【Voice & App Remote Control】 No matter where you are, you can control the connected smart devices through the MOES/Smart Life App on your mobile phone. Support voice control of Alexa, and Google Assistant.
- 【ESAY SET-UP】Designed for quick and easy set-up with absolutely no wiring or technical skills required.Quickly and easily add, reset, and group devices via the hub.
Initialize outputs before connecting the relay load, and decide whether the safe startup state is all-off or another documented state. Do not assume that a relay’s power-on state is safe.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Choose the local switch type
Maintained switches
A maintained switch has a physical position representing on or off. It feels natural for household wiring, but it can conflict with a remote command. For example, the switch may remain physically “on” while Alexa has turned the relay off.
Momentary push buttons
A push button lets the firmware interpret each press as a toggle. This is usually easier to synchronize with cloud state, provided the firmware debounces the input and reports the new state.
Choose and document a conflict policy:
- Local switch always wins.
- Cloud command always wins.
- Any button press toggles the current state.
- A maintained switch position determines the state after synchronization.
Test rapid presses, a local press during a cloud command and a reboot while a switch is held. A boot-sensitive pin can still cause trouble regardless of whether the control is a switch or a button; the reference project’s observation about push buttons is project-specific, not a universal rule.
Link Alexa
- Open the Alexa app.
- Enable or link the Sinric Pro skill.
- Authenticate with the same Sinric Pro account used by the firmware.
- Run device discovery.
- Give each device a short, unambiguous name.
- Assign devices to rooms.
- Test “turn on” and “turn off” commands.
If discovery fails, first verify the device in Sinric Pro. Then relink or resync the skill and avoid duplicate names such as several devices called “Light.”
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesLink Google Home
- Open the Google Home app.
- Open the home-control or device-integration area.
- Add or link Sinric Pro.
- Authenticate the Sinric Pro account.
- Sync devices if they do not appear automatically.
- Assign devices to rooms.
- Test each device in the app before trying voice commands.
Labels and menus can vary by app version, language and country. Sinric Pro advertises Google Home and Alexa integrations, but availability can vary by market. Follow its current integration instructions if the menu names differ from those above.
Test in stages
- USB-only boot: disconnect relay inputs and switches, then confirm that the NodeMCU starts.
- GPIO test: verify the selected output pins and active-high or active-low behavior.
- Relay test: connect a low-voltage test load, not household mains.
- Local control: test every switch and button, including debouncing.
- Sinric test: operate each virtual device from the Sinric app.
- Alexa test: discover and control each device.
- Google Home test: sync, assign rooms and control each device.
- Connectivity test: remove internet access and confirm the expected local behavior.
- Power-cycle test: restart the controller and check its safe startup state.
- Load test: only after all previous tests pass, connect the intended enclosed and rated load.
Troubleshooting
The NodeMCU does not boot
Disconnect relays and switches and retry with USB power only. If it then works, a boot-sensitive input may be held at the wrong level. Move switches away from D3 or SD3, avoid using RX during serial debugging, and reconnect peripherals one at a time. Also check for a noisy or undersized 5 V supply.
Rank #4
- Stability Upgrade Quick Connection:Supports Bluetooth or WiFi connection.The improved WiFi technology let you quick connection and stay stable,no disconnection worries. Please keep the smart plug connected to your stable 2.4GHz network.(Note: Only 2.4Ghz WiFi)
- Hand-Free Voice Control:Smart plugs that work with Alexa and Googel Assistant. Just give a simple voice command to Alexa or Google Assistant to control your connected home devices. Enjoy the joy of smart home devices.
- APP Remote Control From Anywhere:You also can control your outlet timers anywhere anytime via the APP directly when you are away. Monitor and control connected electrical equipment in your home.The smart outlet plug compatible with GHome APP, Smart Life App and Tuya App.
- Schedules and Timer Function:Easy to set timers and add schedules to connected smart home devices circularly or randomly, making them work as scheduled like auto-off and auto-on to save energy and money. Such as lamps, fan, humidifier, Christmas light timers etc.
- Group Control and Sharing:You can set a group for some wifi smart plugs and control connected appliances with one tap. Also you can share your wifi outlet plug by App with your families and enjoy the smart life together.
The relay operates backwards
Your module may be active-low while the firmware assumes active-high, or vice versa. Verify which input level energizes the relay, then reverse the output logic. Never infer the state solely from the app icon.
The relay clicks but the app shows the wrong state
Check that each virtual device has the correct device ID. Ensure local switch events call the cloud state-reporting function. Confirm the physical relay state and the reported state separately.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Alexa or Google Home cannot find the devices
- Confirm that the device is online in Sinric Pro.
- Check that the assistant account is linked to the same Sinric account.
- Resync or rediscover devices.
- Use distinct device names and assign rooms after discovery.
- Check regional and language availability.
Remote control is intermittent
Test Wi-Fi signal strength, the 5 V supply and serial logs. Relay noise can reset the ESP8266, while blocking firmware can prevent reconnection. Test first with the relay disconnected, then with a low-voltage load. Use proper decoupling and separate power wiring where the hardware design requires it.
Local switches conflict with remote control
This is a state-design problem rather than an assistant problem. Choose one conflict policy, implement it explicitly and report the resulting state after every local change.
Alternatives and upgrade paths
ESP32
An ESP32 offers more memory, GPIO and peripherals and is also supported by Sinric Pro. It is a good choice for a new design with sensors, displays or more complex local logic. It is not a drop-in replacement: pin labels, board definitions, boot behavior and firmware configuration differ.
Home Assistant
Home Assistant is better suited to users who prioritize local automation, privacy and a larger integration ecosystem. It requires an always-running host and more maintenance. Sinric Pro lists Home Assistant as an integration, so it can also be a migration path rather than a completely separate project.
Recommended Free Tools
Certified smart relay
For a permanent construction or renovation project, a certified enclosed smart relay or switch is usually the practical choice. It offers better terminals, enclosure design and installation guidance than an exposed hobby board, though its firmware, cloud service and subscription terms may be less flexible.
Final verdict
NodeMCU, a suitable relay board and Sinric Pro can provide a practical learning platform for controlling lights or appliances from physical switches, Google Home and Alexa. The strongest design keeps local control working when possible, synchronizes state after every change and treats the cloud as an optional remote layer rather than the only control path.
Use the published D1/D2/D5/D6 relay map as a reference, not a universal wiring rule. Resolve boot-pin issues before installing switches, test active-low behavior with a low-voltage load, and do not move an exposed prototype into permanent mains service. For household AC, enclosure, ratings, isolation and code-compliant installation matter as much as the firmware.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Free tools Windows power users keep installed
One-click scans. No signup required.

