# FunHouse Parking Assistant

## Overview

https://youtu.be/xcGiKQeNbRo

![](https://cdn-learn.adafruit.com/assets/assets/000/102/478/medium800/proximity_funPark-1509.jpg?1622416816)

Use the FunHouse and an ultrasonic distance sensor to assist you when parking your vehicle in your garage or other permanent parking space.

This project uses the FunHouse to read a distance sensor and then guide the driver with colored LEDs and sounds!

## Parts
Featured
### Adafruit FunHouse - WiFi Home Automation Development Board

[Adafruit FunHouse - WiFi Home Automation Development Board](https://www.adafruit.com/product/4985)
Home is where the heart is...it's also where we keep all our electronic bits. So why not wire it up with sensors and actuators to turn our house into an electronic wonderland. Whether it's tracking the environmental temperature and humidity in your laundry room, or notifying you when...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4985)
[Related Guides to the Product](https://learn.adafruit.com/products/4985/guides)
![Top-down video of Adafruit Funhouse PCB. The TFT display shows a data readout, and the NeoPixel LEDs glow rainbow colors.](https://cdn-shop.adafruit.com/product-videos/640x480/4985-00.jpg)

Featured
### Adafruit NeoPixel LED Strip with 3-pin JST PH 2mm Connector

[Adafruit NeoPixel LED Strip with 3-pin JST PH 2mm Connector](https://www.adafruit.com/product/3919)
Plug in and glow, this **Adafruit NeoPixel LED Strip with JST PH Connector** has **30 total LEDs** in a **"60 LED per meter" spacing** , and is 0.5 meters long, in classy Adafruit Black. Its not too long, but has lots of glowing action.<a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/3919)
[Related Guides to the Product](https://learn.adafruit.com/products/3919/guides)
![Adafruit NeoPixel LED Strip with 3-pin JST PH Connector lit up rainbow](https://cdn-shop.adafruit.com/640x480/3919-01.jpg)

Featured
### Ultrasonic Distance Sensor - 3V or 5V - HC-SR04 compatible

[Ultrasonic Distance Sensor - 3V or 5V - HC-SR04 compatible](https://www.adafruit.com/product/4007)
If you're like me, you've dreamed of being a dolphin - smoothly gliding through the water. Using your echo-location abilities to detect tasty fish treats. Until genetic modifications catches up with our desires, we'll just have to make do with these handy&nbsp; **3V Ultrasonic...**

In Stock
[Buy Now](https://www.adafruit.com/product/4007)
[Related Guides to the Product](https://learn.adafruit.com/products/4007/guides)
![Angled shot of an ultrasonic sonar distance sensor.](https://cdn-shop.adafruit.com/640x480/4007-05.jpg)

Featured
### STEMMA JST PH 2mm 3-Pin to Female Socket Cable - 200mm

[STEMMA JST PH 2mm 3-Pin to Female Socket Cable - 200mm](https://www.adafruit.com/product/3894)
This cable will let you turn a JST PH 3-pin cable port into 3 individual wires with high-quality 0.1" female header sockets on the end. We're carrying these to match up with our Hallowing, for extending and connecting sensors or LEDs - and the wires are even color coded!

<a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/3894)
[Related Guides to the Product](https://learn.adafruit.com/products/3894/guides)
![Angled shot of STEMMA JST PH 3-Pin to Female Header Cable - 200mm.](https://cdn-shop.adafruit.com/640x480/3894-03.jpg)

Featured
### Official Raspberry Pi Power Supply 5.1V 3A with USB C

[Official Raspberry Pi Power Supply 5.1V 3A with USB C](https://www.adafruit.com/product/4298)
The official Raspberry Pi USB-C power supply is here! And of course, we have 'em in classic Adafruit black! Superfast with just the right amount of cable length to get your Pi 4 projects up and running!

Best for use with Pi 4 series, [Pi...](https://www.adafruit.com/product/5814)

Out of Stock
[Buy Now](https://www.adafruit.com/product/4298)
[Related Guides to the Product](https://learn.adafruit.com/products/4298/guides)
![Angled shot of Official Raspberry Pi Power Supply 5.1V 3A with USB C with Power plug facing down. ](https://cdn-shop.adafruit.com/640x480/4298-04.jpg)

## Optional
Featured
### Premium Female/Female Jumper Wires - 20 x 6" (150mm)

[Premium Female/Female Jumper Wires - 20 x 6" (150mm)](https://www.adafruit.com/product/1950)
These female-female jumper wires are handy for making wire harnesses or jumpering between headers on PCB's. These premium jumper wires are 6" (150mm)&nbsp;long and come in a 'strip' of 20 (2&nbsp;pieces of each of ten rainbow colors). They have 0.1" female header contacts...

In Stock
[Buy Now](https://www.adafruit.com/product/1950)
[Related Guides to the Product](https://learn.adafruit.com/products/1950/guides)
![Top view of Premium Female/Female Jumper Wires - 20 x 6 (150mm) folded and fanned out.](https://cdn-shop.adafruit.com/640x480/1950-02.jpg)

Featured
### Mini Magnet Feet for RGB LED Matrices (Pack of 4)

[Mini Magnet Feet for RGB LED Matrices (Pack of 4)](https://www.adafruit.com/product/4631)
Got a glorious&nbsp;RGB Matrix project you want to mount and display in your workspace or home? If you have one of the matrix panels listed below, you'll need a pack of these **Mini-Magnet Feet.** &nbsp;We got these specifically&nbsp;for our RGB LED Matrices, which no longer...

In Stock
[Buy Now](https://www.adafruit.com/product/4631)
[Related Guides to the Product](https://learn.adafruit.com/products/4631/guides)
![Angled shot of four magnet feet.](https://cdn-shop.adafruit.com/640x480/4631-00.jpg)

# FunHouse Parking Assistant

## Build the FunHouse Parking Assistant

![](https://cdn-learn.adafruit.com/assets/assets/000/102/511/medium800/proximity_funPark-1559.jpg?1622586704)

You'll use the three JST PH 3-Pin ports on the FunHouse to control the ultrasonic distance sensor and the NeoPixel strip.

Info: 

## Cable Prep

The distance sensor uses power, ground, a digital output (to control pings), and a digital input (to read the signal). You can wire these four connections by using two of the JST ports.

Prep two of the cables by removing the ground from one and the power from the other as shown. Pry up the plastic tab holding the crimp connector and then slide the wire out of the housing.

Alternately, you can simply leave the extra two wires in place and simple insulate their ends to prevent accidental shorting.

![proximity_funPark-1541.jpg](https://cdn-learn.adafruit.com/assets/assets/000/102/512/medium640/proximity_funPark-1541.jpg?1622586836)

![proximity_funPark-1542.jpg](https://cdn-learn.adafruit.com/assets/assets/000/102/513/medium640/proximity_funPark-1542.jpg?1622586844)

![](https://cdn-learn.adafruit.com/assets/assets/000/102/515/medium800/proximity_funPark-1543.jpg?1622587053)

Plug the two cables into the A0 and A1 ports of the FunHouse.

![proximity_funPark-1544.jpg](https://cdn-learn.adafruit.com/assets/assets/000/102/517/medium640/proximity_funPark-1544.jpg?1622587069)

![proximity_funPark-1545.jpg](https://cdn-learn.adafruit.com/assets/assets/000/102/518/medium640/proximity_funPark-1545.jpg?1622587079)

Info: 

![](https://cdn-learn.adafruit.com/assets/assets/000/102/527/medium800/proximity_funPark-1550.jpg?1622587516)

You can plug the sensor into the JST cables directly, or use extension cables to connect the JST wires to the ultrasonic sensor as shown here:

- **3V to VCC**
- **A0 to Trig**
- **A1 to Echo**
- **Gnd to Gnd**

![proximity_funPark-1548.jpg](https://cdn-learn.adafruit.com/assets/assets/000/102/519/medium640/proximity_funPark-1548.jpg?1622587309)

![proximity_funPark-1547.jpg](https://cdn-learn.adafruit.com/assets/assets/000/102/520/medium640/proximity_funPark-1547.jpg?1622587319)

## NeoPixel Strip

Plug in the NeoPixel strip's JST plug to the A2 port on the FunHouse.

![proximity_funPark-1551.jpg](https://cdn-learn.adafruit.com/assets/assets/000/102/538/medium640/proximity_funPark-1551.jpg?1622587631)

![proximity_funPark-1552.jpg](https://cdn-learn.adafruit.com/assets/assets/000/102/539/medium640/proximity_funPark-1552.jpg?1622587638)

![](https://cdn-learn.adafruit.com/assets/assets/000/102/536/medium800/proximity_funPark-1553.jpg?1622587614)

You're now ready to code the FunHouse Parking Assistant using CircuitPython.

# FunHouse Parking Assistant

## Code the FunHouse Parking Assistant

## Install CircuitPython

The first thing to do is install CircuitPython on your Funhouse.&nbsp;[Follow this guide](https://learn.adafruit.com/adafruit-funhouse/circuitpython)&nbsp;to get it set up with the latest release version.

## Text Editor

Adafruit recommends using the Mu editor for using your CircuitPython code with the Funhouse. You can get more info in&nbsp;[this guide](https://learn.adafruit.com/welcome-to-circuitpython/installing-mu-editor).

## Shhhh... Secrets

In order for the Funhouse to connect to the internet, you'll need to include a&nbsp; **secrets.py** &nbsp;file on the board that contains your WiFi access point ssid and password, as well as your AIO key.

[Follow this guide page](https://learn.adafruit.com/adafruit-funhouse/circuitpython-internet-test)&nbsp;to get your&nbsp; **secrets.py** &nbsp;file set up.

## Download the Project Bundle

Your project will use a specific set of CircuitPython libraries and the&nbsp; **code.py** &nbsp;file. In order to get the libraries you need, click on the&nbsp; **Download Project Bundle** &nbsp;link below, and uncompress the .zip file.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/FunHouse_Parking/code.py

Next, drag the contents of the uncompressed bundle directory onto you microcontroller board&nbsp; **CIRCUITPY** &nbsp;drive, replacing any existing files or directories with the same names, and adding any new ones that are necessary.

![proximity_sensors_bundle_drag.jpg](https://cdn-learn.adafruit.com/assets/assets/000/102/451/medium640/proximity_sensors_bundle_drag.jpg?1622222784)

![](https://cdn-learn.adafruit.com/assets/assets/000/102/543/medium800thumb/proximity_ultrademo.jpg?1622595923)

## How it Works
First, you'll load the necessary libraries, including&nbsp; `adafruit_hcsr04` for using the ultrasonic distance sensor.

```python
import time
import board
import adafruit_hcsr04
import neopixel
from adafruit_funhouse import FunHouse
```

## Variables

Next, you'll set variables for the distance thresholds, in centimeters. You can adjust these as necessary for your particular garage/parking space and vehicle.

```python
SLOW_DISTANCE = 30  # distance (in centimeters) when you should slow
STOP_DISTANCE = 8  # distance when you should hit those brakes
```

## FunHouse and NeoPixels

Now, you'll set up the FunHouse and the NeoPixels.

```python
GREEN = 0x00FF00
AMBER = 0xF0D000
RED = 0xFF0000


funhouse = FunHouse(default_bg=None, scale=3)
funhouse.peripherals.dotstars.brightness = 0.05
funhouse.peripherals.dotstars.fill(GREEN)

pixel_pin = board.A2
num_pixels = 30
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.3, auto_write=False)
```

## Sonar

The ultrasonic distance sensor is set up on the FunHouse A0 pin for triggering a ping, and A1 for receiving the echo.

```python
sonar = adafruit_hcsr04.HCSR04(trigger_pin=board.A0, echo_pin=board.A1)
```

## Main Loop

Here's what happens in the main loop of the program. Inside of a try-except loop, the `sonar.distance` value is checked.

If it is greater than the `SLOW_DISTANCE` the NeoPixels are set to green.

If it is less than the `SLOW DISTANCE` and greater than the `STOP DISTANCE`, the NeoPixels are set to yellow and the FunHouse speaker plays a medium tone.

If the distance is less than the `STOP_DISTANCE`, the NeoPixels are set to red and the tone plays at a higher pitch.

```python
while True:
    try:
        print((sonar.distance,))

        if sonar.distance > SLOW_DISTANCE:
            funhouse.peripherals.dotstars.fill(GREEN)
            pixels.fill(GREEN)
            pixels.show()
        elif sonar.distance < SLOW_DISTANCE and sonar.distance > STOP_DISTANCE:
            funhouse.peripherals.dotstars.fill(AMBER)
            pixels.fill(AMBER)
            pixels.show()
            funhouse.peripherals.play_tone(1000, 0.3)
        elif sonar.distance < STOP_DISTANCE:
            funhouse.peripherals.dotstars.fill(RED)
            pixels.fill(RED)
            pixels.show()
            funhouse.peripherals.play_tone(2600, 0.3)

    except RuntimeError:
        print("Retrying!")
    time.sleep(0.01)
```

# FunHouse Parking Assistant

## Use the Parking Assistant

Depending on your parking space or garage, your options will vary for mounting the FunHouse, ultrasonic distance sensor, and NeoPixel strip.

In the example shown here, there is a post that provides a convenient mounting point, and isn't something we want to hit with the bumper!

It's good to start with a temporary mounting method, such as the gaffer's tape seen here. This allows you to test out the mounting positions to make sure you get a good distance read and that the NeoPixel strip is visible to the driver.

![](https://cdn-learn.adafruit.com/assets/assets/000/102/479/medium800/proximity_funPark-1504.jpg?1622416918)

![](https://cdn-learn.adafruit.com/assets/assets/000/102/480/medium800/proximity_funPark-1505.jpg?1622416932)

After testing and getting the sensor height to match your vehicle's bumper, you may want to use something a little more permanent, such as double stick, high-strength tape.

![](https://cdn-learn.adafruit.com/assets/assets/000/102/540/medium800/proximity_funPark-1513.jpg?1622587703)

Now, you can pull in as close as you need with ease by listening to the beeps and watching the NeoPixels change from green to yellow to red!

![](https://cdn-learn.adafruit.com/assets/assets/000/102/541/medium800thumb/proximity_fh_parking.jpg?1622587733)

This demonstration was door at an outside parking space -- this project works most easily inside a garage -- if you need to set it up in the outdoors, you'll want to use a water resistant enclosure, such as this one, to protect from the elements.

Featured
### Large Plastic Project Enclosure - Weatherproof with Clear Top

[Large Plastic Project Enclosure - Weatherproof with Clear Top](https://www.adafruit.com/product/905)
Store your project safe and sound in this nice weatherproof box with a clear top. We picked up this box because we like the machinable ABS plastic body and tough clear polycarbonate cover, the built in weatherproof gasket seal, and the easy-open screws that can be taken apart as many times as...

Out of Stock
[Buy Now](https://www.adafruit.com/product/905)
[Related Guides to the Product](https://learn.adafruit.com/products/905/guides)
![Angled Shot of the Large Plastic Project Enclosure (Interior/Open) - Weatherproof with Clear Top](https://cdn-shop.adafruit.com/640x480/905-08.jpg)

Featured
### Cable Gland PG-9 size - 0.158" to 0.252" Cable Diameter

[Cable Gland PG-9 size - 0.158" to 0.252" Cable Diameter](https://www.adafruit.com/product/761)
We have some great [waterproof and weather-proof items in the adafruit shop](https://www.adafruit.com/?q=waterproof&), but once you have a project built, you'll want to enclose it. But how to keep an enclosure weather/waterproof while still attaching cables for power, data...

In Stock
[Buy Now](https://www.adafruit.com/product/761)
[Related Guides to the Product](https://learn.adafruit.com/products/761/guides)
![Cable Gland PG-9 size](https://cdn-shop.adafruit.com/640x480/761-00.jpg)


## Guide Products

### Adafruit FunHouse - WiFi Home Automation Development Board

[Adafruit FunHouse - WiFi Home Automation Development Board](https://www.adafruit.com/product/4985)
Home is where the heart is...it's also where we keep all our electronic bits. So why not wire it up with sensors and actuators to turn our house into an electronic wonderland. Whether it's tracking the environmental temperature and humidity in your laundry room, or notifying you when...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4985)
[Related Guides to the Product](https://learn.adafruit.com/products/4985/guides)
### Adafruit NeoPixel LED Strip with 3-pin JST PH 2mm Connector

[Adafruit NeoPixel LED Strip with 3-pin JST PH 2mm Connector](https://www.adafruit.com/product/3919)
Plug in and glow, this **Adafruit NeoPixel LED Strip with JST PH Connector** has **30 total LEDs** in a **"60 LED per meter" spacing** , and is 0.5 meters long, in classy Adafruit Black. Its not too long, but has lots of glowing action.<a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/3919)
[Related Guides to the Product](https://learn.adafruit.com/products/3919/guides)
### Ultrasonic Distance Sensor - 3V or 5V - HC-SR04 compatible

[Ultrasonic Distance Sensor - 3V or 5V - HC-SR04 compatible](https://www.adafruit.com/product/4007)
If you're like me, you've dreamed of being a dolphin - smoothly gliding through the water. Using your echo-location abilities to detect tasty fish treats. Until genetic modifications catches up with our desires, we'll just have to make do with these handy&nbsp; **3V Ultrasonic...**

In Stock
[Buy Now](https://www.adafruit.com/product/4007)
[Related Guides to the Product](https://learn.adafruit.com/products/4007/guides)
### STEMMA JST PH 2mm 3-Pin to Female Socket Cable - 200mm

[STEMMA JST PH 2mm 3-Pin to Female Socket Cable - 200mm](https://www.adafruit.com/product/3894)
This cable will let you turn a JST PH 3-pin cable port into 3 individual wires with high-quality 0.1" female header sockets on the end. We're carrying these to match up with our Hallowing, for extending and connecting sensors or LEDs - and the wires are even color coded!

<a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/3894)
[Related Guides to the Product](https://learn.adafruit.com/products/3894/guides)
### Official Raspberry Pi Power Supply 5.1V 3A with USB C

[Official Raspberry Pi Power Supply 5.1V 3A with USB C](https://www.adafruit.com/product/4298)
The official Raspberry Pi USB-C power supply is here! And of course, we have 'em in classic Adafruit black! Superfast with just the right amount of cable length to get your Pi 4 projects up and running!

Best for use with Pi 4 series, [Pi...](https://www.adafruit.com/product/5814)

Out of Stock
[Buy Now](https://www.adafruit.com/product/4298)
[Related Guides to the Product](https://learn.adafruit.com/products/4298/guides)
### Premium Female/Female Jumper Wires - 20 x 6" (150mm)

[Premium Female/Female Jumper Wires - 20 x 6" (150mm)](https://www.adafruit.com/product/1950)
These female-female jumper wires are handy for making wire harnesses or jumpering between headers on PCB's. These premium jumper wires are 6" (150mm)&nbsp;long and come in a 'strip' of 20 (2&nbsp;pieces of each of ten rainbow colors). They have 0.1" female header contacts...

In Stock
[Buy Now](https://www.adafruit.com/product/1950)
[Related Guides to the Product](https://learn.adafruit.com/products/1950/guides)
### Mini Magnet Feet for RGB LED Matrices (Pack of 4)

[Mini Magnet Feet for RGB LED Matrices (Pack of 4)](https://www.adafruit.com/product/4631)
Got a glorious&nbsp;RGB Matrix project you want to mount and display in your workspace or home? If you have one of the matrix panels listed below, you'll need a pack of these **Mini-Magnet Feet.** &nbsp;We got these specifically&nbsp;for our RGB LED Matrices, which no longer...

In Stock
[Buy Now](https://www.adafruit.com/product/4631)
[Related Guides to the Product](https://learn.adafruit.com/products/4631/guides)
### Large Plastic Project Enclosure - Weatherproof with Clear Top

[Large Plastic Project Enclosure - Weatherproof with Clear Top](https://www.adafruit.com/product/905)
Store your project safe and sound in this nice weatherproof box with a clear top. We picked up this box because we like the machinable ABS plastic body and tough clear polycarbonate cover, the built in weatherproof gasket seal, and the easy-open screws that can be taken apart as many times as...

Out of Stock
[Buy Now](https://www.adafruit.com/product/905)
[Related Guides to the Product](https://learn.adafruit.com/products/905/guides)

## Related Guides

- [Adafruit FunHouse](https://learn.adafruit.com/adafruit-funhouse.md)
- [DIY Darksaber Build - 3D Print with PropMaker FeatherWing and BLE](https://learn.adafruit.com/ble-darksaber-propmaker.md)
- [Adafruit IO IOT Hub with the Adafruit FunHouse](https://learn.adafruit.com/adafruit-io-hub-with-the-adafruit-funhouse.md)
- [WiFi-Controlled NeoPixel Matrix LED Sign](https://learn.adafruit.com/iot-led-sign.md)
- [LED Matrix Scoreboard](https://learn.adafruit.com/led-matrix-scoreboard.md)
- [Creating FunHouse Projects with CircuitPython](https://learn.adafruit.com/creating-funhouse-projects-with-circuitpython.md)
- [Toddler Timer](https://learn.adafruit.com/toddler-timer.md)
- [RGB Matrix Dreidel Game](https://learn.adafruit.com/rgb-matrix-dreidel-game.md)
- [MagTag Weekly Showtimes Event Notifier](https://learn.adafruit.com/magtag-weekly-event-showtimes-display.md)
- [TRON DISC](https://learn.adafruit.com/trondisc.md)
- [Adafruit MagTag Project Selector](https://learn.adafruit.com/adafruit-magtag-project-selector.md)
- [Compost Friend!](https://learn.adafruit.com/compost-optimization-machine.md)
- [Set up Home Assistant with a Raspberry Pi](https://learn.adafruit.com/set-up-home-assistant-with-a-raspberry-pi.md)
- [DIY Pi 400 Keyboard Case](https://learn.adafruit.com/pc-keyboard-case.md)
- [Hang out your washing reminder - Adafruit IO + Vibration switch](https://learn.adafruit.com/hang-out-your-washing-reminder-adafruit-io-vibration-switch.md)
- [NeoPixel Remote: IR Control with WLED](https://learn.adafruit.com/neopixel-remote-ir-control-with-wled.md)
