List of DIY Electronics Engineering Projects

Password Based Circuit Breaker using PIC Microcontroller with C code

Here i am going to explain you a simple Password based circuit Breaker Project using PIC Microcontroller. This project is much similar to my previous one, “Password Based Door Locking System”. Circuit breakers are electromechanical devices used in the power system to connect or disconnect the power flow at the generator, substation, or load location. Only authorised persons with correct password can connect or disconnect the circuit breaker. Each Line will have separate passwords to operate, By entering the password the current state of the line is toggled. That is, the load will gets connected or disconnected. For verification, after entering the password you need to press the ‘=’ button on keypad (Which is just like an ‘ENTER’ key).



Block Diagram of the Password based Circuit Breaker

circuit Breaker


PIC16F877 is the heart of this project, which takes input from keypad as password and displays the current status on a 16x2 LCD Display. For the demonstration purpose, I am using only two loads, which is controlled by two relays.

 “1234” and “9876” are the two passwords used here for activating and deactivating the Load 1 and Load 2 respectively. As I mentioned in the above paragraph, don’t forget to enter ‘=’ after feeding the password. Press ‘ON/C’ Button to clear the screen.

Circuit Diagram of Password Circuit Breaker

schematic circuit Breaker


Embedded C Code


#include <16f877.h>
#include <lcd_4bit.c>
#include <keypad.c>
#include <string.h>
#use delay(clock=4000000)
char u1[]="1234",U2[]="9876",p[10],k,v1[10];
int i=0,d1,d2,z1=1,z2=1;
void main()
{
char m[30];
lcd_init();
 lcd_str("Password Based");
    gotoxy(0,1);
    lcd_str("Circuit Breaker");
    delay_ms(1500);
   
l1:    
    

    lcd_clear();
    
    lcd_str("Enter Password:");
    gotoxy(0,1);
   while(TRUE)
   {
    k=key();
    if(k=='c')
    {
    lcd_clear();
    gotoxy(0,0);
    lcd_str("Enter Password:");
    gotoxy(0,1);
    i=0;
    }
    else if(k=='=')
    {
    p[i]='\0';
    goto l;
    }
    else
    {
    lcd_str(k);
    p[i]=k;
    i++;
    }
    
   }
   l:
   gotoxy(0,1);
   d1=strcmp(u1,p);
   d2=strcmp(u2,p);
    
   if(d1==0)
   {

   gotoxy(0,0);
   lcd_str("Correct Password");
   gotoxy(0,1);
   
   if(z1==1)
   {
   output_bit(PIN_C0,1);
   lcd_str("Load 1 Active");
   delay_ms(300);
   z1==0;
   goto l1;
   }
   else if(z1==0)
   {
   output_bit(PIN_C0,0);
   lcd_str("Load 1 Inactive");
   delay_ms(300);
   z1==1;
   goto l1;
   }
   }
  

   
  else if(d2==0)
   {

   gotoxy(0,0);
  lcd_str("Correct Password");
   gotoxy(0,1);

  
  if(z2==1)
   {
   output_bit(PIN_C1,1);
   lcd_str("Load 2 Active");
   delay_ms(300);
   z2==0;
   goto l1;
   }
   else if(z2==0)
   {
   output_bit(PIN_C1,0);
   lcd_str("Load 2 Inactive");
   delay_ms(300);
   z2==1;
   goto l1;
   }
   }
 else
 {
 lcd_clear();
 lcd_str("Wrong Pass");
 delay_ms(300);
 goto l1;
 }

}

The C Code is compiled in PIC C CCS Compiler. Download The simulation, C-code and Project Files.


Tittu Thomas

Author & Editor

I'm Tittu Thomas, An Electronics and Communication Engineer from India, Kerala. I love doing hobby electronics circuits, blogging, programming, etc. Started this blog while doing my B-Tech degree under CUSAT university.



0 comments so far:

Post a Comment

Social Time

Facebook
Like Us
Google Plus
Follow Us
Twitter
Follow Us
Pinterest
Follow Us

Subscribe to our newsletter

(Get fresh updates in your inbox. Unsubscribe at anytime)