Introduction

A relay is a device that is activated by a current in one circuit to open or close another circuit. 

In this guide, we will learn to use a relay to turn an LED on and off. In this guide, a Little Bird Uno R3 board, the 5V 1-Channel relay board module is used. Please see parts list for a complete list of components required.

After learning to use the 5V 1-Channel relay component, you can use it to turn off lamps, fans, and other appliances up to 250 VAC.
    • Connect an Arduino Ground Pin to the Ground Pin of your relay.

    • Connect the Arduino 5V pin to the Relay's middle pin.

    • Connect Pin 13 to the Relay's Signal pin.

    • Insert the LED into the bread board so that the Cathode (shorter pin) is on the left hand side.

    • Insert a 220 Ohm Relay so that one pin is in line with the LED's Anode (longer leg)

    • The 220 Ohm Relay has the bands: Red, Red, Black, Black, Brown.

    • Connect the Cathode to a Ground pin on the Arduino.

    • The Cathode is the negative (shorter) leg of the LED.

    • Connect the 3.3V Arduino Pin to the Relay.

    • The 3.3V jumper should go to the NC side of the screw socket.

    • Connect COM on the relay to the other side of the resistor.

  1. int relay = 13; // Plug the relay into Digital Pin 13
    
    void setup() {
      pinMode(relay, OUTPUT);
    }
    
    void loop() {
      digitalWrite(relay, HIGH); // Turn the relay on
      delay(1000); // Wait 1 second
      digitalWrite(relay, LOW); // Turn the relay Off
      delay(1000); // Wait 1 second
    }
    • Grab the code and upload it to your board.

    • You should start to hear the click, click of the relay switching on and off. There is also a red light on the module to tell you when it switches.

    • The Relay can be use to control up to 250VAC but we DO NOT recommend you play with this sort of voltage / current unless you are an electrician!

    • This is what a working relay looks (and sounds) like!