Arduino Smart Parking System Using IR Sensors, OLED, and Servo Motor

Build an Arduino smart parking system with three IR sensors, an OLED display, and a servo gate that opens only when a parking slot is available.

  • 12 min read
On this pageIntroduction
Three-slot parking layout.

Introduction

Finding an empty parking space can sometimes be frustrating, especially in busy parking areas. A smart parking system can make this process easier by detecting which parking slots are occupied and controlling vehicle entry automatically.

In this project, we’ll build a Smart Car Parking System using Arduino Uno that monitors three parking slots and controls an automatic entrance gate.

The setup uses three IR obstacle detection sensors, with one sensor placed in each parking slot. Whenever a car is parked in a slot, its IR sensor detects the vehicle, and the Arduino updates the slot status on a 128×64 I2C OLED display. This makes it easy to see which spaces are occupied and how many are still available.

For the entrance gate, we’ll use an SG90 servo motor. The Arduino continuously checks the status of all three parking slots. If at least one slot is free, the servo opens the gate to allow a vehicle to enter. Once all three slots are occupied, the gate stays closed to prevent another vehicle from entering.

Throughout this tutorial, we’ll go through the complete circuit connections, Arduino code, and working of the project. By the end, you’ll have a working mini smart parking system that can detect parked vehicles, display parking availability, and control the entrance gate automatically.

What Is an Arduino Smart Parking System?

An Arduino smart parking system is an electronic setup that monitors parking spaces and controls vehicle access based on available capacity.

In this project, each parking slot has its own IR obstacle detection sensor. When a vehicle is positioned in front of a sensor, the sensor detects the reflected infrared light and changes its digital output.

The Arduino reads the output from all three sensors and determines which parking spaces are occupied.

For example:

  • If all three slots are empty, the display shows three available spaces and the gate can open.
  • If one vehicle is parked, the display shows one occupied slot and two available spaces.
  • If all three slots are occupied, the display shows that the parking area is full and the gate remains closed.

The system uses simple digital signals, making it suitable for beginners learning how to interface multiple sensors with Arduino.

Main Functions

  1. Detect vehicles in three individual parking slots.
  2. Display each slot’s status on an OLED screen.
  3. Calculate the number of available parking spaces.
  4. Open the entrance gate when parking space is available.
  5. Keep the gate closed when all parking slots are occupied.

Features and Specifications

The following specifications describe the assumed hardware used in this tutorial. Exact electrical characteristics can vary between IR sensor modules and servo motor manufacturers.

FeatureSpecification
MicrocontrollerArduino Uno
Parking slots3
Detection methodInfrared obstacle detection
Sensors3 digital IR sensor modules
Sensor outputDigital HIGH/LOW
Display0.96-inch OLED
Display resolution128 × 64 pixels
Display interfaceI2C
OLED controllerSSD1306
Gate actuatorSG90 micro servo
Servo controlPWM-style servo control signal
Operating logicGate opens if at least one slot is empty
Full parking conditionGate remains closed

Important: The IR modules used here are reflective obstacle detection modules, not long-range vehicle detection sensors. Their detection distance depends on the module’s infrared LED, receiver, potentiometer adjustment, vehicle surface, lighting, and mounting position.

The SG90 is suitable for a lightweight demonstration gate. A larger physical barrier requires an appropriately sized actuator and a suitable power supply.

IR Sensor and Other Module Pinouts Explained

IR Obstacle Detection Sensor Pinout

The common three-pin digital IR obstacle detection module has the following connections:

PinFunctionDescription
VCCPowerSupplies power to the sensor module
GNDGroundConnects to Arduino ground
OUTDigital outputChanges state when an object is detected

Most common modules operate from approximately 3.3V to 5V, but check the markings or documentation for your specific board.

The module generally includes an infrared transmitter, an infrared receiver, a comparator, and a sensitivity adjustment potentiometer.

OLED Display Pinout

The OLED is a four-pin SSD1306 I2C display.

PinFunctionArduino Uno Connection
VCCPower5V, if supported by the module
GNDGroundGND
SCLI2C clockA5
SDAI2C dataA4

Some OLED breakout boards support both 3.3V and 5V power, while others are designed for 3.3V only. Check your display’s specifications before connecting it.

SG90 Servo Motor Pinout

Wire ColorFunctionConnection
Brown or BlackGroundGND
RedPowerExternal regulated 5V supply
Orange or YellowSignalArduino digital pin D9

Wire colors can vary by manufacturer. Check the servo’s labels or datasheet if they differ.

Components Required

The following components are required to build the three-slot parking system.

ComponentQuantityPurpose
Arduino Uno1Main controller
Digital IR obstacle detection module3Detect vehicles in parking slots
0.96-inch SSD1306 I2C OLED1Display parking slot status
SG90 servo motor1Operate the entrance gate
Breadboard1Make circuit connections
Jumper wiresAs requiredConnect components
USB cable1Program and power Arduino
Regulated 5V supply1Power the servo motor

Optional components:

  • Cardboard, foam board, or a lightweight barrier arm for the gate.
  • Small mounting brackets for the IR sensors.
  • A separate power distribution board for a more permanent model.

Where to buy the components

Power note: Do not rely on the Arduino Uno’s onboard 5V supply to power the servo motor. Use a regulated external 5V supply with sufficient current capacity. Connect the external supply’s ground to Arduino GND so the servo signal has a common reference. The IR sensors and OLED can use the Arduino supply if their specifications permit.

Wiring Diagram and Connections

The Arduino Uno reads three IR sensors independently. Each sensor is assigned to a digital input pin.

The OLED uses the I2C interface, and the servo signal connects to digital pin D9.

IR Sensor Connections

Component PinArduino / Supply ConnectionDescription
Slot 1 VCC5VSensor power
Slot 1 GNDGNDCommon ground
Slot 1 OUTD2Slot 1 detection
Slot 2 VCC5VSensor power
Slot 2 GNDGNDCommon ground
Slot 2 OUTD3Slot 2 detection
Slot 3 VCC5VSensor power
Slot 3 GNDGNDCommon ground
Slot 3 OUTD4Slot 3 detection

OLED Display Connections

Component PinArduino / Supply ConnectionDescription
VCC5V, if supportedDisplay power
GNDGNDCommon ground
SDAA4I2C data
SCLA5I2C clock

Servo Motor Connections

Component WireArduino / Supply ConnectionDescription
SignalD9Servo control signal
RedExternal regulated 5VServo power
Brown/BlackExternal supply GND and Arduino GNDCommon ground

Important Wiring Notes

  • Connect all three IR sensor grounds to Arduino GND.
  • Make sure the OLED’s voltage requirements are compatible with the Arduino Uno.
  • Power the servo from a separate regulated supply.
  • Connect the external servo supply ground to Arduino GND.
  • Do not connect the external servo supply’s positive output to the Arduino 5V pin when the Arduino is already powered through USB.
  • Keep the servo wiring reasonably short to reduce electrical noise.

How the Arduino Smart Parking System Works

The project works by continuously checking the digital output of three IR sensors.

1. Detecting a Vehicle

Each IR sensor emits infrared light. When a vehicle or another object is in front of the sensor, some of the infrared light reflects back toward its receiver.

The sensor module’s comparator processes the received signal and changes its digital output.

The sensitivity potentiometer adjusts the detection threshold.

For the common module configuration used in this tutorial, the output becomes LOW when an object is detected. Some module versions use different output behavior, so the detection logic must be checked before running the program.

2. Checking Parking Slot Availability

The Arduino reads the output of all three sensors:

  • IR Sensor 1 checks Slot 1.
  • IR Sensor 2 checks Slot 2.
  • IR Sensor 3 checks Slot 3.

The Arduino converts the readings into occupied or empty states.

3. Updating the OLED Display

The OLED displays the status of each parking slot.

For example:

Code
1SMART PARKING2SLOT 1: OCCUPIED3SLOT 2: EMPTY4SLOT 3: EMPTY5FREE SLOTS: 2

The display updates as the sensors detect vehicles entering or leaving the parking spaces.

4. Controlling the Servo Gate

The Arduino counts how many slots are occupied.

The gate logic is:

  • If occupied slots are fewer than three, the gate opens.
  • If all three slots are occupied, the gate closes.

The servo motor moves the gate between two predefined angles.

For this demonstration, the closed position is 0 degrees and the open position is 90 degrees. You can change these angles to suit your model.

5. Parking Availability Calculation

The number of free parking slots is calculated using the following formula:

Free Slots = 3 − Occupied Slots

For example, if two parking spaces are occupied:

Free Slots = 3 − 2 = 1

This means one parking slot is available for the next vehicle.

Since one space is available, the entrance gate can open.

Arduino Library Installation

This project uses two libraries:

  1. Servo library – Maintained by Arduino. It controls the position of the servo motor.
  2. Adafruit SSD1306 library – Maintained by Adafruit. It communicates with the SSD1306 OLED display.

The Adafruit SSD1306 library also requires the Adafruit GFX Library.

Installing the Libraries

  1. Open the Arduino IDE.
  2. Select Sketch → Include Library → Manage Libraries.
  3. Search for Adafruit SSD1306 and install it.
  4. Search for Adafruit GFX Library and install it.
  5. The Servo library is included with the standard Arduino AVR board package in the usual Arduino IDE installation. If it is missing, install the library named Servo.

The project uses I2C communication for the OLED and the Servo library for controlling the gate. No external library is required for reading the digital IR sensor outputs.

Arduino Code

The following sketch assumes that the IR sensor modules produce a LOW output when a vehicle is detected. If your modules produce HIGH when detecting an object, change SENSOR_ACTIVE_STATE from LOW to HIGH.

The OLED is assumed to use the I2C address 0x3C. Some displays use 0x3D; change the address if necessary.

Code
1#include <Wire.h>2#include <Adafruit_GFX.h>3#include <Adafruit_SSD1306.h>4#include <Servo.h>5 6// OLED configuration7#define SCREEN_WIDTH 1288#define SCREEN_HEIGHT 649#define OLED_RESET -110#define OLED_ADDRESS 0x3C11 12Adafruit_SSD1306 display(13  SCREEN_WIDTH,14  SCREEN_HEIGHT,15  &Wire,16  OLED_RESET17);18 19// IR sensor pins20const byte SLOT1_SENSOR = 2;21const byte SLOT2_SENSOR = 3;22const byte SLOT3_SENSOR = 4;23 24// Servo pin25const byte SERVO_PIN = 9;26 27// Most common IR obstacle modules output LOW28// when an object is detected.29const byte SENSOR_ACTIVE_STATE = LOW;30 31// Parking gate angles32const int GATE_CLOSED_ANGLE = 0;33const int GATE_OPEN_ANGLE = 90;34 35// Servo object36Servo parkingGate;37 38// Parking status39bool slot1Occupied = false;40bool slot2Occupied = false;41bool slot3Occupied = false;42 43int occupiedSlots = 0;44int freeSlots = 3;45 46// Gate status47bool gateIsOpen = false;48 49// Update interval50unsigned long lastUpdate = 0;51const unsigned long UPDATE_INTERVAL = 300;52 53void readParkingSensors() {54 55  // Read all three IR sensors56  slot1Occupied =57    (digitalRead(SLOT1_SENSOR) == SENSOR_ACTIVE_STATE);58 59  slot2Occupied =60    (digitalRead(SLOT2_SENSOR) == SENSOR_ACTIVE_STATE);61 62  slot3Occupied =63    (digitalRead(SLOT3_SENSOR) == SENSOR_ACTIVE_STATE);64 65  // Count occupied parking spaces66  occupiedSlots = 0;67 68  if (slot1Occupied) occupiedSlots++;69  if (slot2Occupied) occupiedSlots++;70  if (slot3Occupied) occupiedSlots++;71 72  // Calculate available parking spaces73  freeSlots = 3 - occupiedSlots;74}75 76void controlParkingGate() {77 78  // Open the gate if at least one slot is available79  if (freeSlots > 0) {80 81    if (!gateIsOpen) {82      parkingGate.write(GATE_OPEN_ANGLE);83      gateIsOpen = true;84    }85 86  } else {87 88    // Close the gate when all slots are occupied89    if (gateIsOpen) {90      parkingGate.write(GATE_CLOSED_ANGLE);91      gateIsOpen = false;92    }93  }94}95 96void updateOLED() {97 98  display.clearDisplay();99 100  display.setTextColor(SSD1306_WHITE);101 102  // Heading103  display.setTextSize(1);104  display.setCursor(15, 0);105  display.println(F("SMART PARKING"));106 107  display.drawLine(0, 12, 127, 12, SSD1306_WHITE);108 109  // Slot 1110  display.setCursor(0, 18);111  display.print(F("SLOT 1: "));112  display.println(slot1Occupied ? F("OCCUPIED") : F("EMPTY"));113 114  // Slot 2115  display.setCursor(0, 29);116  display.print(F("SLOT 2: "));117  display.println(slot2Occupied ? F("OCCUPIED") : F("EMPTY"));118 119  // Slot 3120  display.setCursor(0, 40);121  display.print(F("SLOT 3: "));122  display.println(slot3Occupied ? F("OCCUPIED") : F("EMPTY"));123 124  // Available spaces125  display.setCursor(0, 53);126  display.print(F("FREE SLOTS: "));127  display.print(freeSlots);128 129  display.display();130}131 132void printSerialStatus() {133 134  Serial.println(F("--------------------"));135 136  Serial.print(F("Slot 1: "));137  Serial.println(slot1Occupied ? F("OCCUPIED") : F("EMPTY"));138 139  Serial.print(F("Slot 2: "));140  Serial.println(slot2Occupied ? F("OCCUPIED") : F("EMPTY"));141 142  Serial.print(F("Slot 3: "));143  Serial.println(slot3Occupied ? F("OCCUPIED") : F("EMPTY"));144 145  Serial.print(F("Occupied slots: "));146  Serial.println(occupiedSlots);147 148  Serial.print(F("Free slots: "));149  Serial.println(freeSlots);150 151  Serial.print(F("Gate: "));152  Serial.println(gateIsOpen ? F("OPEN") : F("CLOSED"));153}154 155void setup() {156 157  Serial.begin(9600);158 159  // Configure IR sensor pins160  pinMode(SLOT1_SENSOR, INPUT);161  pinMode(SLOT2_SENSOR, INPUT);162  pinMode(SLOT3_SENSOR, INPUT);163 164  // Attach the servo motor165  parkingGate.attach(SERVO_PIN);166 167  // Start with the gate closed168  parkingGate.write(GATE_CLOSED_ANGLE);169  gateIsOpen = false;170 171  // Initialize OLED172  if (!display.begin(173        SSD1306_SWITCHCAPVCC,174        OLED_ADDRESS175      )) {176 177    Serial.println(F("OLED initialization failed!"));178 179    while (true) {180      // Stop if OLED initialization fails181    }182  }183 184  display.clearDisplay();185  display.setTextColor(SSD1306_WHITE);186  display.setTextSize(1);187  display.setCursor(10, 20);188  display.println(F("SMART PARKING"));189  display.setCursor(10, 35);190  display.println(F("Initializing..."));191  display.display();192 193  delay(1000);194 195  // Read the initial parking status196  readParkingSensors();197 198  // Set the gate according to available spaces199  controlParkingGate();200 201  updateOLED();202  printSerialStatus();203}204 205void loop() {206 207  unsigned long currentTime = millis();208 209  // Update parking information at regular intervals210  if (currentTime - lastUpdate >= UPDATE_INTERVAL) {211 212    lastUpdate = currentTime;213 214    // Read the three IR sensors215    readParkingSensors();216 217    // Control the entrance gate218    controlParkingGate();219 220    // Update the OLED display221    updateOLED();222 223    // Print information to Serial Monitor224    printSerialStatus();225  }226}

Important hardware assumptions:

  • The IR modules are three-pin digital obstacle detection boards.
  • A LOW digital output indicates an occupied slot.
  • The OLED is an SSD1306 128×64 I2C display.
  • The OLED address is 0x3C.
  • The servo is an SG90 or a similar small servo.
  • The servo gate is a lightweight model, not a full-size vehicle barrier.

If your IR sensor module uses the opposite output logic, change:

Code
1const byte SENSOR_ACTIVE_STATE = LOW;

to:

Code
1const byte SENSOR_ACTIVE_STATE = HIGH;

Understanding the Arduino Code

1. Library Imports

Code
1#include <Wire.h>2#include <Adafruit_GFX.h>3#include <Adafruit_SSD1306.h>4#include <Servo.h>
  • Wire.h enables I2C communication between Arduino and the OLED.
  • Adafruit_GFX.h provides graphics and text functions.
  • Adafruit_SSD1306.h controls the SSD1306 OLED.
  • Servo.h controls the servo motor position.

2. Pin Definitions

Code
1const byte SLOT1_SENSOR = 2;2const byte SLOT2_SENSOR = 3;3const byte SLOT3_SENSOR = 4;4 5const byte SERVO_PIN = 9;

Each IR sensor has a separate digital input. This allows the Arduino to identify which parking slot is occupied.

The servo signal uses D9.

3. Reading the Sensors

The readParkingSensors() function reads the digital output from each IR module.

Code
1slot1Occupied =2  (digitalRead(SLOT1_SENSOR) == SENSOR_ACTIVE_STATE);

If the sensor output matches the configured active state, the corresponding parking slot is marked as occupied.

The same operation is performed for Slots 2 and 3.

4. Counting Available Slots

The program counts the occupied slots and subtracts that number from three.

Code
1freeSlots = 3 - occupiedSlots;

For example, if two sensors detect vehicles, the Arduino calculates one available parking space.

5. Controlling the Servo Gate

The controlParkingGate() function checks the number of free spaces.

If freeSlots is greater than zero, the servo moves to the open position.

If freeSlots is zero, the servo moves to the closed position.

The gateIsOpen variable prevents the program from repeatedly sending the same movement command when the gate is already in the required position.

6. Updating the OLED

The updateOLED() function clears the previous screen and prints the latest status of all three parking slots.

The display also shows the number of available spaces.

7. Updating at Regular Intervals

The millis() function schedules sensor readings every 300 milliseconds.

This avoids using a continuous delay in the main loop and keeps the program responsive.

Testing the Arduino Smart Parking System

Follow these steps to test the project after completing the wiring.

Step 1: Check the Connections

Before connecting the Arduino to your computer:

  • Verify that all three IR sensor VCC and GND connections are correct.
  • Check that each sensor’s OUT pin connects to the correct Arduino input.
  • Confirm that the OLED’s SDA and SCL wires are connected to A4 and A5.
  • Check the servo signal connection to D9.
  • Make sure the servo has an external regulated 5V supply and shares ground with the Arduino.

Step 2: Upload the Code

  1. Connect the Arduino Uno to your computer using a USB cable.
  2. Open the Arduino IDE.
  3. Select Tools → Board → Arduino Uno.
  4. Select the correct port under Tools → Port.
  5. Install the required libraries if you haven’t already.
  6. Paste the complete sketch into the IDE.
  7. Click Verify to compile the code.
  8. Click Upload to transfer the sketch to the Arduino.

Step 3: Check the OLED Display

After uploading, the OLED should show the status of all three parking spaces.

Initially, if no objects are detected, the display should look similar to this:

Code
1SMART PARKING2 3SLOT 1: EMPTY4SLOT 2: EMPTY5SLOT 3: EMPTY6 7FREE SLOTS: 3

The gate should move to its open position because all three slots are available.

Step 4: Test Each Parking Slot

Place an object, such as a small toy car, in front of the first IR sensor.

The display should change to:

Code
1SMART PARKING2 3SLOT 1: OCCUPIED4SLOT 2: EMPTY5SLOT 3: EMPTY6 7FREE SLOTS: 2

The gate should remain open because two spaces are still available.

Repeat the test with the second and third sensors.

Step 5: Test the Full Parking Condition

Place an object in front of all three sensors.

The OLED should display:

Code
1SMART PARKING2 3SLOT 1: OCCUPIED4SLOT 2: OCCUPIED5SLOT 3: OCCUPIED6 7FREE SLOTS: 0

Expected behavior

The servo should move to its closed position when all three slots are occupied.

Remove one object from any parking slot. The available slot count should increase to one, and the gate should open again.

Step 6: Check the Serial Monitor

Open Tools → Serial Monitor and select a baud rate of 9600.

The Arduino prints the status of each slot, the number of occupied spaces, the number of free spaces, and the gate status.

Example output:

Code
1--------------------2Slot 1: OCCUPIED3Slot 2: EMPTY4Slot 3: EMPTY5Occupied slots: 16Free slots: 27Gate: OPEN

These are illustrative readings. Your output will depend on the actual sensor states.

Understanding the Output

Build your own Arduino Smart Parking System! 🚗Watch on YouTube

The system uses digital sensor readings rather than measuring distance.

Sensor ConditionArduino InterpretationParking Status
Object detectedActive digital stateOCCUPIED
No object detectedInactive digital stateEMPTY

The Arduino combines the three sensor states to calculate parking availability.

Occupied SlotsFree SlotsGate Status
03Open
12Open
21Open
30Closed

The gate remains open whenever at least one space is available. This is the simple control behavior used in this tutorial.

A practical limitation: This is a demonstration model, not a complete access-control system. In a real parking facility, the gate should open for a vehicle only after checking that space is available, then close safely after the vehicle passes. That requires additional entry/exit detection and gate safety logic. The three parking sensors alone cannot determine whether a vehicle has safely passed through the entrance.

Common Problems and Troubleshooting

ProblemPossible CauseSolution
OLED display is blankIncorrect wiring or I2C addressCheck SDA and SCL connections. Try address 0x3D if your display uses it.
OLED initialization failsIncorrect display type or incompatible wiringConfirm that the display uses the SSD1306 controller and check its power requirements.
IR sensor always shows OCCUPIEDIncorrect sensor logic or sensitivity settingCheck the OUT pin state and adjust SENSOR_ACTIVE_STATE or the module’s potentiometer.
IR sensor does not detect a vehiclePoor alignment or insufficient reflected IR lightAdjust the sensor position and detection sensitivity.
All slots show OCCUPIEDSensors are incorrectly wired or their outputs are activeCheck the sensor outputs individually and verify the active-state setting.
Servo does not moveIncorrect signal connection or insufficient powerCheck the D9 connection and use a suitable external regulated 5V supply.
Arduino resets when servo movesServo draws too much current from the Arduino supplyPower the servo separately and connect the grounds together.
Servo moves in the wrong directionOpen and closed angles are reversed for the gate mechanismAdjust GATE_OPEN_ANGLE and GATE_CLOSED_ANGLE.
Servo vibrates or behaves unpredictablyUnstable supply or electrical noiseUse a suitable regulated supply, common ground, and short power connections.
Code does not compileMissing librariesInstall Adafruit SSD1306, Adafruit GFX, and Servo through Library Manager.

Adjusting IR Sensor Sensitivity

Most IR obstacle detection modules have a small potentiometer.

To adjust it:

  1. Power the IR sensor.
  2. Place a toy car at the intended detection position.
  3. Slowly turn the potentiometer.
  4. Observe the sensor’s indicator LED or digital output.
  5. Adjust until the sensor reliably detects the car at the required position.

Different car colors and surface finishes can reflect infrared light differently. Test the sensor with the actual objects you intend to detect.

Practical Applications

The same sensor and control approach can be used in several small automation projects:

  1. Model parking garages: Detect occupied spaces in a miniature parking structure.
  2. Parking availability indicators: Display the number of available spaces at an entrance.
  3. Automatic parking barriers: Control a lightweight model gate based on available capacity.
  4. Smart building models: Demonstrate automated parking as part of a smart-building prototype.
  5. Robotics projects: Detect objects in predefined positions.
  6. Warehouse storage monitoring: Detect whether designated storage positions are occupied.
  7. Educational automation models: Demonstrate how multiple sensors can control a single actuator.

Frequently Asked Questions

1. Can I use Arduino Nano instead of Arduino Uno?

Yes. The Arduino Nano can run this project because it uses the same ATmega328P-based pin functionality in the classic version. Connect the three IR sensors to D2, D3, and D4, the servo signal to D9, and the I2C display to A4 and A5.

2. How many IR sensors are required for this parking system?

Three digital IR sensors are required because the project monitors three separate parking slots. Each sensor is assigned to one slot.

You can expand the project by adding more sensors, provided the Arduino has enough available input pins and the program is updated accordingly.

3. Why does the IR sensor show the wrong parking status?

The most common reason is that the sensor’s output logic is different from the assumption in the code.

This tutorial assumes that the output is LOW when an object is detected. If your module outputs HIGH instead, change:

Code
1const byte SENSOR_ACTIVE_STATE = LOW;

to:

Code
1const byte SENSOR_ACTIVE_STATE = HIGH;

Also check the sensor’s alignment and sensitivity adjustment.

4. Can I use an ultrasonic sensor instead of an IR sensor?

Yes. An ultrasonic sensor such as the HC-SR04 can detect the presence of a vehicle by measuring distance.

However, it requires separate trigger and echo connections and additional code to determine whether a parking slot is occupied. The IR module is simpler for this particular digital detection tutorial.

5. Can the OLED display show all three parking slots?

Yes. The 128×64 SSD1306 OLED used here can display the status of all three slots and the number of available spaces on one screen.

You can also customize the layout to show labels such as FREE, FULL, and OCCUPIED.

6. Can I use a larger servo motor for the parking gate?

Yes, but select a servo that can handle the weight and mechanical load of the gate. A small SG90 is suitable for a lightweight demonstration barrier, not a full-size parking gate.

Use a separate regulated power supply sized for the servo’s current requirements.

7. Can I connect the project to an ESP32?

Yes. The same concept can be implemented using an ESP32. However, the ESP32 uses 3.3V logic, so verify that the IR sensor output voltage is safe for its GPIO pins. Also check the OLED and servo power requirements.

Conclusion

In this tutorial, we built an Arduino smart parking system using three IR obstacle detection sensors, an SSD1306 OLED display, and an SG90 servo motor.

Each IR sensor monitors one parking slot, and the Arduino uses the sensor outputs to calculate the number of occupied and available spaces. The OLED displays the status of all three slots, while the servo controls the entrance gate.

The most important part of the project is understanding how multiple digital inputs can work together to control an output device. Once you understand this, you can experiment with additional parking slots, different display layouts, and more advanced gate-control logic.

Try building the model with three miniature parking spaces and test how the system responds as vehicles enter and leave.