Call Us Now
0242159130 | 0546096840
Up to 2% reward

For new all Customers

Delevery schedule

We deliver  the same day through VIP bus parcel Service in Ghana

Discount on order gift

Save ¢10.00 when you spend ¢600+! 

How to control LED with Relay

How to control LED with Relay

Experimental 4

In this tutorial,we will learn how to switch On -Off LED using 5volt relay. Its simply mean when the relay sucks, the LED will light up; when the relay breaks, the LED will go out .

Hardware Required

1 x Arduino Uno

1 x USB Cable

1 x 5v Relay

1 x LED

1 x BC547 Transistor

1 x 1n4007 Diode or 1n4001 diode

1 x 680Ω Resistor or 1kΩ Resistor

1 x 220Ω Resistor

1 x Breadboard

1 x Several jumper wires 

Principle of operation

A relay is an electromagnetic operated switch. It is generally used in automatic control devices. Actually, it is an "automatic switch" which uses low current to control high current.It plays a role of automatic regulation,security protection and circuit switch. When an electric current is passed through the coil it generates a magnetic field that activates the armature, and the consequent movement of the movable contact(s)either makes or breaks(depending upon construction) a connection with a fixed contact. If the set of contacts was closed when the relay was de-energized, then the movement opens the contacts and breaks the connection, and vice versa if the contacts were open. When the current to the coil is switched off,the armature is returned by a force, approximately half as strong as the magnetic force, to its relaxed position. Usually this force is provided by a spring, but gravity is also used commonly in industrial motor starters. Most relays are manufactured to operate quickly. In a low-voltage application this reduces noise; in a high voltage or current application it reduces arcing. When the coil is energized with direct current, a diode is often placed across the coil to dissipate the energy from the collapsing magnetic field at deactivation, which would otherwise generate a voltage spike dangerous to

Brief Description on BC547

BC547 is a NPN transistor hence the collector and emitter will be left open (Reverse biased) when the base pin is held at ground and will be closed (Forward biased) when a signal is provided to base pin. BC547 has a gain value of 110 to 800, this value determines the amplification capacity of the transistor. The maximum amount of current that could flow through the Collector pin is 100mA, hence we cannot connect loads that consume more than 100mA using this transistor. To bias a transistor we have to supply current to base pin, this current (IB) should be limited to 5mA.

BC547 as Amplifier

A Transistors acts as an Amplifier when operating in Active Region. It can amplify power, voltage and current at different configurations.

Some of the configurations used in amplifier circuits are

  1. Common emitter amplifier
  2. Common collector amplifier
  3. Common base amplifier

BC547 Equivalent Transistors

BC549, BC636, BC639, 2N2222 TO-922N2222 TO-18, 2N2369, 2N3055, 2N3904,2N3906, 2SC5200

Each time you press the button, the Arduino will regard you have pressed the button many times due to the jitter of the button You should deal with the jitter of buttons before using. You can eliminate the jitter through software programming. Besides, you can use a capacitor to solve the issue. Take the software method for example. First, detect whether the level of button interface is low level or high level. If it is low level, 5~10ms delay is needed. Then detect whether the level of button interface is low or high. If the signal is low, you can infer that the button is pressed once. You can also use a 0.1uF capacitor to avoid the jitter of buttons.

Brief Description and the use of Relay

Relays are most commonly used switching device in electronics. Let us learn how to use one in our circuits based on the requirement of our project.

Before we proceed with the circuit to drive the relay we have to consider two important parameter of the relay. Once is the Trigger Voltage, this is the voltage required to turn on the relay that is to change the contact from Common->NC to Common->NO. Our relay here has 5V trigger voltage, but you can also find relays of values 3V, 6V and even 12V so select one based on the available voltage in your project. The other parameter is your Load Voltage & Current, this is the amount of voltage or current that the NC,NO or Common terminal of the relay could withstand, in our case for DC it is maximum of 5V and 10A. Make sure the load you are using falls into this range. 

Experiment code

//File name:   Experiment 4

//Description: controlling of  an LED using 5v relay.



//Author: Okudzeto osei prince

//Date: 2019/06/08

const int relayPin = 11; //the base of the transistor attach to pin 11

void setup()


  pinMode(relayPin, OUTPUT); //initialize the relayPin as an output


void loop()


  digitalWrite(relayPin, HIGH); // this energize the relay coil to turn on LED

  delay(1000); //wait for a second

  digitalWrite(relayPin, LOW); //this de-energize the relay coil to turn off LED

  delay(1000); //wait for a second


Compile the program and upload to Arduino Uno board Now, Now let's see what will happen: When the set of contacts are closed, the LED lights up; when they are open, the LED goes out. 

Add Comment