Password based circuit breaker project: Microcontrollers are an extremely versatile tool with thousands of applications, many of which have helped meet our daily needs and save time, money and most importantly, labor or work power. However, when we designed this project our aim was different than to exploit these advantages.
We aimed to use the microcontroller to not only solve one of the major problems in these troubled times but to save the most important thing of them all: human life. How exactly did we achieve that? Lets see what is password based circuit breaker.
Password based security system
One of the more prudent problems faced by workers, especially the linemen, today is to operate, maintain and fix the electricity lines that supply power to the our homes. This is a tiring, arduous and a dangerous task. The electrical lines that transmit power to our homes have a very high voltage flowing through them. Even a small mistake can cause severe causalities, in most cases high degree burns or deaths. To counteract this problem this project was designed. To understand this, first we must look at what a circuit breaker is. It is an automatically operated electrical switch that is used to prevent circuit damages from abrupt voltage changes. It is preferred to the conventional fuse as it can be used time and time again unlike the electrical fuse which has to be constantly replaced. password based circuit breaker is based on the circuit breakers and how to use them in the safest possible manner. These circuit breakers are nowadays operated manually by the linemen which can cause a lot of damage due to a single misstep. Thus we have decided to make a automatic circuit breaker system that not only prevents any injuries but also ensures security of the system so that no other person can operate it other than the lineman. How we have done this?
We have used a password based circuit breaker approach which ensures that the correct person is operating the system. In a general overview, the PIC 16F877 microcontroller headlines the project. A keypad is used to enter the correct password and then to switch the loads on and off. It even provides the option of changing the password so security is maintained. So if the lineman wants, he can easily close a particular load from the headquarters by using this and then work on all the repairs without having any fear of being electrocuted. After the maintenance is done, he can turn it on again by using the correct password. More details on the working and operation is stated later. First lets look at the various components used in this password based circuit breaker and their details.
PASSWORD BASED SECURITY SYSTEM COMPONENTS
Component Description of password based circuit breaker is given below:
Microcontroller: The brain and the powerhouse of the project. Micrcontroller can be described as a small computer which has an ALU, core, programmable peripherals and ROM. They are fundamental components of any embedded system designed today. We used the PIC microcontroller of the 18 family for our project due to its extensive applications and reasonable price. PIC microcontroller is extremely versatile and quite easy to use for even a novice. Furthermore, it has many useful functionalities and a lot of components can be easily configured with it such as the keypad.
Voltage Regulator: The 7805 IC was used as the voltage regulator. It is used to maintain fix voltage of 5V to the circuit and so the circuit is not affected by the fluctuations. If there are discrepancies in voltage values, the components may not work properly especially the voltage sensitive components such as the LCD and the magnetic relays. Furthermore, capacitors are added at the load ends to ensure less ripples.
Relay Driver: In order to avoid using transistors so that the connections can be reduced and a more refined circuit diagram can be made, ULN2003A IC was used. It is a relay driver IC, an electromagnetic switch which is used to turn the relays ON or OFF. It basically supplies a larger current to the loads so that they can work. A very handy alternative to NPN BJT.
Resistors: An essential component of any electrical circuit. It is a two terminal device which opposes the flow of current in a circuit by producing a voltage drop between its terminals (v=ir) . It is essentially used to prevent the circuit from being short circuited. A part of every practical circuit, this component is a necessity in this project.
Capacitors: Another two terminal device. Instead of opposing the flow of the current in the circuit this device actually stores the electrical current in it in form of electrical fields. Being another essential component, it stores energy between its parallel plates when potential difference is applied and so it has various applications many reducing fluctuations, preventing components to burn etc.
LCD: The main output peripheral of our project. A 14pin device which is connected to the microcontroller directly. It has its own internal configuration which is programmed with the microcontorleer initially. The output of the keypad as well as the load settings are all displayed here. It can be called the face of the project.
Keypad: Another major peripheral used in the project. However unlike the LCD, this is an input peripheral. A 4×4 Keypad is used to input the numbers or string patterns that are all displayed on the LCD. It is also connected directly to the microcontroller. The keypad settings are configured within the code which is programmed into the microcontroller. It sends a 8 bit binary value for each button pressed which is processed and converted into a character displayed on the LCD screen.
External Oscillator: In this project, in PIC16 microcontroller a quazi crystal was used as an external oscillator which was connected in parallel with 2 capacitors and connected to 2 pins of the microcontroller. The oscillator provides the clock pulses which are essential for every process that the microctroller performs as the clock signal gives the microcontroller the indication to execute the next task. Even the LCD’s are wholely dependent on the external oscillator which works due to molecules within the crystal vibrating and generating a periodic pulse smoothened by the capacitor.
EEPROM: Electronically Erasable Read Only Memory plays a major part in this project. It is a non-volatile memory which is often used to store small data for immediate uses and which must be saved when the power turns off. The EEPROM stores the password in our project which can be both read and overwritten when new password is added.
Magnetic Relay: The essential switches of the project. . It basically works as a high-voltage switch as it uses smaller voltages/current to operate high voltage/current circuits. One pin is connected to output of microcontroller whereas the other is connected to the high voltage supply which is switched accordingly
CIRCUIT DIAGRAM OF PASSWORD BASED CIRCUIT DIAGRAM
As seen in the above mentioned Proteus Diagram, all the connections of the microcontroller as well as the peripherals connected to it can be seen. The center of the whole system is the PIC18 microcontroller. All the other components are connected to it and work in accordance with each other. The Keypad is connected at PORTD with a combination of resistors and the LCD Pins are connected to the PORTB of the microcontroller.
These are the input and output peripherals. The output which goes to the relay driver IC is from PORTA. The relay driver(ULN2003A) is then connected to 4 magnetic relays which are further connected to 4 6V Bulbs. In addition, the external oscillator is connected to the OSC1 and OSC2 Pins of the microcontroller with a combination of crystal and 2 capacitors to provide clock pulse. A voltage regulator(7805) is also added which gives fix 5V DC voltage and prevents fluctuations.
WORKING OF PASSWORD BASED CIRCUIT BREAKER
Now lets see how the project works. First, when the power is turned on, the LCD displays a welcome screen and then asks you to enter the password to unlock it. In our case, the password is fixed i.e *1111=. By using the Keypad, password is inputed and as we type it the password is seen on the LCD. If the wrong password is entered, it will display a wrong password message and ask you to enter it again. When the correct password is entered, main screen of the circuit breaker is opened. Now the status of the 4 loads connected to the microcontroller are shown on the LCD as N for on and F for off. By the help of the keypad, when you press the desired button, the output goes to port A and turns on the relay driver IC which in turn switches the magnetic relay and thus the load turns on. By pressing the same button again, the load can be turned off.
Furthermore, multiple loads can be turned on or off at the same time. The final option is to change the password by pressing 5. The new password is then asked by the system and after inputing it, it is saved in EEPROM. Now, when you start the machine again, the new password will be required to start the system. This is the functionality of the project.
I write the C code on Mikcro c Pro for Pic bellow you will see the C-Code
PLEASE DO LIKE OUR FACEBOOK PAGE FOR UPDATE
n
PASSWORD SECURITY CODE
unsigned short kp;
char code1[5],user1[4];
char msg1[20]="initializing ",msg2[12]="enter code";
char msg3[15]="Access granted",msg4[15]="access denied";
char msg5[15]="enter new code";
int i=0,j,cnt;
char keypadport at PORTD;
sbit LCD_RS at RB2_bit;
sbit LCD_EN at RB3_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;
sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
void code_enter()
{
kp=0;
do
//kp=keypad_key_press();
kp=keypad_key_click();
while(!kp);
switch(kp){
case 1: kp = '1'; break;
case 2: kp = '2'; break;
case 3: kp = '3'; break;
case 5: kp = '4'; break;
case 6: kp = '5'; break;
case 7: kp = '6'; break;
case 9: kp ='7'; break;
case 10: kp = '8'; break;
case 11: kp = '9'; break;
case 12: kp = 35; break;
case 13: kp = 42; break;
case 14: kp = 48; break;
case 15: kp = 35; break;
}
code1[i]=kp;
Lcd_chr(2,i+7,code1[i]);
i++;
}
void delay_20ms(){
Delay_ms(20);}
void code_read ()
{delay_20ms();
user1[0]=EEPROM_Read(0x00);
delay_20ms();
user1[1]=EEPROM_Read(0x01);
delay_20ms();
user1[2]=EEPROM_Read(0x02);
delay_20ms();
user1[3]=EEPROM_Read(0x03);
delay_20ms();}
void code_write(){
delay_20ms();
EEPROM_Write(0x00,code1[0]);
delay_20ms();
EEPROM_Write(0x01,code1[1]);
delay_20ms();
EEPROM_Write(0x02,code1[2]);
delay_20ms();
EEPROM_Write(0x03,code1[3]);}
void change_code(){
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"Enter New Code");
i=0;
code_enter();
code_enter();
code_enter();
code_enter();
code_write();
code_read();}
void main(){
ADCON1=0x07;TRISA=0x00;PORTA.B0=1;
Keypad_Init();
Lcd_Out(1,1,msg1);
Delay_ms(500);
Lcd_Cmd(_LCD_CLEAR);
cnt=0;i=0;
do
{
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(2,1,"Press*");
i=0;
code_enter();
if(code1[0]==42){Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,msg2);
delay_ms(500);
i=0;
code_enter();
code_enter();
code_enter();
code_enter();
code_enter();
if(code1[0]=='2'&&code1[1]=='3'&&code1[2]=='4'&&code1[3]=='5'&&code1[4]==35){code_enter();if(code1[4]==35){change_code();}}
if(cnt<3 amp="" br="" code1="" user1=""> Lcd_Cmd(_LCD_CLEAR);Lcd_Out(1,1,msg3);PORTA.B0=0;PORTA.B2=1;
Delay_ms(5000);
PORTA.B2=0;
Delay_ms(5000);
PORTA.B0=1;}else{
cnt++;
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,msg4);}
if(cnt>=3)
do{
PORTA.B2=1;}
while(1);}}while(1);} 3>
char code1[5],user1[4];
char msg1[20]="initializing ",msg2[12]="enter code";
char msg3[15]="Access granted",msg4[15]="access denied";
char msg5[15]="enter new code";
int i=0,j,cnt;
char keypadport at PORTD;
sbit LCD_RS at RB2_bit;
sbit LCD_EN at RB3_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;
sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
void code_enter()
{
kp=0;
do
//kp=keypad_key_press();
kp=keypad_key_click();
while(!kp);
switch(kp){
case 1: kp = '1'; break;
case 2: kp = '2'; break;
case 3: kp = '3'; break;
case 5: kp = '4'; break;
case 6: kp = '5'; break;
case 7: kp = '6'; break;
case 9: kp ='7'; break;
case 10: kp = '8'; break;
case 11: kp = '9'; break;
case 12: kp = 35; break;
case 13: kp = 42; break;
case 14: kp = 48; break;
case 15: kp = 35; break;
}
code1[i]=kp;
Lcd_chr(2,i+7,code1[i]);
i++;
}
void delay_20ms(){
Delay_ms(20);}
void code_read ()
{delay_20ms();
user1[0]=EEPROM_Read(0x00);
delay_20ms();
user1[1]=EEPROM_Read(0x01);
delay_20ms();
user1[2]=EEPROM_Read(0x02);
delay_20ms();
user1[3]=EEPROM_Read(0x03);
delay_20ms();}
void code_write(){
delay_20ms();
EEPROM_Write(0x00,code1[0]);
delay_20ms();
EEPROM_Write(0x01,code1[1]);
delay_20ms();
EEPROM_Write(0x02,code1[2]);
delay_20ms();
EEPROM_Write(0x03,code1[3]);}
void change_code(){
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"Enter New Code");
i=0;
code_enter();
code_enter();
code_enter();
code_enter();
code_write();
code_read();}
void main(){
ADCON1=0x07;TRISA=0x00;PORTA.B0=1;
Keypad_Init();
Lcd_Out(1,1,msg1);
Delay_ms(500);
Lcd_Cmd(_LCD_CLEAR);
cnt=0;i=0;
do
{
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(2,1,"Press*");
i=0;
code_enter();
if(code1[0]==42){Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,msg2);
delay_ms(500);
i=0;
code_enter();
code_enter();
code_enter();
code_enter();
code_enter();
if(code1[0]=='2'&&code1[1]=='3'&&code1[2]=='4'&&code1[3]=='5'&&code1[4]==35){code_enter();if(code1[4]==35){change_code();}}
if(cnt<3 amp="" br="" code1="" user1=""> Lcd_Cmd(_LCD_CLEAR);Lcd_Out(1,1,msg3);PORTA.B0=0;PORTA.B2=1;
Delay_ms(5000);
PORTA.B2=0;
Delay_ms(5000);
PORTA.B0=1;}else{
cnt++;
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,msg4);}
if(cnt>=3)
do{
PORTA.B2=1;}
while(1);}}while(1);} 3>
PLEASE DO LIKE OUR FACEBOOK PAGE FOR UPDATE
No comments:
Post a Comment