Beruflich Dokumente
Kultur Dokumente
DESIGN
PROJECT REPORT
CAR PARKING SYSTEM USING AURDINO
pg. 1
DEPARTMENT OF
MECHATRONICS
Abstract
Not finding a parking space for you sometimes is indeed a critical issue. An
important appointment might be missed. Time will be wasted and more money
will be spent. Criticism and inconvenience are more likely to happen. So, parking
monitoring is an important solution. It has many practical advantages. It can
arrange the passage of vehicles inside the parking area in addition to avoiding
contention. It can reduce the suffering of sick and disabled people looking for a
parking space. It is a good denote to such part of the society. It is like providing
them with the smile and hope that helps them to overcome their disability. This
project can provide information about the future need to make more parking
spaces, also has many uses such as security issues and data base. The project
consists of four main stages, the first stage is turning the LEDs ON/OFF when the
cars enters or leaves the parking slot respectively. The second main stage is
showing it on the TFT Screen whether the parking is full or empty. The third is
using Wi-Fi Module ESP 8266 we show it on the webpage the no of parking slots
empty/full. And the Last stage is we do data logging using SD card to get the
history of a specific car.
pg. 2
Acknowledgements
This research for the project was partially supported by Sir Omer Farooq. We
thank our colleagues who provided insight and expertise that greatly assisted the
project research, although they may not agree with all of the conclusions of this
project.
We would also like to show our gratitude to the lab engineers and senior class
mates for sharing their pearls of wisdom with us during the course of this project
research. We are also immensely grateful to our families for their comments and
support, although any errors are our own and should not tarnish the reputations
of these esteemed persons.
pg. 3
TABLE OF CONTENTS:
Abstract
Page 2
Acknowledgements
Page 3
pg. 4
2.2: Introduction about Microcontroller
Page: 9
2.3: Arduino Properties, Schematic Diagram
Page: 11
And Power
2.4: Other Materials
Page: 15
Chapter 3 Implementation
4.1: Budget
Page: 45
Chapter 5 Project Schedule
5.1: Schedule
Page: 46
Chapter 6 Conclusion:
6.1: Conclusion.
Page: 46
pg. 5
Reference Page:47
pg. 6
1.2 Project Objectives
Design an efficient parking system to provide statistical information.
Saving peoples time in finding parking lots.
Learn about energy impact on environment and our role as engineers to offer
solutions; saving energy of automobiles which in turns reduces CO2 emissions and
other harmful gases; hence better green environment.
pg. 7
Chapter 2 Microcontroller/ Gathering Materials
pg. 8
It's an open-source physical computing platform based on a simple
microcontroller board, and a development environment for writing software for
the board. Arduino can be used to develop interactive objects, taking inputs from
a variety of switches or sensors, and controlling a variety of lights, motors, and
other physical outputs.
However, there are several types of microcontrollers in the market. The selection
of the microcontroller was based in how common it is in market and availability.
Also, it depended on the size of the program memory, RAM and the clock
frequency (speed), how many I/O it can accommodate as well as interrupts.
pg. 9
Basically, a microcontroller is a device which integrates a number of the
components of a microprocessor system onto a single microchip and optimized to
interact with the outside world through on-board interfaces. So, it is in fact a little
gadget that houses a microprocessor, ROM (Read Only Memory), RAM (Random
Access Memory), I/O (Input Output functions), and various other specialized
circuits all in one package.
Arduino Mega:
The Arduino Mega is a microcontroller board based on
the ATmega1280 (datasheet). It has 54 digital input/output pins (of which 14 can
be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports), a
16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a
reset button. It contains everything needed to support the microcontroller; simply
connect it to a computer with a USB cable or power it with a AC-to-DC adapter or
battery to get started. The Mega is compatible with most shields designed for the
Arduino Duemilanove or Diecimila.
Arduino UNO:
Arduino/Genuino Uno is a microcontroller board based on the ATmega328P
(datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM
outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power
jack, an ICSP header and a reset button. It contains everything needed to support
pg. 10
the microcontroller; simply connect it to a computer with a USB cable or power it
with a AC-to-DC adapter or battery to get started.. You can tinker with your UNO
without worrying too much about doing something wrong, worst case scenario
you can replace the chip for a few dollars and start over again.
"Uno" means one in Italian and was chosen to mark the release of Arduino
Software (IDE) 1.0. The Uno board and version 1.0 of Arduino Software (IDE) were
the reference versions of Arduino, now evolved to newer releases. The Uno board
is the first in a series of USB Arduino boards, and the reference model for the
Arduino platform; for an extensive list of current, past or outdated boards see the
Arduino index of boards.
pg. 11
Clock Speed 16 MHz
VIN. The input voltage to the Arduino board when it's using an external
power source (as opposed to 5 volts from the USB connection or other regulated
power source). You can supply voltage through this pin, or, if supplying voltage via
the power jack, access it through this pin.
5V. The regulated power supply used to power the microcontroller and
other components on the board. This can come either from VIN via an on-board
regulator, or be supplied by USB or another regulated 5V supply.
3V3. A 3.3 volt supply generated by the on-board FTDI chip. Maximum
current draw is 50 mA.
Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX) and
16 (TX); Serial 3: 15 (RX) and 14 (TX). Used to receive (RX) and transmit (TX) TTL
serial data. Pins 0 and 1 are also connected to the corresponding pins of the FTDI
USB-to-TTL Serial chip.
pg. 12
PWM: 2 to 13 and 44 to 46. Provide 8-bit PWM output with
the analogWrite() function.
LED: 13. There is a built-in LED connected to digital pin 13. When the pin is
HIGH value, the LED is on, when the pin is LOW, it's off.
I2C: 20 (SDA) and 21 (SCL). Support I2C (TWI) communication using the Wire
library (documentation on the Wiring website). Note that these pins are not in the
same location as the I2C pins on the Duemilanove or Diecimila.
The Mega has 16 analog inputs, each of which provide 10 bits of resolution (i.e.
1024 different values). By default they measure from ground to 5 volts, though is
it possible to change the upper end of their range using the AREF pin and
analogReference() function.
AREF. Reference voltage for the analog inputs. Used with analogReference().
Reset. Bring this line LOW to reset the microcontroller. Typically used to add
a reset button to shields which block the one on the board.
pg. 13
Schematic
pg. 14
Vin. The input voltage to the Arduino/Genuino board when it's using an
external power source (as opposed to 5 volts from the USB connection or other
regulated power source). You can supply voltage through this pin, or, if supplying
voltage via the power jack, access it through this pin.
5V.This pin outputs a regulated 5V from the regulator on the board. The
board can be supplied with power either from the DC power jack (7 - 12V), the
USB connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via the
5V or 3.3V pins bypasses the regulator, and can damage your board. We don't
advise it.
pg. 15
Schematic
TFT Screen
pg. 16
TFT LCDs are also used in car instrument clusters because they allow the driver to
customize the cluster, as well as being able to provide a skeuomorphic, analog-like
display with digital elements.
The ESP8266 Wi-Fi Module is a self-contained SOC with integrated TCP/IP protocol
stack that can give any microcontroller access to your Wi-Fi network. The ESP8266
is capable of either hosting an application or offloading all Wi-Fi networking
functions from another application processor. Each ESP8266 module comes pre-
programmed with an AT command set firmware, meaning, you can simply hook
this up to your Arduino device and get about as much Wi-Fi-ability as a Wi-Fi
Shield offers (and thats just out of the box)! The ESP8266 module is an extremely
cost effective board with a huge, and ever growing, community.
This module has a powerful enough on-board processing and storage capability
that allows it to be integrated with the sensors and other application specific
devices through its GPIOs with minimal development up-front and minimal
loading during runtime. Its high degree of on-chip integration allows for minimal
external circuitry, including the front-end module, is designed to occupy minimal
PCB area. The ESP8266 supports APSD for VoIP applications and Bluetooth co-
existence interfaces, it contains a self-calibrated RF allowing it to work under all
operating conditions, and requires no external RF parts.
Features:
pg. 17
802.11 b/g/n
Hardware Connections
pg. 18
The hardware connections required to connect to the ESP8266 module are fairly
straight-forward but there are a couple of important items to note related to
power:
Ultrasonic Sensor
pg. 19
An Ultrasonic sensor is a device that can measure the distance to an object by
using sound waves. It measures distance by sending out a sound wave at a specific
frequency and listening for that sound wave to bounce back. By recording the
elapsed time between the sound wave being generated and the sound wave
bouncing back, it is possible to calculate the distance between the sonar sensor
and the object.
pg. 20
sensor; it includes the 'trip' from the sonar sensor to the object AND the 'trip'
from the object to the Ultrasonic sensor (after the sound wave bounced off the
object).
The MQ-2 smoke sensor is sensitive to smoke and to the following flammable
gases:
LPG
Butane
Propane
Methane
Alcohol
Hydrogen
The resistance of the sensor is different depending on the type of the gas.
The smoke sensor has a built-in potentiometer that allows you to adjust the
sensor sensitivity according to how accurate you want to detect gas.
MQ-2 sensor
pg. 21
Sensor Pin-out details
JUMPER WIRES
Jumper wires are used for making connections between items on your breadboard
and your Arduinos header pins.
There are three types of jumper wires:
Male to Male.
Male to Female.
Female to Female.
pg. 22
Stepper Motor
pg. 23
A stepper motor or step motor or stepping motor is a brushless DC electric
motor that divides a full rotation into a number of equal steps. The motor's
position can then be commanded to move and hold at one of these steps without
any feedback sensor (an open-loop controller), as long as the motor is carefully
sized to the application in respect to torque and speed.
Switched reluctance motors are very large stepping motors with a reduced pole
count, and generally are closed-loop commutated.
BREADBOARD
A breadboard is a construction base for prototyping of electronics. In the 1970s
the solderless breadboard (AKA plug board, a terminal array board) became
available. Because the solderless breadboard does not require soldering, it is
reusable. This makes it easy to use for creating temporary prototypes and
experimenting with circuit design. For this reason, solderless breadboards are
also extremely popular with students and in technological education .
pg. 24
Buzzers
A buzzer or beeper is an audio signaling device,[1] which may
be mechanical, electromechanical, or piezoelectric. Typical uses of buzzers and
beepers include alarm devices, timers, and confirmation of user input such as a
mouse click or keystroke. Piezo buzzer is an electronic device commonly used to
produce sound. Light weight, simple construction and low price make it usable in
various applications like car/truck reversing indicator, computers, call bells etc.
Piezo buzzer is based on the inverse principle of piezo electricity discovered in
1880 by Jacques and Pierre Curie. It is the phenomena of generating electricity
when mechanical pressure is applied to certain materials and the vice versa is also
true. Such materials are called piezo electric materials. Piezo electric materials are
either naturally available or manmade. Piezo ceramic is class of manmade
material, which poses piezo electric effect and is widely used to make disc, the
heart of piezo buzzer. When subjected to an alternating electric field they stretch
or compress, in accordance with the frequency of the signal thereby producing
sound.
pg. 25
SD CARD MODULE
The Arduino SD Card Shield is a simple solution for transferring data to and
from a standard SD card. The pinout is directly compatible with Arduino, but
can also be used with other microcontrollers. It allows you to add mass storage
and data logging to your project.
pg. 26
pg. 27
CHAPTR 3: IMPLEMENATION
RELAY MODULE
MQ 2 Smoke Sensor
Wi-Fi Module
SD CARD MODULE
ESP8266
pg. 28
3.2 Flow charts / Codes
For Servo Motor/ SSD Display
Code:
/*ParkingL02.pde
*/
#include <Servo.h>
#define segA 0
#define segB 1
#define segC 2
#define segD 3
#define segE 4
#define segF 5
pg. 29
#define segG 6
byte segments[10] = {
B00111111, // number 0
B00000110, // number 1
B01011011, // number 2
B01001111, // number 3
B01100110, // number 4
B01101101, // number 5
B01111101, // number 6
B00000111, // number 7
B01111111, // number 8
B01101111 // number 9
};
void setup(){
pinMode(segA,OUTPUT);
pinMode(segB,OUTPUT);
pinMode(segC,OUTPUT);
pinMode(segD,OUTPUT);
pinMode(segE,OUTPUT);
pg. 30
pinMode(segF,OUTPUT);
pinMode(segG,OUTPUT);
pinMode(Bright,OUTPUT);
analogWrite(Bright,255*INTEN/100);
// delay(1000);
//================================================================
void loop(){
Display(Available);
if(digitalRead(In)==0)
if(Available != 0){
Available--;
myservo.write(BarUp);
delay(3500);
myservo.write(BarLow);
if(digitalRead(Exit)==0)
if(Available != CAPACITY){
Available++;
myservo.write(BarUp);
delay(3500);
myservo.write(BarLow);
pg. 31
}
/*-------------------------------------------------------------------
--------------------------------------------------------------------*/
digitalWrite(segA, bitRead(segs, 0) );
digitalWrite(segB, bitRead(segs, 1) );
digitalWrite(segC, bitRead(segs, 2) );
digitalWrite(segD, bitRead(segs, 3) );
digitalWrite(segE, bitRead(segs, 4) );
digitalWrite(segF, bitRead(segs, 5) );
digitalWrite(segG, bitRead(segs, 6) );
pg. 32
Flowchart
START
YES
Does SSD Car Cannot Enter
shows 5
number
NO
Car Enters
Car Parkes
pg. 33
For Car Parking System
Code:
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9340.h"
#if defined(__SAM3X8E__)
#undef __FlashStringHelper::F(string_literal)
#endif
// for Due/Mega/Leonardo use the hardware SPI pins (which are different)
#define _sclk 24
#define _miso 22
#define _mosi 26
#define _cs 32
#define _dc 28
#define _rst 30
#define ledB1 40
#define ledR1 41
#define ledB2 42
#define ledR2 43
pg. 34
// defines pins numbers
#define IN4 4
// defines variables
long duration;
int distance = 0;
int distance1= 0;
void setup() {
pinMode(4, OUTPUT);
pinMode(ledB1, OUTPUT);
pinMode(ledR1, OUTPUT);
pinMode(ledB2, OUTPUT);
pinMode(ledR2, OUTPUT);
tft.begin();
Serial.begin(9600);
pg. 35
//Serial.print(F("Screen fill "));
// Serial.println(testFillScreen());
delay(50);
void loop() {
//testText();
tft.fillScreen(ILI9340_BLACK);
tft.setCursor(0, 0);
tft.println();
tft.setTextColor(ILI9340_GREEN);
//tft.setTextSize(3);
//tft.println("TEST COMPLETE");
tft.setTextSize(2);
tft.println();
tft.setTextSize(3);
tft.println("Distance=");
tft.setTextSize(1);
tft.println();
tft.setTextSize(3);
tft.println(distance);
tft.setTextSize(3);
tft.println("parking Empty");
digitalWrite(ledB1, HIGH);
digitalWrite(ledR1,LOW);
pg. 36
else if(distance <20 )//&&(distance < 150))
tft.setTextSize(3);
tft.println("parking full");
digitalWrite(ledB1, LOW);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
distance= duration*0.034/2;
Serial.print("Distance: ");
tft.setTextSize(2);
tft.println("");
tft.setTextSize(3);
tft.println("Distance=");
tft.setTextSize(3);
tft.println(distance1);
pg. 37
if (distance1 >20)//&&(distance > 0))
tft.setTextSize(3);
tft.println("parking Empty");
digitalWrite(ledB2, HIGH);
digitalWrite(ledR2,LOW);
tft.setTextSize(3);
tft.println("parking full");
digitalWrite(ledB2, LOW);
delayMicroseconds(10);
digitalWrite(trigPin1, LOW);
delayMicroseconds(2);
digitalWrite(trigPin1, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin1, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
pg. 38
// Calculating the distance
distance1= duration*0.034/2;
Serial.print("Distance: ");
delay(500);
tft.fillScreen(ILI9340_GREEN):}
Flowchart
START
YES
Distance > Car Parking is Empty
20?
GREEN LED ON
NO
pg. 39
Code for Wi-Fi Module ESP 8266
#include <SoftwareSerial.h>
//SoftwareSerial Serial1(2,3); // make RX Arduino line is pin 2, make TX Arduino line is pin 3.
// This means that you need to connect the TX line from the esp to the
Arduino's pin 2
// and the RX line from the esp to the Arduino's pin 3
void setup()
{
Serial.begin(115200);
Serial1.begin(115200); // your esp's baud rate might be different
Serial.print("test");
void loop()
{
pg. 40
if(Serial1.available()) // check if the esp is sending a message
{
Serial.print("test");
while(Serial1.available())
{
// The esp has data so display its output to the serial window
char c = Serial1.read(); // read the next character.
Serial.write(c);
}
if(Serial1.find("+IPD,"))
{
delay(1000);
sendData(cipSend,1000,DEBUG);
pg. 41
sendData(webpage,1000,DEBUG);
webpage="<button>LED2</button>";
cipSend = "AT+CIPSEND=";
cipSend += connectionId;
cipSend += ",";
cipSend +=webpage.length();
cipSend +="\r\n";
sendData(cipSend,1000,DEBUG);
sendData(webpage,1000,DEBUG);
sendData(closeCommand,3000,DEBUG);
}
}
}
pg. 42
Serial.print(command);
long int time = millis();
// The esp has data so display its output to the serial window
char c = Serial1.read(); // read the next character.
response+=c;
Serial.print(response);
}
}
if(debug)
{
Serial.print(response);
}
return response;
}
pg. 43
#include <SPI.h>
#include <DS3231.h>
File myFile;
void setup() {
Serial.begin(9600);
pinMode(pinCS, OUTPUT);
// SD Card Initialization
if (SD.begin())
} else
return;
rtc.begin();
void loop() {
Serial.print(rtc.getTimeStr());
Serial.print(",");
Serial.println(int(rtc.getTemp()));
if (myFile) {
myFile.print(rtc.getTimeStr());
myFile.print(",");
pg. 44
myFile.println(int(rtc.getTemp()));
else {
delay(3000);
Oscilloscope Readings
pg. 45
Data Logging for SD Card Module
#include <SD.h>
#include <SPI.h>
File myFile;
void setup() {
Serial.begin(9600);
pinMode(pinCS, OUTPUT);
// SD Card Initialization
if (SD.begin())
} else
return;
pg. 46
// Create/Open file
if (myFile) {
Serial.println("Writing to file...");
// Write to file
Serial.println("Done.");
else {
myFile = SD.open("test.txt");
if (myFile) {
Serial.println("Read:");
while (myFile.available()) {
Serial.write(myFile.read());
myFile.close();
else {
pg. 47
}
void loop() {
// empty
3.4 Simulation
Proteus for Arduino MEGA
pg. 48
Proteus for Arduino UNO:
pg. 49
Chapter 4: Project Budget
Materials Costs
4) Breadboard RS 300
pg. 50
Chapter 5: Project Schedule
Chapter 6: Conclusion
The line following robot project challenged the group to cooperate, communicate,
and expand understanding of electronics, mechanical systems, and their integration
with programming. The successful completion of every task demonstrated the
potential of mechatronics systems and a positive group dynamic. Smarter versions
of line followers are used to deliver mails within office building and deliver
medications in a hospital. This technology has been suggested for running buses
and other mass transit systems and may end up as a part of autonomous cars
navigating the freeway. It will be very helpful to solve problem for parking system
in Pakistan.
pg. 51
References
https://www.youtube.com/watch?v=ONaXuAc1Lm4
http://www.instructables.com/id/Arduino-Parking-Sensor/
https://arduining.com/2012/10/13/arduino-parking-lot-filled/
http://www.instructables.com/id/Distance-Sensor-with-LEDs-and-buzzer/
https://create.arduino.cc/projecthub/nolan-mathews/connect-to-blynk-using-esp8266-as-arduino-uno-
wifi-shield-m1-46a453
https://create.arduino.cc/projecthub/KaustubhAgarwal/smart-parking-bdfa99
http://www.whatimade.today/esp8266-easiest-way-to-program-so-far/
http://download.arduino.org/products/UNOWIFI/0A-ESP8266-Datasheet-EN-v4.3.pdf
pg. 52