Arduino IR + LCD + Proteus8
Smart parking systems are innovative solutions that use sensors and microcontrollers to detect and display parking availability. This article explains how to build a basic smart parking system using Arduino, sensors, and an LCD display.
Components Used
- Arduino Microcontroller: Serves as the brain of the system.
- LCD Display (16x2): Displays the parking space statuses.
- LED Indicator: Lights up if all parking spaces are occupied.
- Two Digital Sensors: Detect whether parking spaces P1 and P2 are occupied or free.
- Wires and Resistors: For connections.
Hardware Connections
- LCD Connection: The
LiquidCrystallibrary initializes an LCD object connected to digital pins2-12. Each pin serves a specific purpose, such as data or control signals. - LED Pin: Connected to pin
13for visual alerts when parking spaces are full. - Sensors: Connected to pins
6and0. Each sensor reads the state of a parking spot (HIGHfor occupied,LOWfor free).
Understanding the Code
Libraries and Variables
#include <Wire.h>and#include <LiquidCrystal.h>: Libraries for I2C communication and LCD control.- Variables
p1andp2: Represent the pins connected to parking sensors. THRESHOLD: Placeholder for possible future extensions, e.g., temperature monitoring.
Setup Phase
The setup() function configures:
- Pin Modes:
pinMode(13, OUTPUT): Sets the LED as an output.pinMode(p1, INPUT)andpinMode(p2, INPUT): Configure parking sensors as inputs.
- LCD Initialization: Activates the LCD with a 16x2 configuration.
- Serial Communication: Initializes the serial monitor for debugging.
Main Logic in loop()
- Read Sensor States:
pl1 = digitalRead(p1): Reads the state of parking spot 1.pl2 = digitalRead(p2): Reads the state of parking spot 2.
- Update LCD:
- Displays "Free" if the sensor reads
LOW. - Displays "Full" if the sensor reads
HIGH.
- Displays "Free" if the sensor reads
- LED Control:
- If both spots are occupied (
pl1 * pl2 == 1), the LED lights up. Otherwise, it remains off.
- If both spots are occupied (
- Delay:
- Introduces a 500ms delay to avoid flickering.
Key Features of the System
- Real-Time Updates:
- LCD displays the status of parking spots in real-time.
- Alert System:
- An LED warns when both parking spaces are occupied.
- Efficient Logic:
- Uses simple conditional checks to toggle display and LED.
How It Works
- Initial State: The system starts by initializing the LCD and sensors.
- Parking Spot Status:
- Sensors connected to
p1andp2detect vehicles in the respective parking spots. - The LCD displays "P1 Free" or "P1 Full" for parking spot 1, and similarly for parking spot 2.
- Sensors connected to
- LED Alert:
- Lights up when both parking spots are occupied.
Future Enhancements
- Add More Sensors: To accommodate additional parking spaces.
- Remote Monitoring: Use Wi-Fi or Bluetooth to transmit parking status to a smartphone app.
- Expand Display: Show additional information such as the number of free spots.
By understanding and implementing this code, you can create a basic yet effective smart parking system. This project is a great starting point for learning about microcontrollers and embedded systems.
You may also like
EmbedLab Team
Embedded systems engineer and educator. Writes weekly tutorials at EmbedLab to help beginners ship real hardware.
Related projects
Arduino and shift register
Project Description This Arduino project with code is a smart parking status display system designed to monitor and show the availability of parking spots in real-time. It leverages a 74HC165 s
Arduino traffic lights
This project implements a traffic light system with a countdown timer , designed using an Arduino microcontroller. It controls a sequence of traffic lights (red, yellow, and green) and a 7-segme
Arduino and Multiplexer
Hello In this article we will see how you can increase the output of the Arduino UNO board by using the 74HC4051 Multiplixer , we wil controll 8 LEDS! This Project is simulated using Proteu
Arduino UNO and EEPROM
Project Description: EEPROM SPI Communication with Arduino In this quick tutorial, we'll explore how to communicate with an EEPROM (Electrically Erasable Programmable Read-Only Memory) using SPI (Seri
Arduino buzzer + 4511 bcd + 7SEG
This Arduino code implements a countdown timer with a 7-segment display driven by a 4511 IC, a buzzer for an alarm, and an optional start/reset button. Here's a brief explanation: Components and



