MuTech Robotics
Join
Adults onlyESP32Level 3/3

DIY Wi-Fi Touch Switch With ESP32

A glass touch panel that switches your light, fan, lamp and socket by touch or from your phone, and keeps working with no internet.

Sign in to save
DIY Wi-Fi Touch Switch With ESP32
Adults only

The relays switch mains electricity, which can kill.

Not for children. Build at your own risk.

MAINS VOLTAGE, ADULTS ONLY. Build this only if you are trained in mains wiring. Switch off the supply first, use a proper enclosure and fuse, and keep neutral going straight to the loads.

Strictly follow the description given with this video.

Video

How it works

  1. Four copper pads behind the glass sense a finger; the ESP32 reads them on its built-in touch pins.
  2. Each touch flips one channel of a 4-channel relay, which switches the live wire to that load.
  3. The ESP32 also serves a small web page, so the phone and the panel stay in sync.
  4. Touch works even if Wi-Fi is down. The fan output is on/off only, with no speed control.

Parts you need

  • ESP32 development board (30-pin)ESP32 development board (30-pin)₹518× 1Buy
  • 4-pad copper touch board× 1
  • 4-channel relay module4-channel relay module× 1Buy
  • AC to DC 5 V power module× 1
  • 4-way screw terminal block4-way screw terminal block₹9.2× 2Buy
  • Glass touch panel× 1
  • Fuse holder and fuseFuse holder and fuse₹230× 1Buy

Wiring

Touch pads 1–4ESP32GPIO4, 15, 13, 14GPIO26, 27, 25, 33VIN and relay VCCRelay IN1–IN45 V module outputRelay COM terminalsMains liveLight, fan, lamp, socketRelay NO terminalsStraight to the loadsMains neutralCommon GNDAll low-voltage grounds
PowerGroundSignal
#FromConnect to
1 SignalTouch pads 1–4ESP32 GPIO4, 15, 13, 14
2 SignalRelay IN1–IN4ESP32 GPIO26, 27, 25, 33
3 Power5 V module outputESP32 VIN and relay VCC
4 PowerMains live (fused)Relay COM terminals
5 PowerRelay NO terminalsLight, fan, lamp, socket
6 PowerMains neutralStraight to the loads
7 GroundAll low-voltage groundsCommon GND

3D print files

This project has no 3D-printed parts.

Code

Get the code