ESP32C3-Based Smart AC Light Controller with Voltage Sensing
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
The circuit in question appears to be designed for AC voltage measurement and control. It includes a microcontroller (XIAO ESP32C3) for processing and control, a voltage sensor module (ZMPT101B) for AC voltage sensing, a relay module (12v Relay) for controlling an AC load, a power supply module (Mini AC-DC 110V-230V to 5V 700mA) to convert AC to 5V DC for powering the circuit, an AC bulb as the load, and an AC wire to provide the AC power source.
Component List
XIAO ESP32C3
- Description: A microcontroller unit (MCU) based on the ESP32-C3 chip, featuring Wi-Fi and Bluetooth capabilities, along with multiple GPIO pins for interfacing with other components.
- Pins: GPIO2/A0/D0, GPIO3/A1/D1, GPIO4/A2/D2, GPIO5/A3/D3, GPIO6/SDA/D4, GPIO7/SCL/D5, GPIO21/Tx/D6, 5V, GND, 3V3, GPIO10/MOSI/D10, GPIO9/MISO/D9, GPIO8/SCK/D8, GPIO20/Rx/D7.
12v Relay
- Description: An electromechanical switch that allows the control of a high-power AC circuit by a low-power signal from the microcontroller.
- Pins: NO (Normally Open), COM (Common), NC (Normally Closed), IN (Input), DC- (DC Ground), DC+ (DC Power).
ZMPT101B
- Description: A module for measuring AC voltage with an output that can be read by a microcontroller.
- Pins: OUT (Output Signal), GND (Ground), VCC (Power Supply), NEUTRO (Neutral), FASE (Phase).
Mini AC-DC 110V-230V to 5V 700mA Module
- Description: A power supply module that converts AC voltage to 5V DC, suitable for powering the microcontroller and other low-power components.
- Pins: GND (Ground), 5V (DC Output), Neutral (AC Input), Life (AC Input).
AC Bulb
- Description: A standard AC bulb used as a load in the circuit.
- Pins: P (Phase), N (Neutral).
AC Wire
- Description: A wire to provide AC power to the circuit.
- Pins: GND (Ground), Phase (Phase).
Wiring Details
XIAO ESP32C3
- GPIO2/A0/D0 connected to 12v Relay IN
- GPIO3/A1/D1 connected to ZMPT101B OUT
- 5V connected to ZMPT101B VCC and 12v Relay DC+
- GND connected to ZMPT101B GND and 12v Relay DC-
12v Relay
- IN connected to XIAO ESP32C3 GPIO2/A0/D0
- COM connected to AC Wire Phase
- NC connected to ZMPT101B FASE and AC Bulb P
- DC+ connected to ZMPT101B VCC and XIAO ESP32C3 5V
- DC- connected to ZMPT101B GND and XIAO ESP32C3 GND
ZMPT101B
- OUT connected to XIAO ESP32C3 GPIO3/A1/D1
- VCC connected to 12v Relay DC+ and XIAO ESP32C3 5V
- GND connected to 12v Relay DC- and XIAO ESP32C3 GND
- NEUTRO connected to AC Wire GND, Mini AC-DC Module Neutral, and AC Bulb N
- FASE connected to 12v Relay NC and AC Bulb P
Mini AC-DC 110V-230V to 5V 700mA Module
- GND connected to AC Wire GND
- 5V output not connected in the provided net list
- Neutral connected to AC Wire GND and ZMPT101B NEUTRO
- Life connected to AC Wire Phase and 12v Relay COM
AC Bulb
- P connected to ZMPT101B FASE and 12v Relay NC
- N connected to ZMPT101B NEUTRO and AC Wire GND
AC Wire
- GND connected to ZMPT101B NEUTRO, Mini AC-DC Module Neutral, and AC Bulb N
- Phase connected to 12v Relay COM and Mini AC-DC Module Life
Documented Code
No code was provided for the microcontroller. The expected code should handle the following tasks:
- Read the output from the ZMPT101B voltage sensor module.
- Process the sensor data to determine the voltage level.
- Control the 12v Relay to switch the AC Bulb on or off based on the voltage level or other control logic.
To complete the documentation, the code for the XIAO ESP32C3 microcontroller should be provided and documented here. The code would typically include setup and loop functions, initialization of GPIO pins, ADC (Analog-to-Digital Converter) configuration for reading the ZMPT101B output, and logic to control the relay based on the sensor reading.