ESP32-Based Smart Environment Controller with Relay and Sensor Integration
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
The circuit in question is designed to interface various sensors and modules with an ESP32 microcontroller. The circuit includes a relay module for controlling AC loads, a PTC for circuit protection, an infrared temperature sensor (mlx90614), an AC power source, an AC-to-DC converter (actodc), an ultrasonic sensor (HC-SR04), an I2C LCD display, and a fan. The ESP32 serves as the central processing unit, controlling the relay, reading sensor data, and displaying information on the LCD. The mlx90614 and LCD communicate with the ESP32 via I2C, while the HC-SR04 interfaces through GPIO pins. The fan is powered by the circuit, and the AC-to-DC converter supplies the necessary voltages for the components.
Component List
KY-019 Relay Module 1 Channel
- Description: A relay module used for switching high voltage/current loads.
- Pins: S (Signal), 5V, GND (Ground), NC (Normally Closed), COM (Common), NO (Normally Open)
PTC (Positive Temperature Coefficient)
- Description: A resettable fuse used for overcurrent protection.
- Pins: Neutral, Live
mlx90614 Infrared Temperature Sensor
- Description: A non-contact infrared temperature sensor.
- Pins: SDA (Serial Data), SCL (Serial Clock), GND, VIN (Voltage In)
AC Source
- Description: Provides alternating current power supply.
- Pins: -, +
actodc (AC to DC Converter)
- Description: Converts AC power to DC power.
- Pins: 12v, -, 5v, live, neutral
ESP32 - 38 Pins Expansion Board
- Description: A microcontroller board with Wi-Fi and Bluetooth capabilities.
- Pins: EN, SVP, SVN, P34, P35, P32, P33, P25, P26, P27, P14, P12, P13, SD2, SD3, CMD, 5V, P23, P22, TX, RX, P19, P18, P5, P17, P16, P4, P0, P2, P15, SD1, SD0, CLK, VCC, G, D22, D21, 3V, V, -
HC-SR04 Ultrasonic Sensor
- Description: Measures distance by emitting ultrasonic waves.
- Pins: VCC, TRIG (Trigger), ECHO (Echo), GND
LCD Display 16x4 I2C
- Description: An alphanumeric liquid crystal display with an I2C interface.
- Pins: SCL, SDA, VCC, GND
Fan
- Description: A small DC fan for cooling purposes.
- Pins: GND, 5V
Wiring Details
KY-019 Relay Module 1 Channel
- S (Signal) connected to ESP32 P14
- 5V connected to ESP32 5V
- GND connected to ESP32 G
- COM connected to AC source +
- NO connected to PTC Neutral
PTC (Positive Temperature Coefficient)
- Neutral connected to KY-019 Relay Module NO
- Live connected to AC source - and actodc live
mlx90614 Infrared Temperature Sensor
- SDA connected to ESP32 P23
- SCL connected to ESP32 P22
- GND connected to ESP32 G
- VIN connected to ESP32 3V
AC Source
-
- connected to KY-019 Relay Module COM
-
- connected to PTC Live and actodc live
actodc (AC to DC Converter)
- 12v connected to ESP32 V
-
- connected to ESP32 -
- 5v not connected
- live connected to AC source - and PTC Live
- neutral connected to KY-019 Relay Module COM
ESP32 - 38 Pins Expansion Board
- P14 connected to KY-019 Relay Module S
- 5V connected to KY-019 Relay Module 5V, LCD Display VCC, and HC-SR04 VCC
- G connected to KY-019 Relay Module GND, mlx90614 GND, LCD Display GND, and HC-SR04 GND
- P23 connected to LCD Display SDA and mlx90614 SDA
- P22 connected to LCD Display SCL and mlx90614 SCL
- 3V connected to mlx90614 VIN
- V connected to actodc 12v
-
- connected to actodc -
- P18 connected to HC-SR04 ECHO
- P5 connected to HC-SR04 TRIG
HC-SR04 Ultrasonic Sensor
- VCC connected to ESP32 5V
- TRIG connected to ESP32 P5
- ECHO connected to ESP32 P18
- GND connected to ESP32 G
LCD Display 16x4 I2C
- SCL connected to ESP32 P22 and mlx90614 SCL
- SDA connected to ESP32 P23 and mlx90614 SDA
- VCC connected to ESP32 5V
- GND connected to ESP32 G
Fan
- 5V connected to actodc 5v
- GND connected to actodc -
Documented Code
No code was provided for the microcontrollers in the circuit. Therefore, this section is left blank until the relevant code is supplied.