Automate Your Home with an Arduino Smart Light Switch


Materials

  • Arduino Uno
  • Relay Module
  • AC Light Bulb
  • Power Cable
  • Breadboard and Jumper Wires

Instructions

  1. Connect the relay module to the Arduino. Ensure the relay can handle the AC voltage.
  2. Wire the relay to the AC power source and the light bulb.
  3. Upload the following code to your Arduino:

[dm_code_snippet]
const int relayPin = 8;

void setup() {
pinMode(relayPin, OUTPUT);
}

void loop() {
digitalWrite(relayPin, HIGH);
delay(5000);
digitalWrite(relayPin, LOW);
delay(5000);
}
[/dm_code_snippet]

Explanation

The relay module is used to switch the AC light bulb on and off. The code alternates the relay state every 5 seconds to control the light.

Conclusion

This project introduces home automation using Arduino. It’s a simple way to control household devices with programmable logic.

Leave a Comment

Free & easy backlink link building. Of employers in hong kong are increasingly aware of their qualities and beginning to hire an overseas indonesian fdh.