Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

PRACTICAL NO.

02
AIM - Interfacing LED, Buzzer & Relay with Arduino uno r4 wifi.

APPARATUS – LED, Buzzer, Relay,220-ohm resistor, breadboard, jumper wires, Arduino


uno r4 wifi, computer etc.

THEORY –
The relay is the device that open or closes the contacts to cause the operation of the
other electric control. It detects the intolerable or undesirable condition with an assigned
area and gives the commands to the circuit breaker to disconnect the affected area. Thus
protects the system from damage. A common form of industrial Relay module looks
something like this

A relay is an electrically operated switch. They commonly use an electromagnet (coil) to


operate their internal mechanical switching mechanism (contacts). When a relay contact
is open, this will switch power ON for a circuit when the coil is activated.

Used Resources:
Circuit diagram -

SOURCE CODE –

// Interfacing of LED, Buzzer & Relay with Arduino uno

r4 wifi int LED_PIN = 1; int Buzzer_PIN = 2; int

RELAY_PIN = 3;

void setup() { // Initialization and Declaration of Body

pinMode(LED_PIN , OUTPUT); // Declaring the Led pin as output pin

pinMode(Buzzer_PIN , OUTPUT); // Declaring the Buzzer pin as output

pin pinMode(RELAY_PIN , OUTPUT); // Declaring the Relay pin as

output pin

} void

loop()

digitalWrite(LED_PIN , HIGH); // Turn ON LED

delay(1000); // Delay to improve performance

digitalWrite(LED_PIN , LOW); // Turn LED OFF

delay(200); // Delay to improve performance


digitalWrite(Buzzer_PIN , HIGH);// Turn ON Buzzer

delay(1000); // Delay to improve performance

digitalWrite(Buzzer_PIN , LOW); // Turn ON Buzzer delay(200);

// Delay to improve performance

digitalWrite(RELAY_PIN , HIGH);// Turn ON Relay (NO will become

NC) delay(1000); // Delay to improve performance

digitalWrite(RELAY_PIN , LOW); // Turn ON Relay (NO will become

NC) delay(200); // Delay to improve performance

SOURCE CODE IN SKETCH -


OUTPUT-

PROCEDURE –

• Follow the circuit diagram and make the connections as shown in circuit diagram
• Open the Arduino IDE software on your computer. Coding in the Arduino language
will control your circuit. Open a new sketch File by clicking on New.
• Write the code as per Source Code.
• Compile the program and check for any errors.

• Upload the code to Arduino through the USB connector according to the COM port.
• Observe the result.

WORKING –

• The digitalWrite() function is used to set Pin HIGH or LOW.


• In the program the Indicator (LED, Buzzer & Relay) is turn ON for a (1) Second
and turn OFF in another (0.2) Second ,
• According to Sequence it will turn ON or OFF the LED, Buzzer & Relay using
function digitalWrite()

ALGORITHM –

• Initialize the pin according to their function.


• Set HIGH the indicator for 1 sec.
• Set Low the indicator after 1sec for 0.2 sec.
FLOWCHART -

ERRORS FACED –

Toggling the Relay within the seconds for many times will leads to damage the same.

RESULT –

The LED, Buzzer, Relay is turn ON for 1 sec sequentially (In linear manner).

• After 1 sec LED, Buzzer, Relay was turned OFF for 0.2 sec respectively.
• It keeps on looping until the Arduino gets power supply.

CONCLUSION –
Marks Obtained Dated signature
of Teacher
Attendace30 Performance Skills Safety Conclusion Total
% 20% 2 precaution 20% 25
0% 10%

You might also like