In this article, Poly Notes Hub will discuss about the interfacing technique of One Channel Relay Module with Arduino. Also we will learn that about the circuit diagram, operation, and about the code as well.
Author Name: Arun Paul.
What is Relay or Relay Module ?
Relays are electrical switches that have the functionality of remote controls. Its purpose is to regulate a circuit by opening or shutting contacts in reaction to variations in signals, voltage, current, temperature, or other factors.
Think of it as a bridge connecting two different circuits. A switch is pulled by a tiny electrical current passing through the relay’s coil, which opens or closes contacts in a different area of the circuit. This has the benefit of enabling low-power signals to regulate higher-power circuits, which is useful in a variety of electrical applications. They are used for things like managing heating systems, turning on alarms, controlling motors, and controlling lights.
Terminals of Relay
- A and B Coil Terminals ( Used as Power Terminals )
- COM ( Common Terminal )
- NO ( Normally Open )
- NC ( Normally Closed)
Interfacing One Channel Relay Module With Arduino
In this circuit, we will learn how to operate an LED by a relay. Here, we are using a one-channel relay. So, we can only operate one LED at a single time. If you want to operate more than one LED, you must use more relays per your LED’s counts. For example, if you want to operate three led then you have to use three relays with similar circuit connection.
Required Components
- Relay ( 12V ) – One
- Diode ( 4007 ) – One
- LED ( Any Color ) – One
- Resistor ( 100 OHM ) – One
- Transistor ( BC547 ) – One
- Power Supply – +5V ( For LED ) and +12V ( For Relay )
- Arduino UNO
Circuit Diagram
Below shows the circuit diagram of one channel relay module with Arduino –
In this circuit diagram, Poly Notes Hub discusses how to connect single channel relay module with Arduino ?
- Arduino’s D8 PIN connected to the transistor base terminal.
- Transistor emitter terminal connected to the negative terminal of the power supply.
- A diode connected between the coil terminal of relay. Diode must be connected in reverse biased.
- A 12V supply is provided to the relay.
- LED’s anode terminal connected to the 5V through a 100 ohm resistor.
- LED’s cathode terminal connected to the NO terminal of the relay.
- Relay’s COM terminal connected to the ground or negative terminal of the power supply.
How it works ?
- When the digital terminal D8 of Arduino UNO becomes HIGH depending on the uploaded code, the base of the transistor gets the supply and switched. The relay’s coil one terminal gets connected to the ground.
- After getting connected to the ground terminal, the relay’s coil is magnetized because another terminal of the coil is already connected to the 12V Power Supply. Note, that if the relay is 5V then the relay supply should be 5V.
- After the magnetization of the coil, the COM terminal connected with the NO. And then the LED starts blinking.
- When the Arduino’s D8 becomes LOW the coil of the relay stops magnetization and then the COM terminal is connected with the NC of the relay and the LED stops blinking.
- This process continues until the supply is off.
- For visual experience please watch the video which we attached below.
Code for Arduino
Upload this code to Arduino and see how the circuit will work.
void setup() {
pinMode(8, OUTPUT); // D8 PIN of Arduino Assigned as a Output Terminal
}
void loop() {
digitalWrite(8, HIGH); // Produce output for 2 Sec
delay(2000);
digitalWrite(8, LOW); // Off for 2 Sec
delay(2000);
}