0% found this document useful (0 votes)
13 views6 pages

Embedded C Programming Submission 1

The Smart Parking System using Raspberry Pi Pico automates the detection and management of parking slots in real-time through the integration of ultrasonic and infrared sensors, a servo motor, a buzzer, and an LCD display. This low-cost and scalable solution enhances parking convenience while reducing human effort, making it suitable for urban environments. The project also aligns with several Sustainable Development Goals by promoting efficient urban mobility and encouraging innovation in embedded systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views6 pages

Embedded C Programming Submission 1

The Smart Parking System using Raspberry Pi Pico automates the detection and management of parking slots in real-time through the integration of ultrasonic and infrared sensors, a servo motor, a buzzer, and an LCD display. This low-cost and scalable solution enhances parking convenience while reducing human effort, making it suitable for urban environments. The project also aligns with several Sustainable Development Goals by promoting efficient urban mobility and encouraging innovation in embedded systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Raspberry Pi Pico aims to automate the detection,

Smart Parking System Using Raspberry monitoring, and management of parking slots in
Pi Pico real-time.

Team Members: This system integrates ultrasonic and infrared


Sheik Hussain Beevi(22BEC0956) sensors for vehicle detection, a servo motor for gate
Ramya (22BML0098) automation, a buzzer for alerts, and an LCD display
via I2C for live status. The project utilizes the
Raspberry Pi Pico and the Thonny IDE for code
development and microcontroller interfacing. This
solution enhances parking convenience while
Abstract reducing human effort.

Smart parking systems are intelligent infrastructures


that optimize the use of urban space and simplify the
process of locating and accessing parking. This
project proposes a low-cost, scalable smart parking II. Objectives
system using Raspberry Pi Pico and MicroPython.
The system automates slot detection using ultrasonic ● Automate parking space management using
sensors, monitors car entry and exit through IR IoT and microcontrollers.
sensors, controls a servo-operated entry gate, and ● Detects vehicle presence using ultrasonic
displays slot availability on an I2C LCD. A buzzer and IR sensors.
provides real-time auditory alerts, and Morse code is ● Control entry and exit barriers with a servo
used to alert users when the lot is full. Code motor.
development was carried out using the Thonny IDE, ● Display live status using an I2C LCD
with live testing of slot status, gate movement, and module.
display output. This implementation demonstrates a ● Notify users via buzzer alerts.
robust embedded IoT solution for real-world smart ● Develop and compile code using Thonny
parking challenges. IDE.

Keywords - Raspberry Pi Pico, Smart Parking,


Ultrasonic Sensor, I2C LCD, Servo Motor, IR
Sensor, Buzzer, MicroPython, Thonny IDE III. Components Required
A. Hardware Components

● Raspberry Pi Pico: Central processing unit.


● 3 x Ultrasonic Sensors (HC-SR04): For
I. Introduction slot-based vehicle detection.
● 2 x Infrared (IR) Sensors: For entry/exit
The growing number of vehicles in urban and detection.
semi-urban environments has significantly ● 1 x Servo Motor: Gate barrier control.
intensified the challenge of finding parking spaces, ● 1 x I2C LCD Module (16x2): Displays
leading to time wastage, increased fuel consumption, parking status.
and traffic congestion. Manual parking systems often ● 1 x Buzzer: For audible alerts.
prove inefficient, particularly in high-density zones. ● Jumper Wires: For connections.
To address this, the Smart Parking System using ● Breadboard: For prototyping.
● Power Supply (5V): For the Pico and
components.
B. Software Tools ○ TRIG & ECHO connected to GPIO
pins on the Pico
● Thonny IDE: Python-based IDE for writing ● IR Sensors:
and uploading code to Raspberry Pi Pico. ○ OUT pins connected to GPIO for
● MicroPython: Firmware for Raspberry Pi vehicle detection
Pico. ● Servo Motor:
○ PWM pin connected to a GPIO
capable of PWM
● I2C LCD Display:
○ SDA → GP0, SCL → GP1 (via
IV. System Architecture I2C)
● Buzzer:
A. Hardware Flow ○ Connected via GPIO with ground
● Common Ground and 5V across all
The ultrasonic sensors are mounted above parking
components via breadboard
slots to monitor the distance to the vehicle. IR
sensors detect whether a vehicle has entered or
exited the lot. A Raspberry Pi Pico handles all the
sensor inputs and updates the I2C LCD display
accordingly. A buzzer is triggered when the lot is
full, and a servo motor controls the barrier gate
based on entry conditions.

B. System Block Diagram

VI. Working Principle


A. Vehicle Detection

● Ultrasonic Sensors continuously check the


distance above each slot.
● If the measured distance is below a
threshold (e.g., 10 cm), the slot is marked
occupied.
● IR Sensors detect car movement for
entry/exit.

B. Display and Alerts

● The I2C LCD displays available and


V. Circuit Diagram occupied slot counts.
● A buzzer sounds when all slots are full.
● Ultrasonic Sensors:
C. Barrier Gate Control wiring was done using jumper cables. Code was
developed and uploaded using Thonny IDE in
● When the IR sensor detects a car and there is MicroPython.
availability, the servo motor rotates to open
the gate.
● Once the car enters, the servo motor reverts
to a closed position.
IX. Code
from machine import Pin, PWM, I2C,
time_pulse_us
VII. Flowchart from i2c_lcd import I2cLcd
import time

i2c = I2C(0, scl=Pin(1), sda=Pin(0), freq=400000)


lcd = I2cLcd(i2c, 0x27, 2, 16)

sensors = [
{"trig": Pin(27, [Link]), "echo": Pin(26,
[Link])},
{"trig": Pin(21, [Link]), "echo": Pin(20,
[Link])},
{"trig": Pin(17, [Link]), "echo": Pin(16,
[Link])}
]

ir_entry = Pin(9, [Link])


ir_exit = Pin(15, [Link])

entry_servo = PWM(Pin(14))
entry_servo.freq(50)

buzzer = Pin(18, [Link])

gate_open = False
car_waiting = False

def stop_servo():
entry_servo.duty_u16(4915)

def rotate_servo():
VIII. Experimental Setup entry_servo.duty_u16(7000)

The prototype was implemented using a breadboard morse_code = {"F": "..-."}


circuit with Raspberry Pi Pico at its core. Three
ultrasonic sensors were positioned over mock def beep_morse(letter):
parking slots. IR sensors were placed at entry/exit code = morse_code.get([Link]())
points. A servo motor was used to simulate a gate if not code:
barrier. An I2C LCD showed real-time data, and all print(f"No Morse code defined for: {letter}")
return
for symbol in code: [Link]("Parking Full" if parkingAvailable ==
if symbol == ".": 0 else "Slots Left: " + str(parkingAvailable))
[Link](1) lcd.move_to(0, 1)
[Link](0.2)
elif symbol == "-": free_slots = [str(i + 1) for i, d in
[Link](1) enumerate(slot_distances) if d > 10]
[Link](0.6)
[Link](0) if len(free_slots) == 3:
[Link](0.2) [Link]("Slot 1 2 3 Free")
elif len(free_slots) == 2:
def beep_full_morse(): [Link]("Slot " + " & ".join(free_slots) + "
for _ in range(3): Free")
beep_morse("F") elif len(free_slots) == 1:
[Link](0.4) [Link]("Slot " + free_slots[0] + " Free")
elif len(free_slots) == 0 and all(d <= 10 for d in
def read_distance(trig, echo): slot_distances):
[Link]() [Link]("All Full")
time.sleep_us(2) else:
[Link]() [Link]("Check Sensors")
time.sleep_us(10)
[Link]() [Link](0.5)turn 999
duration = time_pulse_us(echo, 1, 30000) return
if duration <= 0:
re round((duration * 0.0343) / 2, 2)

while True:
X. Results and Discussion
slot_distances = [read_distance(s["trig"],
s["echo"]) for s in sensors]
The system effectively detected slot occupancy,
parkingAvailable = sum(1 for d in
controlled the entry gate, and displayed status
slot_distances if d > 10)
updates on the LCD. Key observations:

if ir_entry.value() == 0 and not gate_open: ● Accurate slot detection using ultrasonic


if parkingAvailable > 0: sensors with ±1.5 cm precision
rotate_servo() ● Smooth gate opening using servo motor
gate_open = True ● Clear, real-time feedback via I2C LCD
car_waiting = True ● IR sensors accurately tracked vehicle
else: entry/exit
beep_full_morse() ● Audible buzzer alerts when slots were full

if gate_open and car_waiting and ir_exit.value() Limitations include outdoor weatherproofing and
== 0: real-time clock integration for logging. Future
stop_servo() versions can improve scalability and cloud
gate_open = False integration.
car_waiting = False

[Link]()
lcd.move_to(0, 0)
XI. SDG Mapping ● Relevance: Reduced vehicle idling and
smoother traffic flow help lower emissions.
Mapping the Smart Parking System Using Raspberry ● Contribution: Provides a practical example
Pi Pico to Sustainable Development Goals (SDGs): of how embedded systems can help mitigate
the effects of climate change.
The smart parking system contributes to several
United Nations Sustainable Development Goals Future Enhancements & Expanded SDG
(SDGs) by addressing smart infrastructure, urban Alignment
sustainability, climate action, and educational
empowerment. The detailed mapping is as follows: 1. Cloud Connectivity (SDG 9): Integrating
cloud databases could improve
SDG 4: Quality Education decision-making through long-term parking
trend analysis.
● Relevance: The project fosters hands-on 2. Mobile Application (SDG 11): Allowing
learning in areas such as embedded systems, remote slot booking would increase
programming, and IoT. accessibility and user convenience.
● Contribution: Encourages innovation and 3. Solar Power Integration (SDG 13): Using
technical skill-building among students renewable energy sources can enhance
through a real-world application project. environmental sustainability.
4. RFID Integration (SDG 12): Encourages
SDG 9: Industry, Innovation, and Infrastructure responsible access and monitoring,
minimizing unnecessary usage.
● Relevance: Utilizes cost-effective
microcontrollers (Raspberry Pi Pico) and Conclusion:
scalable IoT technologies. The project supports SDGs 4, 9, 11, 12, and 13 by
● Contribution: Promotes affordable, blending cost-effective embedded technologies with
modular smart infrastructure that can be smart urban infrastructure. It provides a scalable
deployed in both urban and developing model for future-ready, sustainable city planning.
regions.

SDG 11: Sustainable Cities and Communities

● Relevance: Improves urban mobility by


reducing the time and fuel spent in locating
parking spaces. XII. Advantages
● Contribution: Supports traffic decongestion
and enhances the livability of cities through ● Compact and Microcontroller-Based:
intelligent automation. Uses Raspberry Pi Pico for low-cost,
efficient processing
SDG 12: Responsible Consumption and ● Accurate Sensing: Combines ultrasonic and
Production IR sensors for detection
● User Feedback: Real-time LCD and buzzer
● Relevance: Employs energy-efficient alerts
components and reduces manual resource ● Expandable: Suitable for small to mid-size
usage. lots
● Contribution: Encourages efficient use of ● Educational Value: Demonstrates
energy and public space with minimal real-world use of embedded systems
environmental impact.

SDG 13: Climate Action


and Engineering, VIT. Their support in reviewing
XIII. Future Enhancements
system design, debugging hardware setups, and
● Integrate RFID or license plate scanning guiding the implementation process was
for security instrumental to the success of this project. We also
thank the lab instructors for providing access to
● Develop a mobile app with slot reservation
components and infrastructure.
● Add cloud database to track historical
usage
● Implement solar power for outdoor setups
● Add camera vision for vehicle classification

XIV. Conclusion References


This Smart Parking System using Raspberry Pi Pico [1] Raspberry Pi Pico Datasheet
demonstrates a practical and scalable solution for [2] HC-SR04 Sensor Documentation
automated parking space management. It blends [3] Thonny IDE Official Website
basic electronic components with embedded coding [4] MicroPython Documentation
using Thonny IDE to create a fully functional and [5] I2C LCD Module Integration Guides
interactive system. The modular design makes it [6] Servo Motor PWM Control with MicroPython
ideal for academic, commercial, and urban
deployments.

Hardware Working Model Demo


[Link]

You might also like