fbpx

Interface Relay With ARM7

Description

Relay is an electrically operated switch.

  • Relay is used to isolate electrical load.
  • Two configuration
    • NO(normally open)]
    • NC(normally close).
  • Relay have 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.
  • Base is connected with micro-controller in series with resister.
  • Emitter to ground.
  • Collector to relay.

Hardware Required

  • Relay.
  • BC548 Transistor.
  • LPC21XX MicroController.

Circuit

Code

 #include <LPC21xx.H>
 void delay()
 {
 int i,j;
 for(i=0;i<10000;i++)
 {
 for(j=0;j<100;j++);
 }
 }
 int main()
 {
 IO0DIR=0XFFFFFFFF;
 IO1DIR=0XFFFEFFFF;
 while(1)
 {
 if(IO1PIN&(1<<16))
 {
 IO0PIN=0XFFFFFFFF;
 delay();
 }
 else
 {
 IO0PIN=0XFFFFFFFE;
 delay();
 }
 }
 } 

Leave a Reply

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