
This project combines two ideas we covered separately before — an ESP32 web server and relay control — into one application that controls a high-voltage device via a web browser from any device on the same network.
Components needed
An ESP32 board, a relay module (single or multi-channel), a separate power supply for the relay's control circuit, and the device to be controlled.
Wiring it up
The relay module's IN1 input pin connects to GPIO26 on the ESP32 (any other suitable GPIO pin can be used), with the relay's control circuit powered separately. Since the example uses a normally-open relay configuration, the control logic is inverted: a LOW signal allows current to flow, while a HIGH signal stops it.
How it works
The code creates an HTTP server that allows remote relay control through a simple browser interface; the basic example toggles a lamp on and off automatically every 10 seconds, and the code can be extended to control several relay channels together by defining their count and each one's GPIO pin.
You can find ESP32 boards and relay modules at Juthour Tech.
اترك تعليقا