Arduino-Controlled Relay Switch for AC Bulb with RTC Synchronization
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
The circuit in question is designed to control an AC bulb using a 1-Channel Relay module, which is interfaced with an Arduino UNO microcontroller. The Arduino UNO also communicates with an RTC DS3231 module to keep track of real-time. A 5V Adapter provides power to the circuit. The relay module enables the Arduino to switch the high-voltage AC bulb on and off. The RTC module allows for time-based control if programmed accordingly.
Component List
Arduino UNO
- Microcontroller board based on the ATmega328P
- It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.
1-Channel Relay (5V 10A)
- A relay module capable of switching up to 10A of current at 5V.
- It has a set of normally closed (NC), common (C), and normally open (NO) contacts, along with a signal input, power, and ground.
AC Bulb
- A standard AC-powered light bulb.
- It has two terminals: Phase (P) and Neutral (N).
Power 220v
- A 220V AC power source.
- It has a hot wire and a neutral wire.
RTC DS3231
- A real-time clock module that maintains accurate timekeeping with a temperature-compensated crystal oscillator.
- It has pins for 32KHz output, square wave output (SQW), I2C communication (SCL, SDA), power (VCC), and ground (GND).
5V Adapter
- A power adapter that converts 220V AC to 5V DC.
- It has inputs for AC and outputs for 5V and GND.
Wiring Details
Arduino UNO
- 5V connected to Relay Module power and RTC DS3231 VCC.
- GND connected to Relay Module ground and RTC DS3231 GND.
- Vin connected to 5V Adapter 5V output.
- A4 (SDA) connected to RTC DS3231 SDA.
- A5 (SCL) connected to RTC DS3231 SCL.
- D2 connected to Relay Module signal.
1-Channel Relay (5V 10A)
- Power connected to Arduino UNO 5V.
- Ground connected to Arduino UNO GND and 5V Adapter GND.
- Signal connected to Arduino UNO D2.
- C (Common) connected to Power 220v neutral wire.
- NO (Normally Open) connected to AC Bulb N.
AC Bulb
- P (Phase) connected to Power 220v hot wire.
- N (Neutral) connected to Relay Module NO.
Power 220v
- Hot wire connected to AC Bulb P.
- Neutral wire connected to Relay Module C.
RTC DS3231
- VCC connected to Arduino UNO 5V.
- GND connected to Arduino UNO GND.
- SDA connected to Arduino UNO A4.
- SCL connected to Arduino UNO A5.
5V Adapter
- 5V connected to Arduino UNO Vin.
- GND connected to Relay Module ground and Arduino UNO GND.
Documented Code
Arduino UNO Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
The provided code is a template with empty setup() and loop() functions. The setup() function is intended for initialization code that runs once at the start, while the loop() function contains the main code that runs repeatedly. Actual functionality must be implemented within these functions to control the relay and interact with the RTC module.