fbpx

Interface Relay With PIC

Description

Relay is an electrically operated switch. Relay is used to isolate electrical load.

  • Two configuration
    1. NO(normally open)
    2.NC(normally closed)
  • Relay has a coil which is energized by 12v, when coil energized switching action takes place.

BC548

  • BC548 is general purpose NPN bipolar junction transistor .
  • This transistor act as a driver to pull the relay ON.
  • The base is connected with the microcontroller in series with resistor.
  • Emitter to ground.
  • Collector to relay.

Hardware Required

  • Relay.
  • BC548 Transistor.
  • Pic16f877a MicroController.

Circuit

Virtual Circuit

Code

 void main()
 {
 TRISB.F1=1;
 TRISB.F0=0;
 do
 {
 if(PORTB.F1==0)
 {
 PORTB.F0=1;
 }
 else
 {
 PORTB.F0=0;
 }
 }
 while(1);
 } 

Leave a Reply

Your email address will not be published. Required fields are marked *