This project consists of two main components: an ESP32-based communication system and an Arduino Mega-based parking management system. The ESP32 module handles data transmission to ThingSpeak for remote monitoring, while the Arduino Mega manages the physical aspects of the parking lot, such as vehicle entry and exit, slot monitoring, and emergency handling.
- ESP32 Communication System: Reads data from the Arduino Mega, parses JSON data, and uploads it to ThingSpeak.
- Arduino Mega Parking Management System: Manages RFID entry/exit, slot monitoring, and emergency detection.
The Parking Management System uses sensors and communication modules to provide real-time data on parking slot availability, emergency situations, and overall parking lot statistics. The data is collected by the Arduino Mega and sent to the ESP32, which then uploads the data to ThingSpeak for remote monitoring.
- ESP32 DevKit V4
- Arduino Mega
- RC522 RFID Modules (2 units)
- LDR Sensors (5 units)
- Gas Sensor (MQ-5)
- Flame Sensor
- Servo Motors (3 units)
- LEDs
- 7-Segment Display
- LCD Display (I2C)
- Various resistors, jumper wires, and breadboard
-
ESP32 DevKit V4:
- RX2 (GPIO 16, Green wire)
- TX2 (GPIO 17, Blue wire)
-
Connections:
- Connect RX2 (GPIO 16) of the ESP32 to the TX pin of the Arduino Mega.
- Connect TX2 (GPIO 17) of the ESP32 to the RX pin of the Arduino Mega.
- Ensure both devices share a common ground.
- SCK to Mega pin 52
- MOSI to Mega pin 51
- MISO to Mega pin 50
- SS to Mega pin 7
- RST to Mega pin 6
- SCK to Mega pin 52
- MOSI to Mega pin 51
- MISO to Mega pin 50
- SS to Mega pin 10
- RST to Mega pin 9
- LDR Sensors: Connected to analog pins A0 to A4
- Gas Sensor (MQ-5): Connected to analog pin A5
- Flame Sensor: Connected to digital pin A6
- Servo Motors:
- Entrance Servo to pin 3
- Exit Servo to pin 4
- Emergency Servo to pin 2
- LEDs: Connected to digital pins 22 to 32
- 7-Segment Display: Connected to digital pins 33 to 36
- Emergency Light: Connected to digital pin 45
- LCD Display: Connected via I2C
For the ESP32:
ArduinoJson
WiFi
ThingSpeak
For the Arduino Mega:
SPI
MFRC522
Servo
ArduinoJson
LiquidCrystal_I2C
These libraries can be installed via the Arduino Library Manager.
Update your WiFi SSID and password in the ESP32 code:
const char* ssid = "YourNetworkSSID";
const char* password = "YourNetworkPassword";
Update your ThingSpeak channel number and Write API Key:
unsigned long myChannelNumber = YourChannelNumber;
const char* myWriteAPIKey = "YourWriteAPIKey";
-
Initialization:
- Initializes Serial communication at 115200 baud for debugging.
- Initializes Serial2 communication at 9600 baud for receiving data from Arduino Mega.
- Connects to WiFi and initializes the ThingSpeak client.
-
Main Loop:
- Waits for incoming data on Serial2.
- Reads the JSON data and parses it into a
StaticJsonDocument
. - Extracts values from the JSON document and stores them in the
Data
array. - Sends these values to ThingSpeak.
-
Initialization:
- Initializes Serial communication for debugging.
- Sets up the RFID modules, sensors, servos, and display.
- Connects to the ESP32 module via Serial1 for data transmission.
-
Main Loop:
- Reads RFID cards for vehicle entry and exit.
- Monitors parking slots using LDR sensors.
- Checks for emergency situations using gas and flame sensors.
- Controls gate servos and updates displays.
- Transmits data to the ESP32 module.
- Upload the Code:
- Upload the provided code to the Arduino Mega and ESP32 using the Arduino IDE.
- Wire Components:
- Connect all the hardware components as per the wiring instructions.
- Power Up:
- Power up your Arduino Mega, ESP32, and connected components.
- Monitor Serial Output:
- Open the Serial Monitor at a baud rate of 115200 to view the debug messages.
- Send Data:
- Send JSON-formatted data from the Arduino Mega to the ESP32 via Serial2.
- ThingSpeak:
- Check the ThingSpeak channel to see the uploaded data.
This project is licensed under the MIT License.
This README file provides a comprehensive guide to set up and run the Parking Management System. Ensure to connect all components correctly, update the necessary credentials, and test the system thoroughly.