INTERFACING RELAY WITH BHARAT -PI
by madhankarthick in Circuits > Sensors
24 Views, 0 Favorites, 0 Comments
INTERFACING RELAY WITH BHARAT -PI
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?
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
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.
- 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.
- C : Common terminal
- 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.
- GND : Ground Pin
- Signal : Actuation signal to control the relay.
- 5V VCC : Operating voltage for the relay.
Requirements
- · Bharat-pi (board)
- · Jumper wires
- · Aurdinno-ide
- · Relay
Interfacing RELAY WITH BHARAT -PI
Connections:
- vcc : 5v
- gnd pin : gnd
- relay pin : 7
- led pin : 12;
Source Code and Programming
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
- 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