top of page
Search
Writer's pictureWatchIT Group

Lesson 3 :How to control an actuator (LED,LAMP) with a Relay on Menya IoT kit board.

Updated: Jun 12, 2020

A relay is basically a switch which is operated by an electromagnet. The electromagnet requires a small voltage to get activated which we will be given from the Arduino and once it is activated, it will pull the contact to make the high voltage circuit.

A relay is a good example of controlling the AC (alternate current) devices, using a much smaller DC current.


The relay module we are going to use is the SRD-05VDC-SL-C. It runs on 5V and we can control it with via our Menya IoT Kit board.


When there is no voltage applied to the coil, COM (common) is connected to NC (normally closed contact). When there is some voltage applied to the coil, the electromagnetic field produced, which attracts the Armature (lever connected to spring), and COM and NO (normally open contact) gets connected, which allow a larger current to flow. Relays are available in many ratings, here we used 5V operating voltage relay, which allows 10A-250VAC current to flow.


The Arduino relay module can be used in two states which are

  1. Normally open state (NO)

  2. Normally closed state (NC)

Normally open (NO)

In the normally open state, the initial output of the relay will be low when it will be powered. In this state, the common and the normally open pins are used.

Normally closed state (NC)

In the normally closed state, the initial output of the relay will be high when it will be powered. In this state, the common and the normally close pins are used.

Controlling DC Devices using Arduino Relay Module

In the first part, we will control a led using the relay and in the second part we will control a high voltage device using the relay. Controlling a DC device is easy as compared to the AC device. For controlling the DC device, you do not require an external supply until you are controlling a small voltage device like LED which runs on up to 5V.


Circuit Diagram on Menya IoT kit

In this example, we will connect the relay module with Arduino Nano on the Menya kit in the normally open state NO. So, connect the 5V and the ground of the Arduino Nano with the 5V and the ground of the relay module. Then connect the signal pin of the relay module with the pin 2 of the Arduino Nano.


On the other side of the relay module, we will use the common pin and the normally open pin because we are going to connect the relay in the normally open state. So, connect the pin 10 of Arduino to the common (COM) of relay module and the normally open (NO) of the relay module to the positive pin of the LED. Connect the other pin of LED to the ground of Arduino.


A) Control an LED

Figure 1 : Control an LED using arduino Nano on the Menya IoT Kit board.


sketch


B) Control a Lamp /fan


With Arduino and relay you can control lamps, fan and any other apparatus in your home , this is possible with the use of relay technology (as explained above).


Now we are going to control lamps and fan with Menya IoT Accessory (the white box)


after connecting wires , you can plug the white box in the power plug .


Arduino sketch


int lamp= 2;//  D2 pins 
void setup()
{
pinMode(lamp,OUTPUT);
}
void setup()
{
digitalWrite(lamp,HIGH);
delay(5000);
digitalWrite(lamp,LOW);
delay(5000);
}


We have seen a relay can be useful in controlling actuators with high voltage (12v or 220v 50HZ ac). This then open doors to control all appliances in our home from Lamps, Fridges,TV set,Air conditioner and anything that run on electricity. However you need to consider the power capacity of the Actuator to not exceed the capacity of the relay , in this case the relay is 10A 250V AC which can accommodate about almost 2500 Watts. which is enough for some known appliances in our home. the white box (Menya kit Accessory) power capacity is 1w lamp and 1.75w of the fan that means its be accommodate by the relay.


Thank you!😉


and let us know if its worked !



If you have any questions, feel free to ask us in the comment section .










436 views4 comments

4 comentários


nsanzivyiza guy-darly
nsanzivyiza guy-darly
18 de jun. de 2021

there is an erro on the Arduino sketch section B


Control a LAMP/FAN


int lamp= 2;//D2 pins

int pin_relay=3;

void setup()

{

pinMode(lamp,OUTPUT);

pinMode(pin_relay,OUTPUT);

digitalWrite(lamp,HIGH);

}

void loop (){

digitalWrite(pin_relay,HIGH);

delay(5000);

digitalWrite(pin_relay,LOW);

delay(5000);

}


Curtir

nsanzivyiza guy-darly
nsanzivyiza guy-darly
07 de set. de 2020

yep,it's works!!!

Curtir

Arsene
Arsene
11 de jun. de 2020

@kajothada we have found that you don't have female wires . this tutorial will be updated so that you can you use /experiment the white box because it has female wires and can easily be connected with relay pins.

Curtir

kajothada
kajothada
10 de jun. de 2020

on figure one there is a wire going from LED1 to No

and onother one from D10 to com but i need assistant on how to plug them to a power source

Curtir
Post: Blog2_Post
bottom of page