Parking Lot Sensor (Arduino) | Made by Luca Rodrigues, José Airton and Valter Felipe

Intro: Parking Lot Sensor (Arduino) | Made by Luca Rodrigues, José Airton and Valter Felipe

This sensor was made by Three sad students from a Federal Institution in Brazil's Northeast.

Step 1: Arduino Input on Tinkercad.com

This is the device that control's the role circuit.

Step 2: Components

1 Piezo Buzzer;

1 Ultrasonic Sensor;

2 LEDs (colors can be choosen by prefrence);

2 Resistors (150Ω);

Some Jumper cables.

Step 3: Connection

Connect all these as the image above.

Step 4: Code

Link noTinkerCAD:

https://www.tinkercad.com/things/kmXZEwz8qt9

Código para programação:

// sensor de distancia ultrassonico
const int pingPin = 7;
void setup() {
  Serial.begin(9600);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(9, OUTPUT);
}
void loop() {
  long duration, inches, cm;
  
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);
  inches = microsecondsToInches(duration);
  cm = microsecondsToCentimeters(duration);
  Serial.print(inches);
  Serial.print("in, ");
  Serial.print(cm);
  Serial.print("cm");
  Serial.println();
  
  if(cm<50){
   digitalWrite(9, HIGH);
    
    delay(500);
    digitalWrite(12, HIGH);
    delay(20);
    digitalWrite(12, HIGH);
    digitalWrite(11, LOW);
    delay(20);
    digitalWrite(11, LOW);
    } else{
    digitalWrite(9,  LOW);
    digitalWrite(12, LOW);
    digitalWrite(11, HIGH);
  }
}
long microsecondsToInches(long microseconds) {
  return microseconds / 74 / 2;
}
long microsecondsToCentimeters(long microseconds) {
  return microseconds / 29 / 2;
}
  • Download do código para Software Arduino disponível.

Share

    Recommendations

    • Fix It! Contest

      Fix It! Contest
    • Tiny Home Contest

      Tiny Home Contest
    • Furniture Contest 2018

      Furniture Contest 2018

    Discussions

    0
    None
    Swansong

    10 months ago

    That's a neat setup, do you have any photos of the finished project?