ESP32-Controlled Smart Relay with Touch Activation and OLED Feedback
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to control an AC bulb using an ESP32 microcontroller, which interfaces with a relay module, an OLED display, and touch sensors. The ESP32 controls the relay to switch the AC bulb on or off, receives touch input, and displays information on the OLED screen. The LED and resistor are used as an indicator, likely for power or status.
Component List
ESP32 (30 pin)
- Microcontroller with WiFi and Bluetooth capabilities.
- 30 GPIO pins including analog inputs, digital IOs, power, and ground.
Touch Sensor
- Capacitive touch sensor with IO, VCC, and GND pins.
OLED Display (128x32)
- Small screen for displaying text and graphics.
- Communicates with the ESP32 via I2C (SDA and SCL).
LED (White, Two Pin)
- A simple white LED with an anode and cathode.
Resistor
- A 220 Ohm resistor, likely used to limit current to the LED.
1 Channel 5V Relay Module
- A relay module for controlling high power devices.
- Has pins for VCC, GND, signal input, and switch contacts (N.O., COM, N.C.).
AC Bulb
- A standard AC bulb with positive and negative terminals.
120V Outlet
- An outlet to provide AC power to the bulb.
Wiring Details
ESP32 (30 pin)
D13connected to Relay Module (signal input)GNDconnected to common ground netVinconnected to Relay Module VCC+D22(SCL) connected to OLED Display SCLD21(SDA) connected to OLED Display SDAD4connected to LED anodeD2connected to Touch Sensor IO (first sensor)D15connected to Touch Sensor IO (second sensor)3V3connected to VCC net for Touch Sensors and OLED Display
Touch Sensor
IOconnected to ESP32 (D2 for the first sensor, D15 for the second sensor)VCCconnected to 3V3 net from ESP32GNDconnected to common ground net
OLED Display (128x32)
SDAconnected to ESP32 D21SCLconnected to ESP32 D22VCCconnected to 3V3 net from ESP32GNDconnected to common ground net
LED (White, Two Pin)
Anodeconnected to ESP32 D4Cathodeconnected to one end of the Resistor
Resistor
- One end connected to LED cathode
- Other end connected to common ground net
1 Channel 5V Relay Module
INconnected to ESP32 D13VCC+connected to ESP32 VinVCC- (GND)connected to common ground netN.O.connected to AC Bulb PCOMconnected to 120V Outlet AC Hot
AC Bulb
Pconnected to Relay Module N.O.Nconnected to 120V Outlet AC Neutral
120V Outlet
AC Neutralconnected to AC Bulb NAC Hotconnected to Relay Module COM
Documented Code
No code was provided for the microcontroller. The expected functionality would include initializing the GPIO pins, setting up the I2C communication for the OLED display, reading touch sensor inputs, and controlling the relay to turn the AC bulb on or off based on the touch sensor inputs or other logic. Additionally, the code would handle updating the OLED display with relevant information such as system status or touch sensor states.