Skip to main content

53. Secured Car parking system using Arduino

Hey everyone!
Sorry I have not posted in a while. Today I will be teaching you how to make a secured car parking system using Arduino. This system can be used for your personal garage. This project took me upto one week for completion. Every time I tried this project with the same codes, it worked differently. The malfunction was caused due to faulty jumper cables. Read on further to learn how I did this project.

Hardware components used in this project

  • Arduino Uno
  • USB Type A/B cable (for Arduino Uno)
  • Solderless Breadboard - Half+
  • Breadboard power supply module
  • MFRC522 RFID reader
  • RFID tags (x2) - Card and Key tag
  • Tower pro Servo motor - SG-90
  • 4 digit seven segment display module - 4 pins
  • LEDs (x3) - White
  • LCD display module with I2C interface - 16x2
  • Relay module - 5V single channel
  • IR tracking sensor
  • Male-to-Male Jumper wires - 10cm
  • Female-to-Male Jumper wires - 20cm

Setup





Your setup must look somewhat similar to the one in the images above.

Connections

MFRC522 RFID reader

  • SDA/SS - D10
  • SCK - D13
  • MOSI - D11
  • MISO - D12
  • IRQ - Not connected
  • GND - Ground
  • RST/ RESET - D9
  • 3.3V - 3.3V

LCD display module with I2C interface

  • GND - Ground
  • VCC - 5V
  • SDA - A4
  • SCK - A5

4 digit seven segment display module

  • CLK - D2
  • DIO - D3
  • GND - Ground
  • VCC - 5V

Servo motor SG-90

  • S (Orange/ Yellow wire) - S5
  • (+) (Red wire) - 5V
  • (-) (Black/ Brown wire) - Ground (GND)

Relay module - 5V single channel

  • S - D6
  • (+) - 5V
  • (-) - Ground (GND)

IR tracking sensor

  • S - D4
  • (+) - 5V
  • (-) - Ground (GND)

Coding

You will be needing the 'TM1637' library by Avishay Orpaz to control your 4 digit seven segment display module, 'Arduino LiquidCrystal I2C library' to control your LCD display module, 'MFRC522' library by miguelbalboa to control your MFRC522 RFID reader and, the in-built library, 'Servo' to control your Servo motor in this project. 
Follow this tutorial to learn about controlling 4 digit seven segment display module, before continuing this coding section. Create MFRC522 interface, Servo object and TM1637 display object. Set the LCD address  to 0x27 for a 16 chars and 2 line display. You can use the I2C scanner to get the address of your LCD display module. Create global variables for sensor, count, value and relay.  Assign the count variable to 15. Create arrays for each count to make the 4 digit seven segment display module function as a countdown timer. Please watch the YouTube video in the last section of this page to see how this project works. 
Within void setup( ), set the data rate in 9600 bauds for serial data transmission. Use pinMode( ) function to configure the pins of relay module and IR tracking sensor as OUTPUT and INPUT respectively. Initiate LCD, MFRC522 and SPI bus. Use attach( ) function with your servo object as the syntax to declare the pin to which the Servo motor is connected. Use setCursor( ) function to print 'Welcome!' in the fourth column.
Within void loop( ), use lcd.clear( ) function after one second delay to clear the display so that you can print 'Keep your card' in the first row and 'here' in the second row.
Use these codes from DumpInfo sketch in the Examples from MFRC522 library. 
if ( ! mfrc522.PICC_IsNewCardPresent()) 
  {
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) 
  {
    return;
  }
  //Show UID on serial monitor
  Serial.print("UID tag :");
  String content= "";
  byte letter;
  for (byte i = 0; i < mfrc522.uid.size; i++) 
  {
     Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
     Serial.print(mfrc522.uid.uidByte[i], HEX);
     content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
     content.concat(String(mfrc522.uid.uidByte[i], HEX));
  }
  Serial.println();
  Serial.print("Message : ");
  content.toUpperCase();
If the authorised tag is placed in front of the MFRC522 RFID reader, the servo should rotate 140 degrees, the relay pin should be set HIGH and the value stored in the val variable should be assigned as 1. The lcd should show 'Access Granted'. If the unauthorised tag is placed, the servo should rotate to its initial position, the relay pin should be set LOW, the value stored in the val variable should be assigned as 0, and the lcd should show 'Access denied'.  If the value stored in the val variable is 1, the value stored in the count variable must decrease by 1, or else, the count variable must be assigned to 0. 
Use switch...case( ) function to set the display for each value stored in count variable. The sensor sends a LOW signal if it detects an object within few cm away from the IR transmitter and receiver. If the sensor sends a LOW signal to the Arduino microcontroller, the count variable must be assigned to 0 and the servo must be set to its original position to close the barricade. If the count is 0, the 4 digit seven segment display module must show Stop, the servo motor must be set to its initial position, and after 3 seconds, the display should be cleared and the count must be assigned to 15.
If anyone has any questions with the coding, please feel free to comment below or contact me at arduinoprojectsbyr@gmail.com.

Final Look

If anyone has any questions, or suggestions, with this project, please feel free to comment below or send me an email at arduinoprojectsbyr@gmail.com.

Comments

Popular posts from this blog

51. Buzz wire game using Arduino

Hello everyone! This is my first Arduino project in 2020 and it is going to be a fun and simple project. You would have heard of the Buzz Wire, a steady hand game, and today you will be learning to make one using Arduino. Hardware components used in this project Arduino Nano USB Type A to mini B cable (for Arduino Nano) Solderless Breadboard - Mini and Full-size LEDs (x2) - Green and Red Resistors (x2) - 220 Ω  Active Buzzer module (KY-012) LCD display module with I2C interface - 16x2 Male-to-Male Jumper wires (x4) - 10cm Female-to-Male Jumper wires (x5) - 20 cm Jumpers (x5) - to reduce the usage of wires Copper wire  Tape (or any form of insulation)  Setup Your hardware setup must look somewhat similar to the ones in the images above. The beginning and end of the copper wire maze must be taped to prevent conductivity between the wire loop and maze. Connections LCD display module with I2C interface GND - Ground VCC - 5V SDA -...

71. Buzz Wire Game ( Version 2.0 ) using Arduino

Hey Everyone! I hope that everyone's safe during this pandemic. Today I am going to explain you about the second version of my Buzz wire game. People who are bored of staying indoors can find this game pretty interesting and fun to play.  If you are a beginner, you can start off with my first version of this project :  51. Buzz wire game using Arduino   Hardware components used in this project Arduino Uno Solderless Breadboard (x2) - Full/ Full+ LCD display module with I2C module - 16x2 Potentiometer - B20K Push-buttons (x3) Resistor - 220 Ω Active Buzzer module (KY-012) LED - Red Copper Wire - 19/ 20 gauge thick Male-to-Male Jumper wires - 10cm and 20cm Wire - Long enough to connect the loop of copper wire to ground Other tools required for this project Cutting pliers - To cut the right amount of copper wire Round-nose pliers - To bend the copper wire and make a maze and loop Hardware setup Connections Wire Maze - D2 Wire loop - Ground (GND) B20K Potentiometer S - A0 (+)...

70. Arduino Stopwatch and Timer

Hello everyone! Today I am going to explain you about making an Arduino Stopwatch and Timer, which can be used for time based projects. Read on further to learn more about this project. Hardware components used in this project Arduino Uno USB Type A/ B cable Solderless Breadboard - Full+ LCD display module with I2C interface - 16x2 Potentiometer - 10K Push-buttons (x5) Active Buzzer module (KY-012) LED - Red Resistors (x6) - 10kΩ (x5) and 220Ω (x1) Male-to-Male Jumper wires - 10cm and 20cm Jumpers - to reduce the usage of wires Hardware setup Connections 10K Potentiometer S - A0 (+) - 5V (-) - Ground (GND) Active Buzzer module S - D7 (+) - 5V (-) - Ground (GND) 16x2 LCD display module with I2C interface GND - Ground VCC - 5V SDA - A4 SCL - A5 Push-buttons (+) - 5V (-) - Ground (GND) S - D2, D3, D4, D5, D6 Coding Now, I will explain you about how this real-time project works and you can figure out the coding by this idea.  Push-buttons and their functions D2 - Set Countdown timer D3...