Relay – what is it and how to use it?

Relay - what is it and how to use it?

Relay is an electrical switch using electrical signal to turn on/off the current. It is also used to control a circuit by a low-power signal.

Relay - front view

On its body, you can see these characters and numbers:

  • 10A 250VAC.
  • 10A 125VAC.
  • 10A 30VDC.
  • 10A 28VDC.
  • SRD-05VDC-SL-C.

This is what they mean:

  • 10A 250VAC: The max current intensity of connection, where voltage is equal or less than 250V (AC), is 10A.
  • SRD-05VDC-SL-C: Voltage of signal to control circuit is 5V.

State of relay

It is a switch so it has two main states: close and open.

  • Open state: While opening, it interrupts circuit and current doesn’t work in circuit.
  • Closed state: While closing, it keeps current in circuit.

State of relay

Relay’s connections

There are six connections. Three of these control the state of relay, the others connect to circuit (to make circuit close or open).

Relay Connections

Three connections control the state of relay:

  • DC+: Electrode positive. In this article, we will connect wire with 5V to this connection.
  • DC-: Electrode positive. Connect to GND.
  • IN: Signal connection that is used to control relay.

Three connections connect to circuit:

  • COM (Common Connection): Connect to power supply. If it’s DC, we frequently connect it to positive of power supply. If it’s AC, we frequently connect it to hot wire.
  • NC (Normally Close): Connect to COM connection when there is no trigger in relay. If we connect this connection to wire and don’t trigger relay with IN connection, COM and NC will be connected. When we trigger relay with IN connection, COM and NC will be corrupted.
  • NO (Normally Open): Only connect to COM connection when having trigger in relay. If we connect this connection to wire and don’t trigger relay with IN connection, COM and NO will be corrupted. When we trigger relay with IN connection, COM and NC will be connected.

Usually, you will use either NC or NO with COM to control circuit. To understand how NC, NO and COM work, you can see the following pictures:

Relay - normal and triggered state

Trigger relay

To trigger it (COM connect to NO and disconnect to NC), we use IN connection. There are two kinds of relay using IN connection in different ways. They are “Low Voltage Trigger” and “High Voltage Trigger”.

Low voltage trigger

When we connect IN to GND, the relay is triggered (COM connects to NO and disconnects to NC). It is not triggered when we connect IN to +5V (COM connects to NC and disconnect to NO).

Relay - Low voltage trigger

High voltage trigger

The relay is not triggered when we connect IN to GND (COM connect to NC and disconnect to NO). When we connect IN to +5V, it is triggered (COM connect to NO and disconnect to NC).

Relay - high voltage trigger

So, how to know what kind of relay are you using?

  • Ask your seller.
  • Research about transistor of relays that will be described detail in product’s website or package. If the transistor is NPN, it is low voltage trigger. If the transistor is PNP, it is high voltage trigger.
  • Try it out.

Demo with Arduino

The demo below uses AC. If you don’t have any experience and knowledge about electricity, please stop. In case you really want to do it, just be careful.

We have a light that uses AC 220V or 110V. We will use a microcontroller Arduino Uno to control the light. It will turn on or off each for five seconds. Arduino Uno allows you to set an output PIN with 5V. We will use it in order to control IN connection of relay which controls the light.

Preparation:

Tools used for relay demoA light

  • Arduino Uno Board.
  • Relay (in this demo, we use low trigger one).
  • Breadboard (optional).
  • Pincer, electrical tape.
  • Wire to connect Arduino to Relay.
  • Wire to connect light to AC and connect AC to Relay.
  • A light.

Connect

Arduino connects to Relay as the following table:

Arduino Pins Relay Connections
5V DC+
GND DC-
Digital Pin 7 IN

Adruino Connection

Wires connect to Relay

Relay connects to circuit as the following table:

Relay Connections Circuit
COM Hot line of power supply (red line)
NC Connect to light

Another line of wires, connect to neutral of power supply (yellow)

Connect andruino to circuit

connect light to relay

Code

Because of low trigger relay, we will write state LOW to digital pin 7 of Arduino Uno to turn on the light and write HIGH to normal (turn off the light)

Results

Source code and document can be found on Github.

SSS Full-stack Engineer

Love Silicon Straits and want to know more about our company culture, working environment or job vacancies?
Find out more at careers.siliconstraits.vn.

Silicon Straits
Be Challenged. Be Inspired. Be Different.




Posted by

on September 3, 2015

in , , , ,

Comments

Follow us for more later

or subscribe with