Safety and scope
Mains voltage can cause fatal injury or fire. This page describes a concept only; mains wiring and installation must be performed and verified by a qualified electrical professional.
Plan, predict and test
Suggested virtual study time: about 25 minutes. This is a planning estimate, not a validated construction time.
Preparation: Foundation electronics, embedded programming and subsystem testing. Review a foundation lesson ↗
Use paper, a spreadsheet or a simulator. This is not a verified physical assembly guide.
- Scenario: Model ON, OFF and unknown voice commands using an indicator only. No mains loads.
- Expected result: Validate commands and handle disconnection with a defined safe default.
- Checkpoint: Write your prediction, test it in the virtual model and explain any difference.
A correct answer does not certify the physical system.
Record your validation
Use only virtual inputs and indicators until the actual components, pinouts and electrical limits have been verified.
| Case | What to record |
|---|---|
| Normal input | ON and OFF → corresponding virtual indicator states |
| Boundary | Case/whitespace normalization must be specified |
| Missing or invalid input | Unknown or disconnected input → no unvalidated action; simulation only. |
| Repeat test | Repeat the virtual test, record the actual output and compare with the expected result. |
These are test-planning requirements, not recorded hardware results.
Before building: understand the listed components and the relevant low-voltage safety rules. This is a concept brief, not a tested assembly manual.
What it does
Understand the path from a voice interface through a cloud service to a connected device and switched output.
Engineering principle
A voice assistant interprets the request and passes a command through a bridge service such as Sinric Pro to the ESP32. The ESP32 changes a GPIO output that drives an appropriately interfaced relay module. The low-voltage control system and mains load side require correct isolation, enclosure and protection design.
Hardware and components
- ESP32 boardConnects to the network and processes incoming device commands.
- 4-channel relay moduleProvides switched outputs with ratings and isolation appropriate to the intended load.
- Voice assistant/cloud bridgeRoutes recognised voice commands to the ESP32.
- Enclosure, terminals and fuse/protectionRequired for a properly designed installed system.
- Regulated low-voltage power supplyPowers the ESP32 and relay control side.
Suggested build sequence
- Build and verify the ESP32 command receiver using an LED or other safe low-voltage load.
- Connect the controller to the selected cloud bridge and define the device endpoints.
- Test each command and verify that the relay state matches the requested state.
- Add reconnect handling, manual override and safe default output states.
- Only move to real appliance switching after a qualified person has designed and checked the mains interface and enclosure.
Learning outcomes
- IoT device control
- Cloud event flow
- Relay interfacing
- Isolation and mains safety requirements
Possible upgrades
Add local control fallback, power-state feedback, device grouping or usage logging.