Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Wi-Fi Controlled Smart Relay with ESP32 and AC LED Bulb

Image of Wi-Fi Controlled Smart Relay with ESP32 and AC LED Bulb

Circuit Documentation

Summary of the Circuit

The circuit described is designed to control an AC-powered LED bulb using a microcontroller, specifically an ESP32 (30 pin) module. The circuit includes a 5V adapter to step down the 220V AC power to 5V DC, which powers both the ESP32 and a relay module. The relay module is used to switch the LED bulb on and off. The ESP32 controls the relay module via one of its digital pins. The circuit is powered by two separate 220V AC power sources, one for the LED bulb and one for the 5V adapter.

Component List

LED Bulb AC / Bombillo AC

  • Description: An AC-powered LED bulb.
  • Pins: +, -

Power 220V (Source 1)

  • Description: A 220V AC power source.
  • Pins: hot wire, neutral wire

Power 220V (Source 2)

  • Description: Another 220V AC power source.
  • Pins: hot wire, neutral wire

5V Adapter

  • Description: A power adapter that converts 220V AC to 5V DC.
  • Pins: AC In 1, AC In 2, 5V, GND

Relay Module 5V-30V

  • Description: A relay module that can be triggered by a 5V signal to switch higher voltage circuits.
  • Pins: common contact, normally open, normally closed, trigger, V-, V+

ESP32 (30 Pin)

  • Description: A microcontroller with WiFi capabilities, used to control the relay module.
  • Pins: EN, VP, VN, D34, D35, D32, D33, D25, D26, D27, D14, D12, D13, GND, Vin, D23, D22, TX0, RX0, D21, D19, D18, D5, TX2, RX2, D4, D2, D15, 3V3

Wiring Details

LED Bulb AC / Bombillo AC

  • + connected to the normally open pin of the Relay Module.
  • - connected to the hot wire of Power 220V (Source 2).

Power 220V (Source 1)

  • hot wire connected to AC In 1 of the 5V Adapter.
  • neutral wire connected to AC In 2 of the 5V Adapter.

Power 220V (Source 2)

  • hot wire connected to the + pin of the LED Bulb AC / Bombillo AC.
  • neutral wire connected to the common contact pin of the Relay Module.

5V Adapter

  • AC In 1 connected to the hot wire of Power 220V (Source 1).
  • AC In 2 connected to the neutral wire of Power 220V (Source 1).
  • 5V connected to Vin of the ESP32 and V+ of the Relay Module.
  • GND connected to GND of the ESP32 and V- of the Relay Module.

Relay Module 5V-30V

  • common contact connected to the neutral wire of Power 220V (Source 2).
  • normally open connected to the + pin of the LED Bulb AC / Bombillo AC.
  • trigger connected to D13 of the ESP32.
  • V+ connected to 5V of the 5V Adapter.
  • V- connected to GND of the 5V Adapter.

ESP32 (30 Pin)

  • Vin connected to 5V of the 5V Adapter.
  • GND connected to GND of the 5V Adapter.
  • D13 connected to trigger of the Relay Module.

Documented Code

There is no code provided for the ESP32 microcontroller. To complete the circuit functionality, code would need to be written and uploaded to the ESP32 to control the relay module based on the desired logic (e.g., switching the LED bulb on and off based on a schedule or sensor input). The code would typically be written in C or C++ using the Arduino IDE or the ESP-IDF framework and would involve setting up the GPIO pin connected to the relay module as an output and then toggling it to control the state of the relay.