Control AC light using Arduino

The first tutorial everyone suggests in Arduino is Blinking a LED. Today I will show you how to control an AC light/appliance with the same Blink sketch 🙂
Controlling AC light or appliance with Arduino is as simple as blinking a LED using Arduino.
All you need to is take proper care while doing this project because here we are dealing with AC current (230V is more than enough to kill you). So beware


Things you need


  • AC Bulb
  • Bulb Socket
  • screw terminal connector

Before we Build

What is a relay?

Relays are switches that open and close circuits electromechanically. They control one electrical circuit by opening and closing contacts in another circuit
A relay has 5 pins namely COIL A, B, NO, NC, COM

There are 5 Pins in a relay. Two pins A and B are two ends of a coil that is inside the relay. The coil gets energized whenever current passes through it.

NC = Normally Closed is connected to pin when the relay coil is not energized.

NO = Normally Open, is left disconnected when the relay coil is not magnetized and is connected COM when the relay coil is pin when the relay coil is not energized.

COM = Common, At no input state, the COM is connected to NC. When the operating voltage is applied to relay coil gets energized and the COM changes contact to NORelay GIF

Why BC547?

5V Relay needs about 200mA current at 5V. But the digital pins of Arduino provides only 20 mA current. So Arduino cannot drive the relay directly. So as amplifier we need to used a transistor to drive the relay

Why Diode?

The relay coil cannot change it’s current instantly, diode provides a path for the current when the coil is switched off. Otherwise, a voltage spike will occur causing arcing on switch contacts or possibly destroying switching transistors

Watch the video

Let’s start building

The circuit is very simple and small, there is only few things to place.

Wire as per the below-given schematics

AC circuit_schem



This is an illustration of the circuit

Upload Code to Arduino

There is no need to download any code you have the code within the software just upload the Blink Sketch and watch the AC light blinking as a  LED blinks



This is just basic tutorial on interfacing Relay with Arduino
This project can be improved to a higher level like Home automation using a smartphone, Clap switch and much more


Subscribe to blog for newsletter and like my facebook page for receiving new post notification



2 Comments Add yours

  1. Yoshi says:

    Hi, could this work if I let the lamp blink at 80 hz? Or would it shortcircuit/overload?

    thanks in advance


  2. Md Mosleuddin sahan says:

    Bro can u help me in a bluethooth based ardunio uno r3 led controlling.It’s very important for me for my school science project.I am bangladeshi.plzzz help


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s