Introduction: Relay 5V Using Arduino

About: someone who likes electronics

Relay is an electromagnetic switch.

The relay consists of two parts. Coil part and switch part.

The coil part consists of a wire wrapped around an iron. If the wire is turned into electricity, a magnetic field will arise on the iron. This magnetic field is used to pull or release the plate that is on the switch. So the switch can open or close.

Step 1: Relay

Relay Modul specifications :

  • 5V DC
  • Active low
  • Two Output (NO and NC)
  • Power Indication
  • Relay Indication

Step 2: Required Component

Required component :

Step 3: Connect the Relay Module to Arduino

To connect Relay to Arduino. You can see the picture above or the description below.

Relay Module to Arduino

VCC ==> +5V

GND ==> GND

IN ==> D12

Step 4: Upload Sketch

This is a sketch I made to try the relay module. You can copy and paste it in your sketch.

<p>//define pin relay <br>const int RelayPin = 12;</p><p>void setup() {
  pinMode(RelayPin, OUTPUT); //Sets the RelayPin as an Output</p><p>}</p><p>void loop() {
  digitalWrite(RelayPin, LOW); //Relay On
  delay(2500);
  digitalWrite(RelayPin, HIGH); //Relay off
  delay(1000);</p><p>}</p>

I also provide the sketch file. You can download it below.

Step 5: Result

This relay module is active low. The relay will on if INPUT gets a low trigger.

When the relay is on, the NO switch will become NC and the NC switch will be NO.

Based on the sketch that I made. The relay will "ON" for 2.5 seconds and then "OFF" for 1 second. And will continue to repeat until the supply is cut off.

Thank you for reading, see you in the next article