Arduino Smart Parking System with 8 Spots Guide
Arduino Smart Parking System
Looking for an intelligent solution to manage parking spaces? Build an Arduino Smart Parking System. This project utilizes a 74HC165 shift register, IR sensors, servo gates, and an LCD to monitor 8 parking spaces in real-time. Furthermore, it automates entry and exit with visual feedback. Whether you're a student, hobbyist, or IoT developer, this comprehensive guide simplifies the process of getting started.
Why Build a Smart Parking Management System with Arduino?
As urban areas expand, finding parking becomes increasingly challenging. Therefore, smart parking systems save time and decrease traffic congestion. In fact, this Arduino-based setup provides live updates and automatically controls access. Consequently, it's suitable for campuses, garages, or smart city demonstrations.
Additionally, this project teaches fundamental electronics skills: sensor reading, shift registers, servo control, and real-time display management. Because it uses minimal pins with the 74HC165, you can scale the system later. Above all, it offers hands-on learning with practical applications.
Key Features of the Arduino Smart Parking Project
First, the system monitors 8 parking spots using sensors connected to a 74HC165 shift register. Next, it displays live status on a 16x2 LCD: "X" signifies occupied, "Y" signifies free. Then, it manages entry and exit gates using servo motors activated by IR sensors.
Furthermore, green and red LEDs provide immediate visual feedback—green for available spots, red for full capacity. Meanwhile, the code operates smoothly on Arduino Uno or Mega. Best of all, you can expand it to 16, 24, or more spots by chaining shift registers.
How the Smart Parking System Works Step by Step
To begin with, 8 parking sensors feed data into the 74HC165. Rather than using 8 Arduino pins, the shift register uses only 3—CLK, SH/LD, and SO. As a result, you conserve valuable I/O pins for other tasks.
When a vehicle approaches the entry, the IR sensor detects it. If free spots are available, the system illuminates a green LED and opens the gate using a servo. If the lot is full, a red LED flashes and the gate remains closed. On exit, another IR sensor triggers the exit gate to open automatically.
At the same time, the LCD updates every 500 milliseconds to display spot statuses. This real-time display helps users and developers observe system performance instantly.
Hardware Needed for the Smart Parking System
Below is the complete shopping list. All components are common and budget-friendly.
- 1 Arduino Uno or Mega (or compatible ELEGOO board)
- 1 74HC165 shift register (for reading 8 sensors)
- 8 parking spot sensors (IR or ultrasonic)
- 2 IR sensors (for entry and exit detection)
- 2 servo motors (for gate control)
- 1 16x2 LCD display
- 1 green LED + 1 red LED
- 2 resistors (220Ω) for LEDs
- 8 pull-down resistors (10kΩ) for spot sensors
- Breadboard and 40+ jumper wires
- USB-to-Serial module (optional, for programming)
Note: ELEGOO starter kits often include most of these parts. Also, you can use IR, ultrasonic, or magnetic sensors for parking spots—just ensure they output a digital HIGH/LOW signal.
Wiring the Arduino Smart Parking System
Proper wiring ensures reliable operation. Therefore, follow these connections carefully.
74HC165 Shift Register Connections
Connect the 74HC165 as follows: D0–D7 to your 8 parking sensors. Then, wire SH/LD to Arduino pin A1, CLK to pin 3, and SO (Serial Output) to pin 2. Also, connect VCC to 5V and GND to ground. Don't forget pull-down resistors on each sensor line to prevent floating signals.
LCD, LEDs, and Servo Wiring
Wire the 16x2 LCD using the standard 4-bit mode: RS=13, E=12, D4=11, D5=10, D6=9, D7=8. Next, connect the green LED (with 220Ω resistor) to pin 7 and the red LED to pin 6.
Then, attach the entry servo to Arduino pin A2 and the exit servo to pin A3. Finally, plug the entry IR sensor into pin 4 and the exit IR sensor into pin 5.
💡 Pro Tip: Use a separate 5V power supply for servos if they jitter. Arduino's USB power may not handle motor spikes.
Arduino Code for the Smart Parking System
The full code utilizes the Wire, LiquidCrystal, and Servo libraries—but doesn't require complex logic. Below is the complete, ready-to-upload sketch.
#include <Wire.h>
#include <LiquidCrystal.h>
#include <Servo.h>
// LCD pins
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
// 74HC165 pins
#define SH_LD A1 // Shift/Load Bar pin
#define CLK 3 // Clock pin
#define SO 2 // Serial Output pin
// LEDs
#define green 7 // Green LED for gate open
#define red 6 // Red LED for parking full
// IR sensors
#define ENTRY_SENSOR 4 // Entry sensor pin
#define EXIT_SENSOR 5 // Exit sensor pin
// Servo motors
Servo entryGateServo; // Servo for entry gate (A2)
Servo exitGateServo; // Servo for exit gate (A3)
// Number of parking spots
const int NUM_SPOTS = 8;
bool spots[NUM_SPOTS]; // Parking spot statuses
int freeSpots = NUM_SPOTS; // Counter for free spots
void setup() {
// LCD setup
lcd.begin(16, 2);
lcd.clear();
// Servo setup
entryGateServo.attach(A2);
exitGateServo.attach(A3);
entryGateServo.write(0); // Keep entry gate closed
exitGateServo.write(0); // Keep exit gate closed
// 74HC165 control pins
pinMode(SH_LD, OUTPUT);
pinMode(CLK, OUTPUT);
pinMode(SO, INPUT);
// LEDs
pinMode(green, OUTPUT);
pinMode(red, OUTPUT);
digitalWrite(green, LOW);
digitalWrite(red, LOW);
// IR sensors
pinMode(ENTRY_SENSOR, INPUT);
pinMode(EXIT_SENSOR, INPUT);
Serial.begin(9600);
}
void loop() {
// Read parking spot statuses
readShiftRegister(spots);
// Calculate free spots
freeSpots = 0;
for (int i = 0; i < NUM_SPOTS; i++) {
if (!spots[i]) {
freeSpots++;
}
}
// Handle entry
if (digitalRead(ENTRY_SENSOR) == HIGH) {
if (freeSpots > 0) {
digitalWrite(green, HIGH);
entryGateServo.write(90); // Open gate
delay(500);
entryGateServo.write(0); // Close gate
digitalWrite(green, LOW);
} else {
digitalWrite(red, HIGH);
delay(500);
digitalWrite(red, LOW);
}
}
// Handle exit
if (digitalRead(EXIT_SENSOR) == HIGH) {
exitGateServo.write(90);
delay(500);
exitGateServo.write(0);
}
// Update LCD
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("1|2|3|4|5|6|7|8|");
lcd.setCursor(0, 1);
for (int i = 0; i < NUM_SPOTS; i++) {
lcd.print(spots[i] ? "X|" : "Y|");
}
delay(500); // Refresh every 500 ms
}
// Function to read the shift register
void readShiftRegister(bool ar[NUM_SPOTS]) {
digitalWrite(SH_LD, LOW); // Load parallel data
delayMicroseconds(5);
digitalWrite(SH_LD, HIGH); // Switch to shift mode
for (int i = 0; i < NUM_SPOTS; i++) {
digitalWrite(CLK, LOW);
delayMicroseconds(5);
ar[i] = digitalRead(SO); // Read bit
digitalWrite(CLK, HIGH);
delayMicroseconds(5);
}
}
How the Code Works
During setup, the code initializes the LCD, servos, LEDs, and sensors. Then, in the loop, it reads all 8 parking spots using the readShiftRegister() function. This function loads sensor data in parallel and shifts it out bit by bit.
After counting free spots, the system checks the entry sensor. If a vehicle arrives and spots are free, the green LED turns on and the entry gate opens for 500ms. If full, the red LED flashes briefly.
Similarly, when a vehicle exits, the exit gate opens automatically. Finally, the LCD refreshes to show updated statuses like "Y|X|Y|..." so users see availability at a glance.
Testing and Troubleshooting Tips
First, upload the code and open the Serial Monitor (9600 baud). Although this sketch doesn't print serial data, it helps confirm the board is responsive.
Next, cover one parking sensor. The LCD should change from "Y" to "X" for that spot within half a second. Then, wave your hand in front of the entry IR sensor. If spots are free, the green LED should light and the servo should move.
If the system doesn't respond, check these common issues: Are all GNDs connected? Are sensor outputs digital (not analog)? Is the 74HC165 powered correctly? Also, verify servo power—weak power causes erratic behavior.
Real-World Applications and Upgrades
This smart parking system works well in schools, small lots, or maker fairs. But you can also scale it for real-world use. For example, add Wi-Fi (ESP8266) to send data to a cloud dashboard. Then, build a mobile app to show available spots remotely.
Moreover, daisy-chain two 74HC165 chips to monitor 16 spots. Just connect the SO of the first to the second's input and adjust the code. Likewise, replace servos with linear actuators for real barrier gates.
Additionally, integrate with Raspberry Pi for video analytics or license plate recognition. Thus, your Arduino handles sensors while Pi manages AI—perfect for advanced smart city projects.
Why Use a Shift Register in Parking Projects?
Without a shift register, 8 sensors would use 8 Arduino pins. But Arduino Uno has only 14 digital pins—and you also need pins for LCD, servos, and LEDs. Therefore, the 74HC165 saves pins and simplifies wiring.
Consequently, your design stays clean and scalable. In addition, shift registers are cheap, reliable, and widely supported. So, they're perfect for sensor-heavy projects like this smart parking system.
Final Thoughts on Building Your Arduino Smart Parking System
In summary, this project combines sensors, logic, and automation into one functional system. Because it uses common parts and clear code, even beginners can succeed. At the same time, it offers room to grow—add IoT, more spots, or better UI.
So, gather your components, follow the wiring guide, and upload the code. Soon, you'll have a working smart parking lot that impresses teachers, clients, or fellow makers. Start small, test often, and innovate!
0 Comments