Arduino IR + LCD + Proteus8

Schematic.

list of products from Amazon (Not mine, i just link them!) Scroll Down For Article! Note: Elegoo boards are not Arduino, but they are compatible with Arduino IDE and are mutch more affordable!


 

Building a Smart Parking System with Arduino

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

  1. Arduino Microcontroller: Serves as the brain of the system.
  2. LCD Display (16x2): Displays the parking space statuses.
  3. LED Indicator: Lights up if all parking spaces are occupied.
  4. Two Digital Sensors: Detect whether parking spaces P1 and P2 are occupied or free.
  5. Wires and Resistors: For connections.

Hardware Connections

  1. LCD Connection: The LiquidCrystal library initializes an LCD object connected to digital pins 2-12. Each pin serves a specific purpose, such as data or control signals.
  2. LED Pin: Connected to pin 13 for visual alerts when parking spaces are full.
  3. Sensors: Connected to pins 6 and 0. Each sensor reads the state of a parking spot (HIGH for occupied, LOW for free).

Understanding the Code

Libraries and Variables

  • #include <Wire.h> and #include <LiquidCrystal.h>: Libraries for I2C communication and LCD control.
  • Variables p1 and p2: Represent the pins connected to parking sensors.
  • THRESHOLD: Placeholder for possible future extensions, e.g., temperature monitoring.

Setup Phase

The setup() function configures:

  1. Pin Modes:
    • pinMode(13, OUTPUT): Sets the LED as an output.
    • pinMode(p1, INPUT) and pinMode(p2, INPUT): Configure parking sensors as inputs.
  2. LCD Initialization: Activates the LCD with a 16x2 configuration.
  3. Serial Communication: Initializes the serial monitor for debugging.

Main Logic in loop()

  1. Read Sensor States:
    • pl1 = digitalRead(p1): Reads the state of parking spot 1.
    • pl2 = digitalRead(p2): Reads the state of parking spot 2.
  2. Update LCD:
    • Displays "Free" if the sensor reads LOW.
    • Displays "Full" if the sensor reads HIGH.
  3. LED Control:
    • If both spots are occupied (pl1 * pl2 == 1), the LED lights up. Otherwise, it remains off.
  4. Delay:
    • Introduces a 500ms delay to avoid flickering.

Key Features of the System

  1. Real-Time Updates:
    • LCD displays the status of parking spots in real-time.
  2. Alert System:
    • An LED warns when both parking spaces are occupied.
  3. Efficient Logic:
    • Uses simple conditional checks to toggle display and LED.

How It Works

  1. Initial State: The system starts by initializing the LCD and sensors.
  2. Parking Spot Status:
    • Sensors connected to p1 and p2 detect vehicles in the respective parking spots.
    • The LCD displays "P1 Free" or "P1 Full" for parking spot 1, and similarly for parking spot 2.
  3. LED Alert:
    • Lights up when both parking spots are occupied.


Full code:


Full schematic: 
Schematic



Full Lcd schematic:

LCD schematic


You can find the full project here:
https://drive.google.com/file/d/1xMffW3WCHXrd53Dn06AxmARRhhq8QSxh/view?usp=drive_link

Future Enhancements

  1. Add More Sensors: To accommodate additional parking spaces.
  2. Remote Monitoring: Use Wi-Fi or Bluetooth to transmit parking status to a smartphone app.
  3. 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.

Post a Comment

0 Comments