Pages

RFID Based Door Access Control System using Microcontroller

Automation today has increased the speed of living. This project in which radio frequency is used to automatically control the door locks and grants access to the persons who are allowed to access that particular door.

The technology used is termed as RFID meaning ‘Radio Frequency Identification’. Here tags are provided in the form of identity cards which contain a coil and a transmitter.
When the coil is placed in a high frequency electromagnetic waves, it is energized and provides supply to the transmitter which transmits a code unique to the tag. This code is received and identify and hence the person is identified.
After identifying the person the access permission to the person are verified and if he is trying to access a door, which he is allowed access to, the door is opened and a log is created with the person’s name and time accessing the door.
Circuit Diagram:1
image


Frequency Counter Circuit

This frequency counter may seem simple but it is capable of measuring frequencies in range between 10Hz – 60MHz with 10Hz resolution. Frequency counter circuit is based on PIC16F282A  microcontroller clocked by 4MHz crystal.

Frequency Counter Circuit
Frequency counter has a transistor based TTL level converter where small signal is increased to level acceptable to PIC microcontroller logics. So it is capable of measuring signals from crystal oscillators. There is also no problem to use additional pre-scaller circuit and rise frequency range even to GHz level. I bet this frequency counter would find a place on any hobbyists workbench.

How To Program PIC(18F) Microcontroller In C Using MPLAB IDE

MPLAB IDE is a powerful tool used to program PIC Microcontroller. This software makes several output files of which hex file is used to burn PIC Microcontroller. You can download this software from Microchip site. You can Program any Microcontroller(18F) in C language in this software. 


  1. Open  MPLAB IDE  and from Project tab choose “Project Wizard” and from Project Wizard choose “Next“                               mplab pic 
  2. Select the device you want to use for programming and then choose “Next” mplab pic
  3. From Active Toolsuite  choose Microchip C18 Toolsuite and from Toolsuite contents choose MPLAB C18 C Compiler then choose “Next” mplab pic
  4. Now Browse and choose a New Project File and its Directory and choose “Next” pic 18f
  5. In Step Four the software will demand you to add any file to project. Since this is the first project so simply choose Next and then in next Step choose “Finish”.pic 18 mplab 
  6. Now click on New file button and and create a empty file and don’t forget to choose it’s extension as .C  5
  7. From the view tab choose “Project” then on the left side you can see the following type of Tool bar. Now Right Click on “Source Files” and choose “Add Files” and Add the file you have saved(see 6th point) pic mplab programming
  8. Similarly you need to add Header files, Library files, Linker files from your installed Program directorypic mplab programming
  9. Now you can write your code in the source file in C language. After writing the project from the Project Tab choose “build” and you will have the hex file on the same directory where your source file is…pic 18f

program for Seven segment display in 8051


#include<stdio.h>
#include <REG51.H>
void delay(int g);
int port[20] = {0xff,0xff,0xff,0xff,
0xc6,0x86,0xc7,0x86,
0xbf,0xc0,0xde,0x87,
0xbf,0x92,0x91,0x92,
0x92,0xc8,0x86,0x87},i;
void main(){
int d,b,j,k,s;
while(1){
i=0;
for(d=0;d<5;d++)
{
for(b=0;b<4;b++)
{
k=port[i++];
for(j=0;j<8;j++){
s=k;
s=s&0x80;
if(s==0x00)
P1= 0x00;
else
P1=0x1;
P2 = 0x1;
P2=0x00;
s=k;
s=s<<1;
k=s;
}
}
delay(10000);
delay(10000);
}
}
}
void delay(int g)
{
int h;
for(h=0;h<=g;g++)
{
;
}
}

program for Dual DAC, square wave in 8051


#include <REG51xD2.H>
#include "lcd.h"
sbit Amp = P3^3; /* Port line to change amplitude */
sbit Fre = P3^2; /* Port line to change frequency */
void delay(unsigned int x) /* delay routine */
{
for(;x>0;x--);
}
main()
{
unsigned char on = 0x7f,off=0x00;
unsigned int fre = 100;
InitLcd(); /* Initialize LCD */
WriteString("Squarewave"); /* Write to LCD */
while(1)
{
if(!Amp) /* if user choice is to change amplitude */
{
while(!Amp); /* wait for key release */
on+=0x08; /* Increase the amplitude */
}
if(!Fre) /* if user choice is to change frequency */
{
if(fre > 1000) /* if frequency exceeds 1000 reset to default */
fre = 100;
while(!Fre); /* wait for key release */
fre += 50; /* Increase the frequency */
}
P0=on; /* write amplitude to port */
P1=on;
delay(fre);
P0 = off; /* clear port */
P1 = off;
delay(fre);
}
}

program for Dual DAC, triangle wave in 8051

#include <REG51xD2.H>

#include "lcd.h"
main()
{
unsigned char i=0;
InitLcd(); /* Initialise LCD */
WriteString("Triangular Wave"); /* Display on LCD */
P0 = 0x00; /* P0 as Output port */
while(1)
{
for(i=0;i<0xff;i++){ /* Generate ON pulse */
P1 = i;
P0 = i; }
for(i=0xfe;i>0x00;i--) /* Generate OFF pulse */
{P0 = i;
P1 = i;}
}
}

PIC 16f84a LED on/off with delay project

Flowchart Explanation:

Set the Port B of the PIC 16F84A device as output Port. Turn the Led-on by sending the data one to the Port B and create a Delay of 0.5 seconds to keep the Led in on-state. Turn the Led-off by sending the data zero to the Port B and create a Delay of 0.5 seconds to keep the Led in off-state. this process is repeated untill the power supply to the PIC 16F84A goes off.Flowchart and Circuit Diagram:

Circuit Description:PIC 16F84A microcontroller device is programmed to turning a LED on/off continuously with delay. this device uses 4MHz crystal/Resonator oscillator to drive osc1 and osc2. Port B RB0 is used as output port and it output the positive current with some delay to blink the LED and this delay timing depends on the program. A 100 or120 ohms resistance is connected to the LED to limiting the output current from RB0. VDD(Pin 14) and pin 4 is connected to the +5V power supply. Vss(Pin 5) is connected to the -5V or ground.Embedded C Program: LED on/off with delayCompiler: PIC CCS C compilerEmbedded C program for Turning a Led On/Off with delay. its very easy to learn and you can able to understand the concept and logic of the program from the flowchart and comment lines of the program.


/*Project Name: LED on/off with 0.5 second delay*/

#include<16F84A.h>   /*defines type of device to include device files*/

#use delay(clock=4mhz)     /* defines crystal frequency 4MHz */

#fuses xt, nowdt, noprotect, noput
/* xt oscilator used and no watch dog timer, no code protection, no     power up timer is used */

#byte portb=6                  /* defines memory location of register */

void main()
  {
     set_tris_b(0x00);        /* it sets the portb as output port */

     loop1: portb=0x01;    /* sends 1 to portb RB0 to turn the LED-on */

     delay_ms(500);    /* creates half second delay between LED on/off*/

     portb=0x00;            /* sends 0 to portb RB0 to turn the LED-off */

     delay_ms(500);     /*creates half second delay between LED off/on*/

     goto loop1;
  }
     /* loop1 just turns-on/off the LED continuously until the power supply             OFF */


Delay: delay is used to keep the processor output as constant for the period of specified time. this period of time is called as Delay time. Delay time can be programmed according to your specified timings. for example
delay in milli seconds
delay in seconds
250
0.25
500
0.5
1000
1
2000
2

PushButton for Led Chaser with microcontroller

PushButton Led Chaser:
PushButton micro switch is used as an input to ON and OFF Led chaser. when you press the pushbutton then it starts(ON) the Led chaser. Led chaser means Led blinks one by one in continuous motion. if you press the pushbutton when an Led chaser in ON condition then it stops(OFF) Led chaser.Flowchart Explanation:Set the PortA RA0 as input and PortB RB0 as output of the PIC 16F84A device. Create a never ending while loop and inside the while loop read the PortA RA0 bit.Check whether the PushButton switch is pressed or not. If the Button is Pressed means PortA RA0 = 1 or RA0 goes High and it enters into the while loop and starts the Led Chaser by shifting the data 1 stored in the variable value using Left Shift Operator with a 0.25 second delay and again checks for button is pressed if it is pressed again then Stops the Led Chaser by sending 0x00 to PortB and the control comes out of the second while loop and the same process is repeated. If the Button is not Pressed means it will go to while loop and again checks for switch press.Circuit Diagram:

Circuit Description: PIC 16F84A microcontroller device is programmed for Led Chaser with Push Button when the button is pressed. this device uses the capacitor C1, C2(33pf) and 4MHz crystal/Resonator oscillator to drive the oscillator1 and oscillator2. The Push Button is connected to the PortA RA0 and +5V and pull down Resistor R2(10k) is connected to the PortA RA0 and Gnd.(Gnd means ground)In this circuit Active High Input is used. Resistor R2(10k) is used to pull down the PIC input to Logic '0' or Low or Pull down the Voltage down to zero. when you press the switch it pulls the voltage from 0 to 5V and makes the input to Logic '1' or High. Resistor 1K is connected to the PortB and Leds. the other negative terminal of all the eight Led is connected to the ground.Resistor R is a Current Limiting Resistor R(1K) is used to prevent the damage to both the PIC and the Leds. Resistor R reduces the current to the sufficient level.Embedded C Program: PushButton for Led ChaserCompiler: PIC CCS C compilerEmbedded C program for PushButton for Led Chaser. its very easy to learn and you can able to understand the concept and logic of the program from the flowchart and comment lines of the program.
/* Project Name: PushButton for Led Chaser */

#include<16F84A.h>         /*defines type of device to include device files*/

#use delay(clock=4mhz)    /* defines crystal frequency 4MHz */

#fuses xt, nowdt, noprotect, noput
/* xt oscilator used and no watch dog timer, no code protection, no power up     timer is used */

#byte portb=5               /* defines memory location of register */
#byte portb=6                /* defines memory location of register */

void main()
  {
    byte c,d;
    set_tris_a(0x01);        /* it sets the portA RA0 as input port */
    set_tris_b(0x00);        /* it sets the portB RB0 as output port */
    while(true)
    {
      if(porta == 0x01)       /* if switch pressed starts Disco Led */
      {      
       while(true)
        {
         c = 0;                   /*initialize the count c equal to zero */
         d = 0x01;              /* assigns the content of d to 0x01 */
         while(c < 8)
         {
           portb = d; /*sends content of d to portb to turn-on 1st Led*/
           delay_ms(250);  /* creates 0.25 second delay */
           d = d << 1;       /* shifts the value of data to the left by 1*/           c++;                /* increments the value of c by 1*/
          }
           if(porta == 0x01)   /*if switch pressed again stops DiscoLed*/
             {
              portb = 0x00; /*assigns portB RB0 to 0x00 to turn-offLed*/
              break;              /* comes out of the loop*/
              }
         }
      }
    }
  }