How to Control 220V Light Bulb from 5V Arduino using a Relay

In this tutorial, you will learn how to control a 220V light bulb from 5V Arduino using a relay.

Parts Required

  • Arduino
  • Relay
  • Jumper wires
  • Light Bulb
  • Breadboard



void setup() {
 pinMode(2, OUTPUT);

void loop() {
 digitalWrite(2, HIGH);
 digitalWrite(2, LOW); 

The code shown will turn the light on and off at 2-second intervals, if you want to put a button to control it just add a digital input.



Leave a Reply

Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock