Close
0%
0%

auto stop parking system

park your car easier

Public Chat
Similar projects worth following
parking is a condition when you leave your vehicle temporarily in a place, whether is a parking space or just a space. at this moment in a big city, looking for a parking space is getting harder because there is a lot of vehicles in town. with this device the parking space will automatically stop open the portal when there is no more space in the parking area.

to gather all parking space data it's need ultrasonic sensors hc-sr04 in every parking space. so if there are 20 parking space it needs 20 ultrasonic sensors and sent all the data to wemos d1 mini.

  • 1 × wemos d1 mini
  • 1 × hc-sr04
  • 1 × motor servo

  • 1
    setup sensors and led

    from machine import Pin,PWM
    import time
    trig = 15
    echo = 13
    led = 4

    echo = Pin(echo, Pin.IN)
    led = Pin(led, Pin.OUT)
    trig = Pin(trig, Pin.OUT)
    servo = PWM(Pin(2), freq=50, duty=77)
    trig.off()
    time.sleep_ms(2)
    trig.on()
    time.sleep_ms(10)
    trig.off()

    def get_distance(unit="cm"):
      trig.on()
      time.sleep_ms(10)
      trig.off()
      
      while echo.value() == 0:
        pass
      start = time.ticks_us()
      
      while echo.value() == 1:
        pass
      stop = time.ticks_us()
      
      d = (stop - start)/58
      distance = round(d,2)
      if unit == "mm":
        factor = 10
      elif unit == "cm":
        factor = 1
      elif unit == "m":
        factor = 0.1
        
      return distance*factor
      
    def limit(value):
      x=int(get_distance())
      if x < float(value):
        led.on()
       
        print('limit is reached')
      else:
        led.off()
      print('distance is {} cm'.format(x))
      print('limit is {} cm'.format(value))
      
    while True:
      
      limit(1000)
      time.sleep_ms(1)
      if x < 5 :
        servo.duty(30)
        time.sleep_ms(1)
        servo.duty(122)

  • 2
    setup motor servo

    from machine import Pin, PWM
    from time import sleep
    servo = PWM(Pin(2), freq=50, duty=77)
    servo.duty(30)
    sleep(.5)
    servo.duty(122)

View all instructions

Enjoy this project?

Share

Discussions

Blo0dygeek wrote 05/10/2019 at 02:24 point

Cool, I like it. You know parking is really the pain in the ass in big city.

More details plz:) 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates