SlideShare a Scribd company logo
AVR PROJECT REPORT
AUTOMATIC ROOM LIGHT CONTROLLER WITH
BIDIRECTIONAL VISITOR COUNTER
Submitted by:
 Mafaz Ahmed 1882-F12
Abstract:
This Project “Automatic Room Light Controller with Bidirectional
Visitor Counter” is reliable that takes over the task of controlling the room lights
as well us counting number of persons/visitors in the room very accurately. When
somebody enters into the room then the counter is incremented by one and the
light in the room will be switched ON and when any one leaves the room then the
counter is decremented by one. The light will be only switched OFF until all the
persons in the room go out. The total number of persons inside the room is also
displayed on the LCD. Whenever a person enter a room, he or she have to enter a
password using a keypad interfaced with the microcontroller. Only those enter
the room who know the password.
INTRODUCTION:
The objective of this project is to make a controller based
model to count number of persons visiting particular room and accordingly light
up the room. Here we can use sensor and can know present number of persons.
In today’s world, there is a continuous need for automatic appliances. With the
increase in standard of living, there is a sense of urgency for
developing circuits that would ease the complexity of life. Also if at all one wants
to know the number of people present in room so as not to have congestion, this
circuit proves to be helpful.
Block Diagram:
A
T
M
E
G
A
1
6
ENTER SENSOR
EXIT SENSOR
KEYPAD
LCD
DOOR RELAY
FAN Control
LIGHT CONTOL
LIST OF COMPONENTS:
 Microcontroller – ATMEGA16
 Infrared Sensor
 Preset – 4.7K
 Reset button switch
 Diode – IN4148
 Transistor – TIP41
 LCD 16x2
 Keypad
 LED’s
 IC-LM324
Microcontroller ATMEGA16:
An Atmel ATmega16 microcontroller in a 40 pin DIP
package. It has 16 KB programmable flash memory, static RAM of 1 KB and
EEPROM of 512 Bytes. There are 32 I/O
(input/output) lines which are divided
into four 8-bit ports designated as
PORTA, PORTB, PORTC and PORTD. It
has various in-built peripherals
like USART, ADC, ATmega16 has
various in-built peripherals alternative
task related to in-built peripherals.
LCD
LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications.
A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These
modules are preferred over seven segments and other multi segment LEDs. The reasons being: LCDs are
economical; easily programmable; have no limitation of displaying special & even custom
characters (unlike in seven segments), animations and so on.
A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each
character is displayed in 5x7 pixel matrix. This LCD has two registers, namely, Command and Data.
The command register stores the command instructions given to the LCD. A command is an instruction
given to LCD to do a predefined task like initializing it, clearing its screen, setting the cursor position,
controlling display etc. The data register stores the data to be displayed on the LCD. The data is the ASCII
value of the character to be displayed on the LCD.
LM324:
LM324 is a 14pin IC consisting of four independent operational
amplifiers (op-amps)
compensated in a single package.
Op-amps are high gainelectronic
voltage amplifier with differential
input and, usually, a single-ended
output. The output voltage is
many times higher than the
voltage difference between input
terminals of an op-amp.
IR Sensor-:
This is the most fundamental type of sensor available in the market. The basic concept
is simple. There is an emitter which emits infrared (IR)
rays. These IR rays are detected by a detector. This
concept is used to make proximity sensor (to check if
something obstructs the path or not, etc), contrast
sensors (used to detect contrast difference between black
and white, like in line follower robots), etc.
TIP41:
The Bipolar Power Transistor is designed for general purpose power amplifier and switching
applications. The TIP41, TIP41A, TIP41B, TIP41C (NPN); and TIP42, TIP42A, TIP42B, TIP42C (PNP)
are complementary devices.
 Collector-Emitter Saturation Voltage - VCE(sat) = 1.5 V<subdc< sub="" style="font-family: Verdana, Arial, He
serif;"> (Max) @ IC = 6.0 Adc</subdc<>
 Collector-Emitter Sustaining Voltage -VCEO(sus) = 60 Vdc (min) - TIP41A, TIP42A
=80 Vdc (min) - TIP41B, TIP42B
=100 Vdc (min) - TIP41C, TIP42C
 High Current Gain Bandwidth Product
fT = 3 MHz (min) @ IC = 500 mAdc
 Compact TO-220 AB Package
 These are Pb-Free Packages
Circuit:
CODE:
#define F_CPU 8000000UL // Define the crystal frequency
#include <avr/io.h> // Standard header file for input and output functionality
#include <util/delay.h> // For delay function
#include <avr/interrupt.h>
#define LCD_PRT PORTA //LCD DATA PORT
#define LCD_DDR DDRA //LCD DATA DDR
#define LCD_PIN PINA//LCD DATA PIN
#define LCD_RS 0 //LCD RS
#define LCD_RW 1 //LCD RW
#define LCD_EN 2 //LCD EN //Enable/disable pin for
LCD
#define KEY_PRT PORTC
#define KEY_DDR DDRC
#define KEY_PIN PINC
char ROW=0, COL=0;
char keypad[4][3]= {'1','2','3',
'4','5','6',
'7','8','9',
'*','0','#' };
unsigned char cnt=0;
ISR (TIMER2_OVF_vect)
{if(cnt==0){OCR2 =255;}
if(cnt>=1){OCR2 =191;}
if(cnt>=3){OCR2=127;}
if(cnt>=5){OCR2=0;} }
void lcdcmd(unsigned char cmnd)
{ // LCD command function
LCD_PRT = (LCD_PRT & 0x0F) | (cmnd & 0xF0);
LCD_PRT &= ~ (1<<LCD_RS); //RS = 0 for command
LCD_PRT &= ~ (1<<LCD_RW) ; //RW = 0 for write
LCD_PRT |= (1<<LCD_EN); //EN = 1 for H-to-L
_delay_us (50) ; //wait to make EN wider
LCD_PRT &= ~ (1<<LCD_EN); //EN = 0 for H-to-L
_delay_us(50) ; //wait
LCD_PRT = (LCD_PRT & 0x0F) | (cmnd << 4);
LCD_PRT |= (1<<LCD_EN); //EN = 1 for H-to-L
_delay_us (1) ; //wait to make EN wider
LCD_PRT &= ~ (1<<LCD_EN); } //EN = 0 for H-to-L
void lcddata(unsigned char data) // LCD Data function
{
LCD_PRT = (LCD_PRT & 0X0F) | (data & 0XF0);
LCD_PRT |= (1<<LCD_RS); //RS = 1 for data
LCD_PRT &= ~ (1<<LCD_RW) ; //RW = 0 for write
LCD_PRT |= (1<<LCD_EN); //EN = 1 for H-to-L
_delay_us(50) ;
LCD_PRT &= ~ (1<<LCD_EN) ;
LCD_PRT = (LCD_PRT & 0x0F) | (data<<4);
LCD_PRT |= (1<<LCD_EN);
_delay_us(50);
LCD_PRT &= ~ (1<<LCD_EN);
}
void lcd_init()
{
LCD_DDR = 0xFF;
LCD_PRT &=~(1<<LCD_EN);
_delay_us(2000);
lcdcmd(0x33);
_delay_us (100);
lcdcmd(0x32);
_delay_us (100);
lcdcmd(0x28);
_delay_us (100);
lcdcmd(0x0E);
_delay_us(100);
lcdcmd(0x01);
_delay_us(2000);
lcdcmd(0x06);
_delay_us(100);
}
void lcd_gotoxy (unsigned char x, unsigned char y)
{ //Table 12-5
unsigned char firstCharAdr[]={0x80,0xC0,0x94,0xD4};
lcdcmd(firstCharAdr[ y-1]+x-1);
_delay_us(100) ;
}
void lcd_string(unsigned char *str) //function to show string on LCD
{ unsigned char i = 0;
while (str[ i] !=0)
{lcddata(str[ i] );
i++;
}
}
//look up table for keypad function
char key_pad() // key pad function
{
while(1)
{
KEY_PRT=0x7E;
//MAKE FIRST ROW IN KEYPAD TO ZERO
// MAKE ALL COL'S AS HIGH
if((KEY_PIN&0x10)==0){while((KEY_PIN&0x10)==
0);ROW=1;COL=1;break;}
if((KEY_PIN&0x20)==0){while((KEY_PIN&0x20)==
0);ROW=1;COL=2;break;}
if((KEY_PIN&0x40)==0){while((KEY_PIN&0x40)==
0);ROW=1;COL=3;break;}
KEY_PRT=0x7D;
//MAKE SECOND ROW IN KEYPAD TO ZERO
// MAKE ALL COL'S AS HIGH
if((KEY_PIN&0x10)==0){while((KEY_PIN&0x10)==
0);ROW=2;COL=1;break;}
if((KEY_PIN&0x20)==0){while((KEY_PIN&0x20)==
0);ROW=2;COL=2;break;}
if((KEY_PIN&0x40)==0){while((KEY_PIN&0x40)==
0);ROW=2;COL=3;break;}
KEY_PRT=0x7B;
//MAKE THIRD ROW IN KEYPAD TO ZERO
// MAKE ALL COL'S AS HIGH
if((KEY_PIN&0x10)==0){while((KEY_PIN&0x10)==
0);ROW=3;COL=1;break;}
if((KEY_PIN&0x20)==0){while((KEY_PIN&0x20)==
0);ROW=3;COL=2;break;}
if((KEY_PIN&0x40)==0){while((KEY_PIN&0x40)==
0);ROW=3;COL=3;break;}
KEY_PRT=0x77;
//MAKE 4TH ROW IN KEYPAD TO ZERO
// MAKE ALL COL'S AS HIGH
if((KEY_PIN&0x10)==0){while((KEY_PIN&0x10)==
0);ROW=4;COL=1;break;}
if((KEY_PIN&0x20)==0){while((KEY_PIN&0x20)==
0);ROW=4;COL=2;break;}
if((KEY_PIN&0x40)==0){while((KEY_PIN&0x40)==
0);ROW=4;COL=3;break;}
}
return keypad[ROW-1][COL-1];
}
unsigned char ps[]="ENTER PASSWARD";
unsigned char un[]="UNLOCKED";
unsigned char lo[]="LOCKED";
unsigned char wr[]="WRONG PASSWARD";
unsigned char ea[]="ENTER AGAIN";
unsigned char passward[]={'4','6','2','2'};
unsigned char user[4];
unsigned char d;
void enter(){lcd_init();
lcd_gotoxy(2,1);
lcd_string(ps);
lcdcmd(0xC6);
for(d=0;d<4;d++)
{ user[d]=key_pad(); lcddata(user[d]);}
_delay_ms(100);
if((user[0]==passward[0])&&(user[1]==passward[1])&&(user[2]==passward[2])&
&(user[3]==passward[3]))
{ lcd_init(); lcd_gotoxy(5,1); lcd_string("WELCOME");
PORTB|=(1<<2);
while(1){if(PINB &
0x02){cnt++;PORTB&=~(1<<2);if(cnt>0){PORTB|=(1<<3);}_delay_ms(200);bre
ak;}}}
else
{lcd_init();
lcd_gotoxy(3,1);
lcd_string(wr); _delay_ms(500);}
}
void exit()
{PORTB|=(1<<2);
while(1){if(PINB & 0x01){cnt--;
PORTB&=~(1<<2);lcd_init();lcd_gotoxy(5,1);lcd_string("GOOD
BY");if(cnt<=0)PORTB&=~(1<<3);
_delay_ms(1000);while(PINB & 0x01);break;}
}
}
unsigned char count=0;
int main(void) //main function
{
DDRD |= (1<<7); //PB3 as output
OCR2 = 255;
TCCR2 = 0x76;;
TIMSK |= (1<<TOIE2) ;
sei( );
DDRB=0x0C; // PB 0,1 input and PB.2 ,PB.3
KEY_DDR=0x0F;
while(1)
{ lcd_init();
lcd_gotoxy(5,1);
lcd_string("Count=");
count=cnt&0x0F;
count=count|0x30;
lcddata(count);
while(1){if(PINB & 0x01){enter();break;}if(PINB &
0x02){exit();break;}}
//while(1){if(PINB & 0x01){enter();break;}if(PINB &
0x02){exit();break;}}
_delay_ms(100);
}
return 0;}
PCB CIRCUIT DESIGN:
CONCLUSION:
Hereby we come to the end of our project “AUTOMATIC ROOM
LIGHT CONTROLLER WITH BIDIRECTIONL VISITOR COUNTER”.
 Application of this project
 For counting purposes
 For automatic room light control
 Advantages of this project
 Low cost
 Easy to use
 Implement in single door
 Future Expansion
 By using this circuit and proper power supply we can implement
various applications such as fans, tube lights, etc.
 By modifying this circuit and using two relays we can achieve a task
of opening and closing the door
Reference:
 . http://www.engineersgarage.com/electronic-components/lm324n-datasheet
 http://www.engineersgarage.com/electronic-components/atmega16-
microcontroller

More Related Content

What's hot

Bi directional visitor counter rewat
Bi directional visitor counter   rewatBi directional visitor counter   rewat
Bi directional visitor counter rewatvishwesh sharma
 
Bidirect visitor counter
Bidirect visitor counterBidirect visitor counter
Bidirect visitor counter
Electric&elctronics&engineeering
 
ppt of automatic room light controller and BI directional counter
ppt of automatic room light controller and BI directional counterppt of automatic room light controller and BI directional counter
ppt of automatic room light controller and BI directional counter
Mannavapremkumar
 
automatic street light
automatic street lightautomatic street light
automatic street lightAnish Anand
 
Touch Switch (Smart Switches) by arduino Project report file
Touch Switch (Smart Switches) by arduino  Project  report fileTouch Switch (Smart Switches) by arduino  Project  report file
Touch Switch (Smart Switches) by arduino Project report file
imkanhaiyalal
 
Automatic Room Lights Controller Using Arduino & PIR Sensor
Automatic Room Lights Controller Using Arduino & PIR SensorAutomatic Room Lights Controller Using Arduino & PIR Sensor
Automatic Room Lights Controller Using Arduino & PIR Sensor
Ankit Chaudhary
 
Automatic room light controller with password detection system
Automatic room light controller with password detection systemAutomatic room light controller with password detection system
Automatic room light controller with password detection system
shubham jha
 
Presentation knock door bell project by namit
Presentation knock door bell project by namitPresentation knock door bell project by namit
Presentation knock door bell project by namit
Namit Sood
 
Visitor counter
Visitor counterVisitor counter
Visitor counter
ASHISH KUMAR
 
Bidirectional visitor counter & home automation by Jitendra Dhaka
Bidirectional visitor counter & home automation by Jitendra DhakaBidirectional visitor counter & home automation by Jitendra Dhaka
Bidirectional visitor counter & home automation by Jitendra Dhaka
NIT srinagar
 
Ppt on automatic street light control using ir sensors
Ppt on automatic street light control using ir sensorsPpt on automatic street light control using ir sensors
Ppt on automatic street light control using ir sensors
Vikram Emmidi
 
Automatic control of street light using LDR
Automatic control of street light using LDRAutomatic control of street light using LDR
Automatic control of street light using LDR
Devang Loharikar
 
Temperature Based Fan Controller
Temperature Based Fan Controller Temperature Based Fan Controller
Temperature Based Fan Controller
richa1910n
 
Bidirectional Visitor counter Project Proposal
Bidirectional Visitor counter Project ProposalBidirectional Visitor counter Project Proposal
Bidirectional Visitor counter Project Proposal
Arsalan Ahmad
 
Obstacle Avoiding Robot Report Robot23
Obstacle Avoiding Robot Report Robot23Obstacle Avoiding Robot Report Robot23
Obstacle Avoiding Robot Report Robot23Abhijeet kapse
 
ARDUINO BASED HEART BEAT MONITORING SYSTEM
ARDUINO BASED HEART BEAT MONITORING SYSTEMARDUINO BASED HEART BEAT MONITORING SYSTEM
ARDUINO BASED HEART BEAT MONITORING SYSTEM
MOHAMMAD HANNAN
 
Automatic doorbell with object detection
Automatic doorbell with object detectionAutomatic doorbell with object detection
Automatic doorbell with object detection
Anurag Alaria
 
Automatic railway gate control using arduino uno
Automatic railway gate control using arduino unoAutomatic railway gate control using arduino uno
Automatic railway gate control using arduino uno
selvalakshmi24
 
Automatic room temperature controlled fan using arduino uno microcontroller
Automatic room temperature controlled fan using   arduino uno  microcontrollerAutomatic room temperature controlled fan using   arduino uno  microcontroller
Automatic room temperature controlled fan using arduino uno microcontroller
Mohammod Al Emran
 

What's hot (20)

Bi directional visitor counter rewat
Bi directional visitor counter   rewatBi directional visitor counter   rewat
Bi directional visitor counter rewat
 
Bidirect visitor counter
Bidirect visitor counterBidirect visitor counter
Bidirect visitor counter
 
ppt of automatic room light controller and BI directional counter
ppt of automatic room light controller and BI directional counterppt of automatic room light controller and BI directional counter
ppt of automatic room light controller and BI directional counter
 
automatic street light
automatic street lightautomatic street light
automatic street light
 
Touch Switch (Smart Switches) by arduino Project report file
Touch Switch (Smart Switches) by arduino  Project  report fileTouch Switch (Smart Switches) by arduino  Project  report file
Touch Switch (Smart Switches) by arduino Project report file
 
Automatic Room Lights Controller Using Arduino & PIR Sensor
Automatic Room Lights Controller Using Arduino & PIR SensorAutomatic Room Lights Controller Using Arduino & PIR Sensor
Automatic Room Lights Controller Using Arduino & PIR Sensor
 
Automatic room light controller with password detection system
Automatic room light controller with password detection systemAutomatic room light controller with password detection system
Automatic room light controller with password detection system
 
Presentation knock door bell project by namit
Presentation knock door bell project by namitPresentation knock door bell project by namit
Presentation knock door bell project by namit
 
Visitor counter
Visitor counterVisitor counter
Visitor counter
 
Bidirectional visitor counter & home automation by Jitendra Dhaka
Bidirectional visitor counter & home automation by Jitendra DhakaBidirectional visitor counter & home automation by Jitendra Dhaka
Bidirectional visitor counter & home automation by Jitendra Dhaka
 
Ppt on automatic street light control using ir sensors
Ppt on automatic street light control using ir sensorsPpt on automatic street light control using ir sensors
Ppt on automatic street light control using ir sensors
 
automatic room light controller
automatic room light controllerautomatic room light controller
automatic room light controller
 
Automatic control of street light using LDR
Automatic control of street light using LDRAutomatic control of street light using LDR
Automatic control of street light using LDR
 
Temperature Based Fan Controller
Temperature Based Fan Controller Temperature Based Fan Controller
Temperature Based Fan Controller
 
Bidirectional Visitor counter Project Proposal
Bidirectional Visitor counter Project ProposalBidirectional Visitor counter Project Proposal
Bidirectional Visitor counter Project Proposal
 
Obstacle Avoiding Robot Report Robot23
Obstacle Avoiding Robot Report Robot23Obstacle Avoiding Robot Report Robot23
Obstacle Avoiding Robot Report Robot23
 
ARDUINO BASED HEART BEAT MONITORING SYSTEM
ARDUINO BASED HEART BEAT MONITORING SYSTEMARDUINO BASED HEART BEAT MONITORING SYSTEM
ARDUINO BASED HEART BEAT MONITORING SYSTEM
 
Automatic doorbell with object detection
Automatic doorbell with object detectionAutomatic doorbell with object detection
Automatic doorbell with object detection
 
Automatic railway gate control using arduino uno
Automatic railway gate control using arduino unoAutomatic railway gate control using arduino uno
Automatic railway gate control using arduino uno
 
Automatic room temperature controlled fan using arduino uno microcontroller
Automatic room temperature controlled fan using   arduino uno  microcontrollerAutomatic room temperature controlled fan using   arduino uno  microcontroller
Automatic room temperature controlled fan using arduino uno microcontroller
 

Similar to Automatic room light controller with visible counter

SIMPLE Frequency METER using AT89c51
SIMPLE Frequency METER using AT89c51 SIMPLE Frequency METER using AT89c51
SIMPLE Frequency METER using AT89c51
aroosa khan
 
8051 microcontroller training (2) (sahil gupta 9068557926)
8051 microcontroller training  (2) (sahil gupta   9068557926)8051 microcontroller training  (2) (sahil gupta   9068557926)
8051 microcontroller training (2) (sahil gupta 9068557926)
Sahil Gupta
 
m.tech esd lab manual for record
m.tech esd lab manual for recordm.tech esd lab manual for record
m.tech esd lab manual for record
G Lemuel George
 
Basic standard calculator
Basic standard calculatorBasic standard calculator
Basic standard calculator
UVSofts Technologies
 
Keypad interfacing 8051 -NANOCDAC
Keypad interfacing 8051 -NANOCDACKeypad interfacing 8051 -NANOCDAC
Keypad interfacing 8051 -NANOCDAC
nanocdac
 
embedded system
embedded systemembedded system
embedded system
Vivek Ranjan
 
Bidirectional Visitor Counter with Automatic ON-OFF Switch2
Bidirectional Visitor Counter with Automatic ON-OFF Switch2Bidirectional Visitor Counter with Automatic ON-OFF Switch2
Bidirectional Visitor Counter with Automatic ON-OFF Switch2DIPAN GHOSH
 
Introduction to embedded system & density based traffic light system
Introduction to embedded system & density based traffic light systemIntroduction to embedded system & density based traffic light system
Introduction to embedded system & density based traffic light system
Rani Loganathan
 
Embedded system
Embedded  systemEmbedded  system
Embedded system
ANSHUL GUPTA
 
summer training report (2)
summer training report (2)summer training report (2)
summer training report (2)Kavya Gupta
 
8051 microcontroller training (sahil gupta 9068557926)
8051 microcontroller training  (sahil gupta   9068557926)8051 microcontroller training  (sahil gupta   9068557926)
8051 microcontroller training (sahil gupta 9068557926)
Sahil Gupta
 
131080111003 mci
131080111003 mci131080111003 mci
131080111003 mci
jokersclown57
 
Password based door locksystem
Password  based door locksystemPassword  based door locksystem
Password based door locksystem
UVSofts Technologies
 
Microcontroller
MicrocontrollerMicrocontroller
MicrocontrollerSpitiq
 
Presentation
PresentationPresentation
Presentation
Abhijit Das
 

Similar to Automatic room light controller with visible counter (20)

SIMPLE Frequency METER using AT89c51
SIMPLE Frequency METER using AT89c51 SIMPLE Frequency METER using AT89c51
SIMPLE Frequency METER using AT89c51
 
8051 microcontroller training (2) (sahil gupta 9068557926)
8051 microcontroller training  (2) (sahil gupta   9068557926)8051 microcontroller training  (2) (sahil gupta   9068557926)
8051 microcontroller training (2) (sahil gupta 9068557926)
 
Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
 
m.tech esd lab manual for record
m.tech esd lab manual for recordm.tech esd lab manual for record
m.tech esd lab manual for record
 
report cs
report csreport cs
report cs
 
Basic standard calculator
Basic standard calculatorBasic standard calculator
Basic standard calculator
 
Keypad interfacing 8051 -NANOCDAC
Keypad interfacing 8051 -NANOCDACKeypad interfacing 8051 -NANOCDAC
Keypad interfacing 8051 -NANOCDAC
 
embedded system
embedded systemembedded system
embedded system
 
Akash uid ppt3
Akash uid ppt3Akash uid ppt3
Akash uid ppt3
 
Rig nitc [autosaved] (copy)
Rig nitc [autosaved] (copy)Rig nitc [autosaved] (copy)
Rig nitc [autosaved] (copy)
 
Bidirectional Visitor Counter with Automatic ON-OFF Switch2
Bidirectional Visitor Counter with Automatic ON-OFF Switch2Bidirectional Visitor Counter with Automatic ON-OFF Switch2
Bidirectional Visitor Counter with Automatic ON-OFF Switch2
 
Introduction to embedded system & density based traffic light system
Introduction to embedded system & density based traffic light systemIntroduction to embedded system & density based traffic light system
Introduction to embedded system & density based traffic light system
 
Embedded system
Embedded  systemEmbedded  system
Embedded system
 
Final Presentation
Final PresentationFinal Presentation
Final Presentation
 
summer training report (2)
summer training report (2)summer training report (2)
summer training report (2)
 
8051 microcontroller training (sahil gupta 9068557926)
8051 microcontroller training  (sahil gupta   9068557926)8051 microcontroller training  (sahil gupta   9068557926)
8051 microcontroller training (sahil gupta 9068557926)
 
131080111003 mci
131080111003 mci131080111003 mci
131080111003 mci
 
Password based door locksystem
Password  based door locksystemPassword  based door locksystem
Password based door locksystem
 
Microcontroller
MicrocontrollerMicrocontroller
Microcontroller
 
Presentation
PresentationPresentation
Presentation
 

More from Mafaz Ahmed

A course in fuzzy systems and control by li xin wang solution manual
A course in fuzzy systems and control by li xin wang solution manualA course in fuzzy systems and control by li xin wang solution manual
A course in fuzzy systems and control by li xin wang solution manual
Mafaz Ahmed
 
INTERACTIVE FLOOR PROJECTION SYSTEM
INTERACTIVE FLOOR PROJECTION  SYSTEMINTERACTIVE FLOOR PROJECTION  SYSTEM
INTERACTIVE FLOOR PROJECTION SYSTEM
Mafaz Ahmed
 
Series and parallel operation of power devices
Series and parallel operation of power devicesSeries and parallel operation of power devices
Series and parallel operation of power devices
Mafaz Ahmed
 
Series and parallel connection of igbt
Series and parallel connection of igbtSeries and parallel connection of igbt
Series and parallel connection of igbt
Mafaz Ahmed
 
Series and parallel connection of mosfet
Series and parallel connection of mosfetSeries and parallel connection of mosfet
Series and parallel connection of mosfet
Mafaz Ahmed
 
Electronic Instrumentation and Measurement Solution Manual
Electronic Instrumentation and Measurement Solution ManualElectronic Instrumentation and Measurement Solution Manual
Electronic Instrumentation and Measurement Solution Manual
Mafaz Ahmed
 
Project loon
Project loonProject loon
Project loon
Mafaz Ahmed
 
Internet of Things
Internet of ThingsInternet of Things
Internet of Things
Mafaz Ahmed
 
Interoperability among various Generations of Telecom Technologies
Interoperability among various Generations of Telecom TechnologiesInteroperability among various Generations of Telecom Technologies
Interoperability among various Generations of Telecom Technologies
Mafaz Ahmed
 
Dc motor drive
Dc motor driveDc motor drive
Dc motor drive
Mafaz Ahmed
 
Energy Crisis, Different Energy Sources and Role of Power Electronics
Energy Crisis, Different Energy Sources and Role of Power ElectronicsEnergy Crisis, Different Energy Sources and Role of Power Electronics
Energy Crisis, Different Energy Sources and Role of Power Electronics
Mafaz Ahmed
 
RADIO ON RADIO OVER FIBER EFFICIENT FRONTHAULING FOR SMALL CELLS AND MOVING C...
RADIO ON RADIO OVER FIBER EFFICIENT FRONTHAULING FOR SMALL CELLS AND MOVING C...RADIO ON RADIO OVER FIBER EFFICIENT FRONTHAULING FOR SMALL CELLS AND MOVING C...
RADIO ON RADIO OVER FIBER EFFICIENT FRONTHAULING FOR SMALL CELLS AND MOVING C...
Mafaz Ahmed
 
Temperature Control Fan Using 8051 Microcontroller
Temperature Control Fan Using 8051 MicrocontrollerTemperature Control Fan Using 8051 Microcontroller
Temperature Control Fan Using 8051 Microcontroller
Mafaz Ahmed
 
Project Management Project
Project Management ProjectProject Management Project
Project Management Project
Mafaz Ahmed
 
Speed Control of DC Motor
Speed Control of DC MotorSpeed Control of DC Motor
Speed Control of DC Motor
Mafaz Ahmed
 
Low drift high impedance jfet dc voltmeter
Low drift high impedance jfet dc voltmeterLow drift high impedance jfet dc voltmeter
Low drift high impedance jfet dc voltmeter
Mafaz Ahmed
 
Real Time Clock Interfacing with FPGA
Real Time Clock Interfacing with FPGAReal Time Clock Interfacing with FPGA
Real Time Clock Interfacing with FPGA
Mafaz Ahmed
 
Tweety modelling in pro engineering
Tweety modelling in pro engineeringTweety modelling in pro engineering
Tweety modelling in pro engineering
Mafaz Ahmed
 
Truck modelling in pro engineering
Truck modelling in pro engineeringTruck modelling in pro engineering
Truck modelling in pro engineering
Mafaz Ahmed
 
Bicycle modelling in pro engineering
Bicycle modelling in pro engineeringBicycle modelling in pro engineering
Bicycle modelling in pro engineering
Mafaz Ahmed
 

More from Mafaz Ahmed (20)

A course in fuzzy systems and control by li xin wang solution manual
A course in fuzzy systems and control by li xin wang solution manualA course in fuzzy systems and control by li xin wang solution manual
A course in fuzzy systems and control by li xin wang solution manual
 
INTERACTIVE FLOOR PROJECTION SYSTEM
INTERACTIVE FLOOR PROJECTION  SYSTEMINTERACTIVE FLOOR PROJECTION  SYSTEM
INTERACTIVE FLOOR PROJECTION SYSTEM
 
Series and parallel operation of power devices
Series and parallel operation of power devicesSeries and parallel operation of power devices
Series and parallel operation of power devices
 
Series and parallel connection of igbt
Series and parallel connection of igbtSeries and parallel connection of igbt
Series and parallel connection of igbt
 
Series and parallel connection of mosfet
Series and parallel connection of mosfetSeries and parallel connection of mosfet
Series and parallel connection of mosfet
 
Electronic Instrumentation and Measurement Solution Manual
Electronic Instrumentation and Measurement Solution ManualElectronic Instrumentation and Measurement Solution Manual
Electronic Instrumentation and Measurement Solution Manual
 
Project loon
Project loonProject loon
Project loon
 
Internet of Things
Internet of ThingsInternet of Things
Internet of Things
 
Interoperability among various Generations of Telecom Technologies
Interoperability among various Generations of Telecom TechnologiesInteroperability among various Generations of Telecom Technologies
Interoperability among various Generations of Telecom Technologies
 
Dc motor drive
Dc motor driveDc motor drive
Dc motor drive
 
Energy Crisis, Different Energy Sources and Role of Power Electronics
Energy Crisis, Different Energy Sources and Role of Power ElectronicsEnergy Crisis, Different Energy Sources and Role of Power Electronics
Energy Crisis, Different Energy Sources and Role of Power Electronics
 
RADIO ON RADIO OVER FIBER EFFICIENT FRONTHAULING FOR SMALL CELLS AND MOVING C...
RADIO ON RADIO OVER FIBER EFFICIENT FRONTHAULING FOR SMALL CELLS AND MOVING C...RADIO ON RADIO OVER FIBER EFFICIENT FRONTHAULING FOR SMALL CELLS AND MOVING C...
RADIO ON RADIO OVER FIBER EFFICIENT FRONTHAULING FOR SMALL CELLS AND MOVING C...
 
Temperature Control Fan Using 8051 Microcontroller
Temperature Control Fan Using 8051 MicrocontrollerTemperature Control Fan Using 8051 Microcontroller
Temperature Control Fan Using 8051 Microcontroller
 
Project Management Project
Project Management ProjectProject Management Project
Project Management Project
 
Speed Control of DC Motor
Speed Control of DC MotorSpeed Control of DC Motor
Speed Control of DC Motor
 
Low drift high impedance jfet dc voltmeter
Low drift high impedance jfet dc voltmeterLow drift high impedance jfet dc voltmeter
Low drift high impedance jfet dc voltmeter
 
Real Time Clock Interfacing with FPGA
Real Time Clock Interfacing with FPGAReal Time Clock Interfacing with FPGA
Real Time Clock Interfacing with FPGA
 
Tweety modelling in pro engineering
Tweety modelling in pro engineeringTweety modelling in pro engineering
Tweety modelling in pro engineering
 
Truck modelling in pro engineering
Truck modelling in pro engineeringTruck modelling in pro engineering
Truck modelling in pro engineering
 
Bicycle modelling in pro engineering
Bicycle modelling in pro engineeringBicycle modelling in pro engineering
Bicycle modelling in pro engineering
 

Recently uploaded

ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 

Recently uploaded (20)

ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 

Automatic room light controller with visible counter

  • 1. AVR PROJECT REPORT AUTOMATIC ROOM LIGHT CONTROLLER WITH BIDIRECTIONAL VISITOR COUNTER Submitted by:  Mafaz Ahmed 1882-F12
  • 2. Abstract: This Project “Automatic Room Light Controller with Bidirectional Visitor Counter” is reliable that takes over the task of controlling the room lights as well us counting number of persons/visitors in the room very accurately. When somebody enters into the room then the counter is incremented by one and the light in the room will be switched ON and when any one leaves the room then the counter is decremented by one. The light will be only switched OFF until all the persons in the room go out. The total number of persons inside the room is also displayed on the LCD. Whenever a person enter a room, he or she have to enter a password using a keypad interfaced with the microcontroller. Only those enter the room who know the password. INTRODUCTION: The objective of this project is to make a controller based model to count number of persons visiting particular room and accordingly light up the room. Here we can use sensor and can know present number of persons. In today’s world, there is a continuous need for automatic appliances. With the increase in standard of living, there is a sense of urgency for developing circuits that would ease the complexity of life. Also if at all one wants to know the number of people present in room so as not to have congestion, this circuit proves to be helpful. Block Diagram: A T M E G A 1 6 ENTER SENSOR EXIT SENSOR KEYPAD LCD DOOR RELAY FAN Control LIGHT CONTOL
  • 3. LIST OF COMPONENTS:  Microcontroller – ATMEGA16  Infrared Sensor  Preset – 4.7K  Reset button switch  Diode – IN4148  Transistor – TIP41  LCD 16x2  Keypad  LED’s  IC-LM324 Microcontroller ATMEGA16: An Atmel ATmega16 microcontroller in a 40 pin DIP package. It has 16 KB programmable flash memory, static RAM of 1 KB and EEPROM of 512 Bytes. There are 32 I/O (input/output) lines which are divided into four 8-bit ports designated as PORTA, PORTB, PORTC and PORTD. It has various in-built peripherals like USART, ADC, ATmega16 has various in-built peripherals alternative task related to in-built peripherals.
  • 4. LCD LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segments and other multi segment LEDs. The reasons being: LCDs are economical; easily programmable; have no limitation of displaying special & even custom characters (unlike in seven segments), animations and so on. A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers, namely, Command and Data. The command register stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the cursor position, controlling display etc. The data register stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD. LM324: LM324 is a 14pin IC consisting of four independent operational amplifiers (op-amps) compensated in a single package. Op-amps are high gainelectronic voltage amplifier with differential input and, usually, a single-ended output. The output voltage is many times higher than the voltage difference between input terminals of an op-amp.
  • 5. IR Sensor-: This is the most fundamental type of sensor available in the market. The basic concept is simple. There is an emitter which emits infrared (IR) rays. These IR rays are detected by a detector. This concept is used to make proximity sensor (to check if something obstructs the path or not, etc), contrast sensors (used to detect contrast difference between black and white, like in line follower robots), etc. TIP41: The Bipolar Power Transistor is designed for general purpose power amplifier and switching applications. The TIP41, TIP41A, TIP41B, TIP41C (NPN); and TIP42, TIP42A, TIP42B, TIP42C (PNP) are complementary devices.  Collector-Emitter Saturation Voltage - VCE(sat) = 1.5 V<subdc< sub="" style="font-family: Verdana, Arial, He serif;"> (Max) @ IC = 6.0 Adc</subdc<>  Collector-Emitter Sustaining Voltage -VCEO(sus) = 60 Vdc (min) - TIP41A, TIP42A =80 Vdc (min) - TIP41B, TIP42B =100 Vdc (min) - TIP41C, TIP42C  High Current Gain Bandwidth Product fT = 3 MHz (min) @ IC = 500 mAdc  Compact TO-220 AB Package  These are Pb-Free Packages
  • 6. Circuit: CODE: #define F_CPU 8000000UL // Define the crystal frequency #include <avr/io.h> // Standard header file for input and output functionality #include <util/delay.h> // For delay function #include <avr/interrupt.h>
  • 7. #define LCD_PRT PORTA //LCD DATA PORT #define LCD_DDR DDRA //LCD DATA DDR #define LCD_PIN PINA//LCD DATA PIN #define LCD_RS 0 //LCD RS #define LCD_RW 1 //LCD RW #define LCD_EN 2 //LCD EN //Enable/disable pin for LCD #define KEY_PRT PORTC #define KEY_DDR DDRC #define KEY_PIN PINC char ROW=0, COL=0; char keypad[4][3]= {'1','2','3', '4','5','6', '7','8','9', '*','0','#' }; unsigned char cnt=0; ISR (TIMER2_OVF_vect) {if(cnt==0){OCR2 =255;} if(cnt>=1){OCR2 =191;} if(cnt>=3){OCR2=127;} if(cnt>=5){OCR2=0;} } void lcdcmd(unsigned char cmnd) { // LCD command function LCD_PRT = (LCD_PRT & 0x0F) | (cmnd & 0xF0); LCD_PRT &= ~ (1<<LCD_RS); //RS = 0 for command LCD_PRT &= ~ (1<<LCD_RW) ; //RW = 0 for write LCD_PRT |= (1<<LCD_EN); //EN = 1 for H-to-L _delay_us (50) ; //wait to make EN wider LCD_PRT &= ~ (1<<LCD_EN); //EN = 0 for H-to-L _delay_us(50) ; //wait LCD_PRT = (LCD_PRT & 0x0F) | (cmnd << 4); LCD_PRT |= (1<<LCD_EN); //EN = 1 for H-to-L _delay_us (1) ; //wait to make EN wider LCD_PRT &= ~ (1<<LCD_EN); } //EN = 0 for H-to-L void lcddata(unsigned char data) // LCD Data function { LCD_PRT = (LCD_PRT & 0X0F) | (data & 0XF0); LCD_PRT |= (1<<LCD_RS); //RS = 1 for data LCD_PRT &= ~ (1<<LCD_RW) ; //RW = 0 for write LCD_PRT |= (1<<LCD_EN); //EN = 1 for H-to-L
  • 8. _delay_us(50) ; LCD_PRT &= ~ (1<<LCD_EN) ; LCD_PRT = (LCD_PRT & 0x0F) | (data<<4); LCD_PRT |= (1<<LCD_EN); _delay_us(50); LCD_PRT &= ~ (1<<LCD_EN); } void lcd_init() { LCD_DDR = 0xFF; LCD_PRT &=~(1<<LCD_EN); _delay_us(2000); lcdcmd(0x33); _delay_us (100); lcdcmd(0x32); _delay_us (100); lcdcmd(0x28); _delay_us (100); lcdcmd(0x0E); _delay_us(100); lcdcmd(0x01); _delay_us(2000); lcdcmd(0x06); _delay_us(100); } void lcd_gotoxy (unsigned char x, unsigned char y) { //Table 12-5 unsigned char firstCharAdr[]={0x80,0xC0,0x94,0xD4}; lcdcmd(firstCharAdr[ y-1]+x-1); _delay_us(100) ; } void lcd_string(unsigned char *str) //function to show string on LCD { unsigned char i = 0; while (str[ i] !=0) {lcddata(str[ i] ); i++; } } //look up table for keypad function
  • 9. char key_pad() // key pad function { while(1) { KEY_PRT=0x7E; //MAKE FIRST ROW IN KEYPAD TO ZERO // MAKE ALL COL'S AS HIGH if((KEY_PIN&0x10)==0){while((KEY_PIN&0x10)== 0);ROW=1;COL=1;break;} if((KEY_PIN&0x20)==0){while((KEY_PIN&0x20)== 0);ROW=1;COL=2;break;} if((KEY_PIN&0x40)==0){while((KEY_PIN&0x40)== 0);ROW=1;COL=3;break;} KEY_PRT=0x7D; //MAKE SECOND ROW IN KEYPAD TO ZERO // MAKE ALL COL'S AS HIGH if((KEY_PIN&0x10)==0){while((KEY_PIN&0x10)== 0);ROW=2;COL=1;break;} if((KEY_PIN&0x20)==0){while((KEY_PIN&0x20)== 0);ROW=2;COL=2;break;} if((KEY_PIN&0x40)==0){while((KEY_PIN&0x40)== 0);ROW=2;COL=3;break;} KEY_PRT=0x7B; //MAKE THIRD ROW IN KEYPAD TO ZERO // MAKE ALL COL'S AS HIGH if((KEY_PIN&0x10)==0){while((KEY_PIN&0x10)== 0);ROW=3;COL=1;break;} if((KEY_PIN&0x20)==0){while((KEY_PIN&0x20)== 0);ROW=3;COL=2;break;} if((KEY_PIN&0x40)==0){while((KEY_PIN&0x40)== 0);ROW=3;COL=3;break;} KEY_PRT=0x77; //MAKE 4TH ROW IN KEYPAD TO ZERO // MAKE ALL COL'S AS HIGH if((KEY_PIN&0x10)==0){while((KEY_PIN&0x10)== 0);ROW=4;COL=1;break;} if((KEY_PIN&0x20)==0){while((KEY_PIN&0x20)== 0);ROW=4;COL=2;break;}
  • 10. if((KEY_PIN&0x40)==0){while((KEY_PIN&0x40)== 0);ROW=4;COL=3;break;} } return keypad[ROW-1][COL-1]; } unsigned char ps[]="ENTER PASSWARD"; unsigned char un[]="UNLOCKED"; unsigned char lo[]="LOCKED"; unsigned char wr[]="WRONG PASSWARD"; unsigned char ea[]="ENTER AGAIN"; unsigned char passward[]={'4','6','2','2'}; unsigned char user[4]; unsigned char d; void enter(){lcd_init(); lcd_gotoxy(2,1); lcd_string(ps); lcdcmd(0xC6); for(d=0;d<4;d++) { user[d]=key_pad(); lcddata(user[d]);} _delay_ms(100); if((user[0]==passward[0])&&(user[1]==passward[1])&&(user[2]==passward[2])& &(user[3]==passward[3])) { lcd_init(); lcd_gotoxy(5,1); lcd_string("WELCOME"); PORTB|=(1<<2); while(1){if(PINB & 0x02){cnt++;PORTB&=~(1<<2);if(cnt>0){PORTB|=(1<<3);}_delay_ms(200);bre ak;}}} else {lcd_init(); lcd_gotoxy(3,1); lcd_string(wr); _delay_ms(500);} } void exit() {PORTB|=(1<<2); while(1){if(PINB & 0x01){cnt--; PORTB&=~(1<<2);lcd_init();lcd_gotoxy(5,1);lcd_string("GOOD BY");if(cnt<=0)PORTB&=~(1<<3); _delay_ms(1000);while(PINB & 0x01);break;}
  • 11. } } unsigned char count=0; int main(void) //main function { DDRD |= (1<<7); //PB3 as output OCR2 = 255; TCCR2 = 0x76;; TIMSK |= (1<<TOIE2) ; sei( ); DDRB=0x0C; // PB 0,1 input and PB.2 ,PB.3 KEY_DDR=0x0F; while(1) { lcd_init(); lcd_gotoxy(5,1); lcd_string("Count="); count=cnt&0x0F; count=count|0x30; lcddata(count); while(1){if(PINB & 0x01){enter();break;}if(PINB & 0x02){exit();break;}} //while(1){if(PINB & 0x01){enter();break;}if(PINB & 0x02){exit();break;}} _delay_ms(100); } return 0;}
  • 12. PCB CIRCUIT DESIGN: CONCLUSION: Hereby we come to the end of our project “AUTOMATIC ROOM LIGHT CONTROLLER WITH BIDIRECTIONL VISITOR COUNTER”.  Application of this project  For counting purposes  For automatic room light control
  • 13.  Advantages of this project  Low cost  Easy to use  Implement in single door  Future Expansion  By using this circuit and proper power supply we can implement various applications such as fans, tube lights, etc.  By modifying this circuit and using two relays we can achieve a task of opening and closing the door Reference:  . http://www.engineersgarage.com/electronic-components/lm324n-datasheet  http://www.engineersgarage.com/electronic-components/atmega16- microcontroller