Bukit Mertajam, Penang

Project 14 – Interface with Relay

PROJECT 14

INTERFACE WITH RELAY

Back to Project 13                                                                                                    Go to Project 15

Relay have become a common use electronic component which operate as an switching device by simply apply voltage to ON and OFF it. For this project, we will discover a simple relay connected with an LED to show what is the basic function and connection.

———————————————————————————————————————————————————-

COMPONENT NEEDED

———————————————————————————————————————————————————-

RELAY
  LED x2
  1K RESISTOR x2
 
NPN TRANSISTOR
 
1N5817
SCHOTTKY DIODE
  BREADBOARD
  JUMPER WIRES

———————————————————————————————————————————————————-

CONNECTION

———————————————————————————————————————————————————-
Normally relay will have 4 pin which is normally open(NO), normally close(NC), common and 2 control pin to ON/OFF the magnetic coil. By referring to the figure below, RED wires are VDD which connected to LEDs anode. BLACK wires are GND are connected to common and NPN Emitter pin.. ORANGE and WHITE wire connected to both cathode of LED through 1K resistor. The YELLOW wire are connected to RA0 and NPN Base pin. For protection of the microcontroller, we added a schottky diode as an protection diode.


———————————————————————————————————————————————————-

ADDITIONAL INFORMATION

———————————————————————————————————————————————————-
Relay have almost the same function as a switch but the difference are that relay can be toggle by simple giving an electricity. Please refer this webpage for detail.

CODE OVERVIEW

———————————————————————————————————————————————————-

#define Relay1 RA0
In system.h, we have defined the Relay1 I/O PORT as
RA0.

If (SW1 == 0) Relay1 = 1;
Check if switch 1 is trigger ON. If switch 1 is HIGH(1), then go out of this loop. If switch 1 is LOW(0), trigger ON Relay 1.

else Relays = 0;
If switch 1 is HIGH(1), Relay1 =0.

Back to Project 13                                                                                                    Go to Project 15

———————————————————————————————————————————————————-

ATTACHMENT

1. P14 User Manual.pdf
2. Project_14_code.zip

Buy

[vc_cta h2=”” style=”outline” color=”white” add_button=”left” btn_title=”Transistor 2N2222″ btn_color=”orange” btn_i_icon_fontawesome=”fa fa-opencart” btn_css_animation=”appear” css_animation=”appear” btn_link=”url:http%3A%2F%2Fwww.cytron.com.my%2Fp-tr-2n-2222||” btn_add_icon=”true”][/vc_cta][vc_cta h2=”” style=”outline” color=”white” add_button=”left” btn_title=”LED” btn_color=”orange” btn_i_icon_fontawesome=”fa fa-opencart” btn_css_animation=”appear” css_animation=”appear” btn_link=”url:http%3A%2F%2Fwww.cytron.com.my%2Fc-114-electronic-components%2Fc-120-led-lcd%2Fc-211-led||” btn_add_icon=”true”][/vc_cta][vc_cta h2=”” style=”outline” color=”white” add_button=”left” btn_title=”Diodes 1N5822″ btn_color=”orange” btn_i_icon_fontawesome=”fa fa-opencart” btn_css_animation=”appear” css_animation=”appear” btn_link=”url:http%3A%2F%2Fwww.cytron.com.my%2Fp-di-1n5822||” btn_add_icon=”true”][/vc_cta]
[vc_cta h2=”” style=”outline” color=”white” add_button=”left” btn_title=”Resistor 0.25W 5% (1K)” btn_color=”orange” btn_i_icon_fontawesome=”fa fa-opencart” btn_css_animation=”appear” css_animation=”appear” btn_link=”url:http%3A%2F%2Fwww.cytron.com.my%2Fp-rs-025w-1k||” btn_add_icon=”true”][/vc_cta][vc_cta h2=”” style=”outline” color=”white” add_button=”left” btn_title=”Male to Male Jumper Wire” btn_color=”orange” btn_i_icon_fontawesome=”fa fa-opencart” btn_css_animation=”appear” css_animation=”appear” btn_link=”url:http%3A%2F%2Fwww.cytron.com.my%2Fp-wr-jw-mm65||” btn_add_icon=”true”][/vc_cta][vc_cta h2=”” style=”outline” color=”white” add_button=”left” btn_title=”Songle SPDT Relay SRD 05V” btn_color=”orange” btn_i_icon_fontawesome=”fa fa-opencart” btn_css_animation=”appear” css_animation=”appear” btn_link=”url:http%3A%2F%2Fwww.cytron.com.my%2Fp-re-so-srd-05||” btn_add_icon=”true”][/vc_cta]
[vc_cta h2=”” style=”outline” color=”white” add_button=”left” btn_title=”Breadboard GL-12 (C&D)” btn_color=”orange” btn_i_icon_fontawesome=”fa fa-opencart” btn_css_animation=”appear” css_animation=”appear” btn_link=”url:http%3A%2F%2Fwww.cytron.com.my%2Fp-bd-bb-0617||” btn_add_icon=”true”][/vc_cta][vc_cta h2=”” style=”outline” color=”white” add_button=”left” btn_title=”40 pins PIC Start-Up Kit” btn_color=”orange” btn_i_icon_fontawesome=”fa fa-opencart” btn_css_animation=”appear” css_animation=”appear” btn_link=”url:http%3A%2F%2Fwww.cytron.com.my%2Fp-sk40c||” btn_add_icon=”true”][/vc_cta]

Related Posts

Leave a comment

Get 7 Tips for Developing Electronic Projects
We respect your privacy.
Loading...