Day 01

Begineer

Day 22 :- Relay Control Project)

Sept 02, 2026

Completed

Wiring Schematic

Arduino Code

ARDUINO / C++

Day 22 Core Training Documentation

Project Overview

The Relay Control Project teaches you one of the most important concepts in embedded systems: safely controlling high-power appliances using low-voltage Arduino signals through relay switches.

In this project, a Relay Module acts as an intelligent electrical switch. Arduino sends a low-voltage control signal to the relay, which then switches a high-voltage circuit on or off. This allows Arduino to control powerful devices like coffee makers, lights, pumps, and heating elements safely.

When the Arduino sends a HIGH signal to the relay, the electromagnet activates, closing the switch and powering the high-voltage appliance. When the Arduino sends a LOW signal, the electromagnet deactivates, opening the switch and cutting power to the appliance.

This project teaches Relay Operation, High-Voltage Circuit Switching, Electromagnetic Control, Appliance Automation, and Safety Protocols for High-Power Device Control.

By finishing this project, you’ll understand how industrial automation systems safely control heavy machinery and how smart home systems manage powerful household appliances.

Components Required

To build this circuit, collect these specific items from your kit:

Arduino Uno × 1, Breadboard × 1, 4-Channel Relay Module × 1, Push Button × 1, 10kΩ Resistor × 1, Indicator LEDs × 4, 220Ω Resistor × 4, Jumper Wires × 10, USB Cable × 1

Circuit Connections

Step 1: Connect Ground Rail

Connect the Arduino GND pin to the negative rail of the breadboard. This creates a shared ground connection for all components.

Step 2: Connect Relay Module VCC

Connect the VCC pin of the 4-channel Relay Module to Arduino 5V. This provides power to activate the relay electromagnets.

Step 3: Connect Relay Module GND

Connect the GND pin of the Relay Module to the breadboard GND rail. This completes the relay power circuit.

Step 4: Connect Relay Channel 1 Control

Connect the IN1 (input signal) pin of the Relay Module to Arduino Pin 2. This pin controls the first relay channel.

Step 5: Connect Relay Channel 2 Control

Connect the IN2 pin to Arduino Pin 3. This pin controls the second relay channel.

Step 6: Connect Relay Channel 3 Control

Connect the IN3 pin to Arduino Pin 4. This pin controls the third relay channel.

Step 7: Connect Relay Channel 4 Control

Connect the IN4 pin to Arduino Pin 5. This pin controls the fourth relay channel.

Step 8: Connect Push Button

Place the push button on the breadboard across the center gap. Connect one side to Arduino Pin 6. Connect the other side to the breadboard GND rail.

Step 9: Connect Button Pull-Up Resistor

Connect one end of the 10kΩ resistor to Arduino Pin 6 and the other end to Arduino 5V. This ensures reliable button press detection.

Step 10: Connect Indicator LEDs

Connect the first indicator LED (anode) to Arduino Pin 10 through a 220Ω resistor. Connect its cathode to GND. Repeat for LEDs 2, 3, and 4 using Pins 11, 12, and 13.

Step 11: Connect High-Voltage Appliances

For each relay channel, connect your high-voltage appliance to the relay’s normally open (NO) and common (COM) terminals. The relay controls power delivery to each appliance.

Step 12: Verify All Connections

Check all relay signal connections and indicator LED wiring before applying power. Ensure high-voltage connections are secure and properly isolated.

Important: Never touch high-voltage wiring while the circuit is powered. Always verify relay terminals are correctly labeled before connecting appliances. Multiple relays allow independent control of multiple devices simultaneously.

How the Arduino Code Works

Initialize All Control Pins

In setup(), Arduino sets Pins 2 through 5 as OUTPUT for relay control. Pins 10 through 13 are configured as OUTPUT for indicator LEDs. Pin 6 is set as INPUT_PULLUP for button detection.

Read Button Input

The program continuously checks if the button is pressed using digitalRead(Pin 6). When a button press is detected, a relay channel is activated.

Activate Single Relay

When the button is pressed, Arduino sends a HIGH signal to one of the relay control pins. This activates that relay channel, closing the switch and powering the connected appliance.

Provide Visual Feedback

When a relay is activated, Arduino turns on the corresponding indicator LED. This visual feedback shows which appliances are currently powered and controlled by the relays.
 

Cycle Through Relays

Each button press activates the next relay in sequence. After all four relays are activated and tested, the sequence repeats. This demonstrates the independent control capability of each relay channel.
 

Continuous Monitoring

The entire process repeats inside the loop() function. The system continuously monitors the button and manages relay states, allowing safe control of high-power appliances through simple button presses.

Expected Output

After uploading your code, here is what happens.

At startup, all relays are deactivated and all indicator LEDs are off. Press the button once and Relay 1 activates, its indicator LED turns on, and the first appliance receives power. Press the button again and Relay 1 deactivates, Relay 2 activates, and the second appliance powers on while the first turns off. Continuing to press the button cycles through all four relays. Each press advances to the next relay in sequence. The indicator LEDs clearly show which appliances are currently powered. After the fourth relay, pressing the button again returns to Relay 1, cycling continuously.

Operational Troubleshooting

Relay Does Not Activate :- Verify the signal pin connects to the correct relay input. Check that the Relay Module receives proper 5V power on the VCC pin. Test with a simple HIGH/LOW pin test to verify the control pin is working.

Relay Activates But Appliance Does Not Power :- Check the appliance connections at the relay terminals. Verify the high-voltage circuit is complete and the appliance is functional. Ensure the correct relay terminals (NO and COM) are being used, not the normally closed (NC) terminals.

Relay Clicks But Makes Strange Sounds :- This indicates the relay is struggling to activate. Check that the Relay Module is receiving stable power. Verify the control signal is clean and not noisy.

Button Presses Not Detected :- Verify Pin 6 connects to the button and the pull-up resistor is between Pin 6 and 5V. Check for loose connections on the button. Try pressing the button more firmly and for longer duration.

Indicator LEDs Do Not Light :- Check that indicator LED anodes connect through resistors to the correct pins. Verify LED cathodes connect to GND. Test the LEDs individually to ensure they are functional.

What You Learned

By finishing this project, you now know :-

How relay modules work as electromagnetic switches, how to safely control high-voltage circuits from low-voltage Arduino, how to manage multiple independent relay channels, how to provide user feedback with indicator LEDs, and how to build automation systems for controlling powerful appliances.

Next Lesson

In Day 23, you’ll learn how to build a Servo-Based Door Lock System, creating a secure smart lock that opens and closes electronically using Servo Motor positioning.