INTERFACING RELAY WITH BHARAT -PI

by madhankarthick in Circuits > Sensors

24 Views, 0 Favorites, 0 Comments

INTERFACING RELAY WITH BHARAT -PI

Light-Switches-8db5a1b723ab4c43a576af1627e8e826.jpg
OIP (8).jpeg

In this instructable , we are going to interface a 5V Relay module with Bharat pi to control high power devices. As you might already know, Bharat pi work on 5V and the maximum current a digital pin can drive is less than 40mA. So technically we cannot drive higher power devices like home appliances DIRECTLY with Bharat pi. That is the need of electromechanical RELAY. In this tutorial we are using a 5V 1 channel relay module as it is a very much popular and most used relay module among enthusiasts. Depends on our use case we can go with 2 channel relay, 4 channel relay, 8 channel relay, etc.

How Relay Work?

hj.jpg

A relay is generally an electrically operated switch. The principle used by the relays is an electromagnet to mechanically operate the switch. So basically it operates a switch using an electromagnet which needs only less power like 5V, 12V or 24V. Different kinds of relays are available in the market like SPDT, DPDT, SPST, 5V, 12V, 24V and with various high current/voltage driving capacity. In this tutorial we are using a 5V relay module.

Relay Pinout

Screenshot 2023-09-15 211848.png

Let’s dive deep into the 5V relay module which we are using. This module has total 6 pins out of which 3 are used for controlling the relay (low voltage side). While other 3 are the output of the relay (usually high voltage side), where we will connect the device which we want to control.

  1. NO : Normally Open – This is the normally open terminal of the relay, means if we don’t energise the relay there won’t be any contact with Common terminal. But it will establish electrical contact with Common terminal once the relay is energized.
  2. C : Common terminal
  3. NC : Normally Closed – This is the normally closed terminal of the relay, means it will have electrical contact with common terminal whenever the relay is not energised. And there won’t be electrical contact when the relay is energised.
  4. GND : Ground Pin
  5. Signal : Actuation signal to control the relay.
  6. 5V VCC : Operating voltage for the relay.


Requirements

OIP (8).jpeg
Artboard-1-e1686767346235.jpg
wires.jpg
  1. ·      Bharat-pi (board)
  2. ·      Jumper wires
  3. ·      Aurdinno-ide
  4. ·      Relay

Interfacing RELAY WITH BHARAT -PI

final.png
sva.png
k.jpg

Connections:

  1. vcc : 5v
  2. gnd pin : gnd
  3. relay pin : 7
  4. led pin : 12;

Source Code and Programming

1649279368-Ent-2022Python.jpeg

int relay_pin = 7;

int led_pin = 12;

void setup()

{ pinMode(relay_pin,OUTPUT);

pinMode(led_pin,OUTPUT);

digitalWrite(led_pin,HIGH);

 }

void loop()

{ digitalWrite(relay_pin,HIGH);

delay(2000);

digitalWrite(relay_pin,LOW);

delay(2000);

}

code avilable at git hub : https://github.com/Madhankarthick/RELAY-CODE-FOR-BHARAT-PI/blob/30a443f70ecaf6c0855522f2f7665b176a113ed4/RELAY%20CODE.txt

 


Downloads

Applications

OIP (9).jpeg
substation1400.jpg


  • Isolating low voltage circuits from high voltage circuits
  • Controlling multiple circuits or heavy electrical loads
  • Providing protection from overload, short circuits, overvoltages, and under voltages
  • Performing arithmetic and mathematical operations in computer circuits
  • Automatic change over and circuit selection
  • Motor control and drives
  • Safety circuits and systems
  • Temperature control systems
  • Home appliances and televisions
  • Automotive applications such as electrical fuel pump


Video

Interfacing Relay With Bharat Pi