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!

Hello! We have noticed you are using an ad blocker. Our website is funded by advertising which allows you to access all our content for free. By disabling your ad blocker, you are contributing to the sustainability of our project and ensuring we continue to provide high-quality, useful tutorials. We appreciate your support!