How to Use Relays

About: Relays are on and off switches for electronics.

Why are they significant? Higher powered circuits can ruin lower powered components. For example, powering a large motor with an Arduino board will not end well for the Arduino. The relay allows higher powered components to interact with lower powered components without the risk of damage.

Prerequisites: Before following these instructions, you should know about open and closed circuits. You should also be able to understand a basic electrical schematic.

Introduction to the pins:

Input pins:

  • VCC – this pin should be connected to +5v at all times
  • GND – this pin should be connected to ground at all times
  • IN – this pin switches on and off in the relay.

– If it receives 0v, the relay is in its normal state.

– If it receives +5v, it is not in its normal state.

– IN is sometimes called “Digital Pin” or just “D.”

Output pins:

  • COM – this pin will always be used in a circuit; it is the pin that is measured from.

–     NC       – (Normally Closed) this pin closes circuit with COM when relay is in it’s normal state.

  • NO – (Normally Open) this pin forms an open circuit with COM when the relay.


Examples of use:

Let’s say you have a gigantic light bulb (or any electronic component that uses a lot of power) and you need to be able to switch it on and off with an Arduino. The big light bulb needs a big battery to power it, but that amount of power would burn the Arduino to a crisp. The solution is to use a relay.

As you can see, the +5v pin on the Arduino is attached to the VCC pin on the relay and the GND pin on the Arduino is connected to the GND pin on the relay. The IN pin on the relay is connected to the digital pin on the Arduino that will control the circuit.

Because Circuit 2 is connected to the NC pin, the circuit will be closed and the lightbulb will be on when the digital pin on the Arduino is off (the “normal” state). The lightbulb will be off when the digital pin on the Arduino is on. If it was connected to the NO pin, the opposite would happen.

Testing a relay:

To test your relay, use the blink sketch. Attach VCC to +5v, GND to ground, and IN to whichever pin is blinking (13, usually). If you hear the relay clicking on and off every second, you are good to go!


  • If your relay stops working with your program, always go back to the blink sketch. If that sketch works then there must be something wrong with your program.
  • Instead of plugging VCC, GND, and IN pin using male wires, you can put all three of those pins into the three male wires on the arduino board usually located right next to the digital pins. Just make sure everything is lined up correctly.

External help:

Here’s just a list of resources which may help you with relays.

Ordering relays:

Here is the type of relay we used:

If you don’t get that exact type, try to find something similar—nothing too fancy is necessary.

Also you can either get a single relay per unit or dual relay module (same thing except 2 relays are there per unit)

Happy relaying!

By, Jeremy Costin, Nathaniel Rosenbloom and Amber Zedeck

-Class of 2017

Leave a Reply

Your email address will not be published. Required fields are marked *