Professional Documents
Culture Documents
Ahmedabad University
Group No:7
Harsh Shah(201501096)
Meet Patel(201501074)
Motivation
Whenever we visit any place with our family in our favourite car and
when we go to park it, it always becomes cumbersome to find empty
slot to park our car. It becomes difficult to park and manage to drive
our car in such congested area. Instead of this if we have an
automated system which shows that which parking slots are empty
at the entry of a parking place then the problem gets solved. Bingo
!!!
Description
We are going to use Infra Red transmitters and Receivers for each
parking slot. The IR Receivers are connected to AVR microcontroller.
IR rays are obstructed when a car is parked in any parking slot. Thus
AVR will come to know that which slot is empty and which slot is
full.We have two types of gate: Entry gate and Exit gate also system
uses IR sensors to detect vehicles arriving at parking gates to open
the gates automatically on vehicle arrival.The microcontroller is used
to facilitate the working of the entire system.
Outcome
Our system consists of an LCD display that is used to demonstrate as
a parking gate entrance display.
The LCD display displays empty slots to new car arriving at gate of
parking area. If no parking space is available the system does not
open the gate and displays parking full.
If slot is empty system allows car to enter the lot and displays empty
slots where user can park.
Block Diagram
DC
Motor 1
IR Sensors
DC
Motor 2
Components needed
Atmega32 Microcontroller
LCD Display
IR Sensors
Motors
Transformer
Resistors
Capacitors
Diodes
int main()
{
return 0;
}
Description:
_delay_us(200);
_delay_us(200);
with xy position */
{
if (row == 0 && pos<16)
LCD_Command((pos & 0x0F)|0x80);
/* Command of first row
required position<16 */
LCD_String(str);
/* Call LCD string function */
}
void LCD_Clear()
{
LCD_Command (0x01);
/* clear display */
LCD_Command (0x80);
/* cursor at home position */
}
int main()
{
LCD_Init();
/* initialization of LCD*/
LCD_String("Empty Slots"); /*
write string on 1st line of LCD*/
LCD_Command(0xc0);
/*go to 2nd line*/
LCD_String("No Empty Slots");
/*write string on 2nd line*/
DDRD=0xFF;
PORTD=0xFF;
return 0;
}
Interfacing circuit
3. DC Motor interfacing with ATMega16
Motor Specification
We have used 12V DC Motor and its speed is 60 rpm.
This motor is used to open and close the entrance
gate of parking .If there are empty slots then motor
will turn on and open the gate.
We have used L293D motor driver to control the
motor.
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRC = 0xFF; //PORTC as Output
while(1)
{
//Rotates Motor in Antilockwise
PORTC = 0x01; //00000001
delay_ms(6000);
//Stops Motor
PORTC = 0x00; //00000000
delay_ms(6000);
//Stops Motor
PORTC = 0x03; //00000011
delay_ms(6000);
}
}
START
Car is at
Entry gate
Any Empty
slot
detected
TRUE FALSE
Do not turn on
Rotate motor in
anticlockwise and motor and display
Display Empty Slots “No Empty Slots” in
in LCD Display LCD Display.
If car is TRUE
not Rotate Motor in
detected clockwise direction
STOP
Final Working Code Of Project
#include <avr/io.h>
#include <avr/interrupt.h>
/* Include AVR std. library file */
#include <util/delay.h>
/* Include inbuilt defined Delay header file */
#define EN PA1
/* Define Enable signal pin */
void controlGate() {
//Stops Motor
while((PIND & 0x04) == 4 )
PORTC = 0x00; //00000000
//Stops Motor
PORTC = 0x03; //00000011
int checkEmptySlots() {
return ret;
}
/* Enable pulse */
LCD_Port |= (1<<EN);
_delay_us(1);
LCD_Port &= ~ (1<<EN);
_delay_us(200);
LCD_Port |= (1<<EN);
_delay_us(1);
LCD_Port &= ~ (1<<EN);
_delay_ms(2);
}
_delay_us(200);
// sending lower nibble
LCD_Port = (LCD_Port & 0x0F) | (data << 4);
LCD_Port |= (1<<EN);
_delay_us(1);
LCD_Port &= ~ (1<<EN);
_delay_ms(2);
}
void LCD_Clear()
{
/* clear display */
LCD_Command (0x01);
void displayMessage()
{
if( !checkEmptySlots() )
{
LCD_Init();
char a[16]={' ', ' ',' ',' ',' ',' ',' ',' ',' ', ' ','
',' ',' ',' ',' ',' '};
int i;
int index=0;
}
}
void displayDefaultMessage() {
LCD_Init();
/* write string on 1st line of LCD*/
LCD_String("Welcome to");
/*go to 2nd line*/
LCD_Command(0xc0);
}
void init_interrupts()
{
ISR (INT0_vect)
{
LCD_Init();
LCD_String("Checking");
LCD_Command(0xc0);
LCD_String("Empty Slots..");
_delay_ms(2000);
displayMessage();
if(checkEmptySlots())
controlGate();
GIFR = (1 << INTF0);
}
int main(void)
{
DDRC = 0xFF; //PORTB as Output
DDRB = 0x00; //PORTB as Output
LCD_Init(); /*
/*initialization of LCD*/
DDRD=0x00;
PORTD=0x00;
init_interrupts();
while(1)
{
displayDefaultMessage();
_delay_ms(2000);
LCD_Init();
}
return 0;
}