Introduction
In this tutorial, you will learn about the functioning of the relay and how to interface it with evive.
A relay is a switch that is operated through an electrical signal. There are different types of relays available some of them include electromagnetic relays, reed relays, contactor, solid state relays etc. They are mainly used in controlling high power circuit with a low power signal. For example, with the help of a relay, you can control an AC bulb with evive. You can control high power AC as well as DC circuits with the relay. Relays have a wide range of application in industries as well as in a large number of robotics related projects.
Working of electromagnetic relays
A relay consists of an electromagnetic coil and a Single pole double throw switch (SPDT). An SPDT switch has one input and two outputs. As seen in the image there is a part in the symbol with marking NO, NC, and COM on it, that is an SPDT switch.
In this COM is the input of the switch, NC means normally closed and NO means normally open. Both NC and NO are outputs of SPDT switch. The contact that connects the output to input in SPDT is called pole. The spring-like structure symbolizes an electromagnetic coil.
When the coil is not energized NC and COM remains connected in SPDT. As soon as the coil is energized NO and COM gets connected. Actually, when the coil is energized magnetic field is generated around it, the pole gets attracted towards this field and it shifts itself from NC to NO. Hence NO and COM get connected. As soon as coil gets de-energized coil losses its magnetic field and pole moves back to original position and NC and COM gets connected again.

The coil is energized by supplying an electrical signal to it. Depending upon types of signaling you can have relays like 5 V dc relay, 12 V dc relay etc. You can use both 5V and 12V type relay with evive. 5V relay can be controlled by any digital pin and 12V relay can be control by motor terminals of evive. Through digital pin coil of the relay is given 5V that energizes it.
In this example, you will be controlling a 230V AC bulb with evive with help of a 5V relay. The relay will be controlled by slide switch 1 on evive.
Specifications of relay
- 5V TTL control signal
- Maximum AC current and voltage: 10A 250VAC
- Maximum DC current and voltage: 10A 30VDC
- 5V relay used in this example has 3 pins that are to be connected with evive. These pins are GND, VCC and Signal.
- The module also has an on board LED that glows whenever NO and COM gets connected.
Circuit diagram
Image below shows the circuit diagram of the relay with evive for controlling an electrical bulb. Here VCC and GND of the relay are connected to 5V and GND of evive respectively and Signal pin is connected to digital pin 2 on evive.
You can use the AC supply plug available n your home for power the bulb. Out of the two wires plugged in an plug connect one to COM of the relay and one directly to bulb holder.

PictoBlox Program
Follow the steps:
- Open PictoBlox.
- Select the board as evive:
- Connect the evive.
- Create the following script using when evive starts up block:
- Upload the code onto evive:
You can download the PictoBlox program from here: Interfacing Relay with evive