David J Chazhoor
Created July 10, 2018 © LGPL

Perfect Parking

A WIZ750SR based project that helps to solve the present parking issues with an efficient method.

IntermediateFull instructions provided6 hours106
Perfect Parking

Things used in this project

Hardware components

WIZ750SR
WIZnet WIZ750SR
×1
Arduino UNO
Arduino UNO
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
Android device
Android device
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×15

Software apps and online services

Arduino IDE
Arduino IDE
MIT App Inventor
MIT App Inventor

Story

Read more

Custom parts and enclosures

MIT App Inventor App

This is the app made by MIT APP Inventor

MIT App Inventor Project Files

MIT App Inventor App

This is the app made by MIT App Inventor. This shows the available parking space, its status, its location, and can be navigated to the location using google maps.

MIT App Inventor Project Files

This must be downloaded and open in mit app inventor site to see the excat working.

Schematics

Arduino & WIZ750SR Connection

This diagram shows the connection of WIZ750SR and Arduino Uo R3.

Arduino & Ultrasonic Sensor Connection

This diagram shows the individual connection of ultrasonic sensor and Arduino Uno R3.

Code

Arduino Code

Arduino
/* HC-SR04 Sensor
   The circuit:
   For Ultrasonic Sensor 1
  * VCC connection of the sensor attached to +5V
  * GND connection of the sensor attached to ground
  * TRIG connection of the sensor attached to digital pin 2
  * ECHO connection of the sensor attached to digital pin 4
*/

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // Initializing RX, TX pins

const int trigPin1 = 2; //initializing digital pin 2 of arduino as trigger of sensor1 
const int echoPin1 = 4; //initializing digital pin 4 of arduino as echo of sensor1 

void setup() 
{
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // set the data rate for the SoftwareSerial port
  mySerial.begin(115200);
}

void loop() // run over and over
{

  if (mySerial.available()) {
    Serial.write(mySerial.read());
  }
  if (Serial.available()) {
    mySerial.write(Serial.read());
  }
  
  // establish variables for duration of the ping, 
  // and the distance result in inches and centimeters:
  long duration1, cm1;


  // The sensor is triggered by a HIGH pulse of 10 or more microseconds.
  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
  pinMode(trigPin1, OUTPUT); //initializing trigger pin1 as the output
  digitalWrite(trigPin1, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin1, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin1, LOW);

  // Read the signal from the sensor: a HIGH pulse whose
  // duration is the time (in microseconds) from the sending
  // of the ping to the reception of its echo off of an object.
  pinMode(echoPin1, INPUT); //initializing echo pin1 as the input
  duration1 = pulseIn(echoPin1, HIGH);

  // convert the time into a distance
  cm1 = microsecondsToCentimeters(duration1);
  
  Serial.print(cm1);
  Serial.print("cm");
  Serial.println();

  if(cm1<8)
  {
    Serial.print("there is a car");
    mySerial.println(":");
    mySerial.println("occupied"); //If there is a car in the parking slot, we will send value 1 to firebase database
  }
  if(cm1>8)
  {
    Serial.print("there is a free parking slot");
    mySerial.println(":");
    mySerial.println("unoccupied"); //If there is a free parking slot, we will send value 0 to firebase database
  }

  
  delay(1000);
}

long microsecondsToCentimeters(long microseconds) //This is the function used to convert time to distance
{
  // The speed of sound is 340 m/s or 29 microseconds per centimeter.
  // The ping travels out and back, so to find the distance of the
  // object we take half of the distance travelled.
  return microseconds / 29 / 2;
}

Credits

David J Chazhoor

David J Chazhoor

1 project • 2 followers

Comments