Arduino AC voltage Control using 5v relay | Homemade 5v Single Chanel relay module
Overview
You can watch the following video below:-
Components Required
The required components list for this project given below:-- Arduino Uno
- 5V Relay Module
- 2 Pin Screw Connector
- Bc547 Transistor
- 1N4007 Diode
- PC817 Optocoupler
- 220-ohm Resistor
- AC Bulb
- Bulb Holder
- LED
- Veroboard
- Some Jumper Wire
Relay Pinout
The pinout of the 5v relay has been given below:-Circuit Schematic
The circuit diagram of the relay interfacing with Arduino has been given below:-Circuit Description
Fig: Arduino High Voltage control circuit |
Source Code
The source code is given below:-
int relayPin =13;
void setup() {
// initialize digital pin relayPin as an output.
pinMode(relayPin, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(relayPin, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(relayPin, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
No comments