[idea] Garage parking assistance

Simplify IoT Development.

Moderators: lily.li, violet, seth.welday

Post Reply
User avatar
uwe.fetzer
Pre-kindergarten
Pre-kindergarten
Posts: 36
Joined: Sun Apr 17, 2016 6:06 am
Location: Neuss, Germany
Contact:

[idea] Garage parking assistance

Post by uwe.fetzer » Thu Apr 28, 2016 2:47 am

Used Grove Moduls :
- Ultrasonic Ranger
- Speaker
- LED Strip
and Raspberry Pi as Wio Server

Python Script:

Code: Select all

import requests
import time

if __name__ == '__main__':

    url_range = 'http://192.168.38.58:8080/v1/node/GroveUltraRangerD1/range_in_cm?access_token=9164e46e6c460b57b711ac90eca626b9'
    
    response = requests.get(url_range)
    
    range_cm = response.json()['range_cm']
    leds = int(0)
    
    while range_cm > 5 :
        
        leds_old = leds
        leds = int(range_cm / 10)
        
        if leds > 20 : 
            leds = 20
        
        if leds <> leds_old :
            rgb = ''
            rgbs = int(0)

            while rgbs < 20 :
                rgbs += 1
                
                if rgbs <= leds :
                    if leds < 5 :
                        rgb += '110000'
                    else :
                        rgb += '001100'
                else :
                    rgb += '000000'
            
            url_leds = 'http://192.168.38.58:8080/v1/node/GroveLedWs2812D0/segment/0/' + rgb + '?access_token=9164e46e6c460b57b711ac90eca626b9'
            requests.post(url_leds)

        print(range_cm, leds)
   
        if leds < 2 :
            url_beep = 'http://192.168.38.58:8080/v1/node/GroveSpeakerD2/sound_ms/1000/200?access_token=9164e46e6c460b57b711ac90eca626b9'
            requests.post(url_beep)
        elif leds < 3 :
            url_beep = 'http://192.168.38.58:8080/v1/node/GroveSpeakerD2/sound_ms/800/200?access_token=9164e46e6c460b57b711ac90eca626b9'
            requests.post(url_beep)
        elif leds < 4 :
            url_beep = 'http://192.168.38.58:8080/v1/node/GroveSpeakerD2/sound_ms/600/200?access_token=9164e46e6c460b57b711ac90eca626b9'
            requests.post(url_beep)
        elif leds < 5 :
            url_beep = 'http://192.168.38.58:8080/v1/node/GroveSpeakerD2/sound_ms/400/200?access_token=9164e46e6c460b57b711ac90eca626b9'
            requests.post(url_beep)

        response = requests.get(url_range)
        range_cm = response.json()['range_cm']
        
        time.sleep(.5)
        
    url_leds = 'http://192.168.38.58:8080/v1/node/GroveLedWs2812D0/clear/35/000000?access_token=9164e46e6c460b57b711ac90eca626b9'
    requests.post(url_leds)
    
    print("End")
Video:

philip.mallon
Pre-kindergarten
Pre-kindergarten
Posts: 34
Joined: Fri Oct 31, 2014 12:32 pm
Contact:

Re: [idea] Garage parking assistance

Post by philip.mallon » Thu Apr 28, 2016 3:13 pm

This is a great idea and well done. We have one that uses laser guidance for the driver in the garage and it senses the car by heat. On a cold day it does not work so we may try your construction. We think it is one of the best gadgets in the house. Is the range of the ultrasonic sensor too short?

teng.wang
Pre-kindergarten
Pre-kindergarten
Posts: 37
Joined: Fri Apr 08, 2016 10:50 am

Re: [idea] Garage parking assistance

Post by teng.wang » Thu Apr 28, 2016 5:56 pm

I love it. Good job.

User avatar
uwe.fetzer
Pre-kindergarten
Pre-kindergarten
Posts: 36
Joined: Sun Apr 17, 2016 6:06 am
Location: Neuss, Germany
Contact:

Re: [idea] Garage parking assistance

Post by uwe.fetzer » Thu Apr 28, 2016 6:09 pm

Hi Philip,

I've set the range to a such low value just to test the solution in my office.

You can adjust the value in the code:

Code: Select all

leds = int(range_cm / 10)

Post Reply