This is the project students ask for most, and the one that needs the most care: it touches mains voltage. Read the safety step first and build the low-voltage half completely before anything is plugged into a wall socket.
The electronics are straightforward. A NodeMCU joins your WiFi and serves a tiny web page with on/off buttons. Pressing a button toggles a GPIO pin, which drives an opto-isolated relay, which closes the circuit to the lamp. The relay board's isolation is what keeps the mains side and the logic side apart.
What you'll learn
- Serving a control page from an ESP8266
- Driving a relay through an optocoupler, and why isolation matters
- Separating low-voltage and mains wiring in a build
- Keeping state so the switch survives a reboot
Choose your components
Build Phone-controlled smart switch: Complete Components Kit
Select the hardware you need, then add your selected components to your RoboSixLab shopping cart. Untick anything you already own.
Tools you'll need
- Insulated screwdriver
- Wire stripper
- An adult supervising every mains connection
- An IEC or plug-in lamp you are allowed to modify
Tools are not included in the pack or the component list.