Rangefinder for Garage Parking With Arduino

6,230

129

23

About: I like to develop android apps and electronics devices that can be controlled by that apps. My first pc was a commodore VIC20 hacked to program Eprom chips :)

This simple project will help you park your car in the garage by displaying the distance from objects in front of your car's bumper.
A 'Stop' message will tell you when it's time to stop.
The project is based on the usuals HC-SR04 or Parallax Ping))) (tm) ultrasonic rangefinders and an Arduino board.
I used the Leonardo but it should work on any other original or compatible board.

For the display I chose a matrix version for its size and for aesthetic reasons.

Step 1: What You Need...

To build this project you need:

  1. An Arduino board:
    An original or compatible board should work as the code doesn't make use of specialized pins/function.
    You can find it everywhere on the internet or maybe you have one unused in a drawer in your lab.
  2. An HC-SR04 or Parallax Ping))) ultrasonic rangefinder:
    They are commonly used with Arduino projects so, probably, you already have it.
    Anyway here are some links:
    - Parallax Ping))) on Parallax
    - HC-SR04 on Sparkfun
    - Parallax Ping)) on Pololu
    - HC-SR04 search result from Ebay
  3. The Four matrix display:
    I bought it from IOTMODULES on Ebay: 4 Way MAX7219 DOT MATRIX
    In case the link doesn't work try contact them on their Ebay store.
  4. Soldering skills, of course :)

Step 2: Build the Project...

Download the arduinorangefinder.pdf schematic diagram.
You can find attached also the HC-SR04 pdf and the ping))) pdf, only for your reference.

The electronic diagram is very simple, follow it exactly.
I suggest to extend the wirings for the display and sensor of about 1 meter (see image1) so you can place them more easily later.

In the image2 you can see how to solder the power supply pins for the display and sensor: +5V from the display and Vcc from the sensor needs to be soldered togheter.
Every other pin must have its own terminal.

Image5 is the Ping))) version of the project.

Go to the next step when ready...

Step 3: Arduino Code...

It's time to work on the Arduino side.

Download the attached MD_MAX72XX.zip library and install it from the IDE (sketch->import library).

Now unzip and load the MeasureDistanceV200.ino sketch and let's look into it.
There are several lines you can edit:

1) The Matrix display type:
the supplied library supports 4 matrix display type so it shuold work with most displays in the market. Just uncomment one define at a time and upload the code to Arduino to see if it match your display.

2) The sensor type:
uncomment only the line that match your sensor.

3) Choose your preferred measuring unit from centimeters or inches:
uncomment only the right one, a warning has been set in the conditional compilation, it will show you what you have chosen.

Now set the distances as you prefer, you can modify them later when the project will be in place.

Upload the code and check if all works.
If you get trouble please double check wirings and connections.

Update 2019/03/30 - The code has been updated:
> New matrix display library, it supports 4 display type (a lot of documentation inside the library)
Credits to majicdesigns

Update 2019/01/10 - The code has been updated:
> Added the possibility to choose the measuring unit from centimeters or inches

Update 2017/12/30 - The code has been updated:
> Turn off the display when standstill at STOP distance for more than 10 seconds!

Step 4: The Project at Work...

Measure the height of the most prominent part of the bumper of your car from the floor.
Attach the sensor close to the wall, to the height you measured.

I used a polystyrene foam sheet in which I made a slot for the sensor (see image).

Now place the display so you can see it from your car.

Try to enter by car and check the distances, adjust them in the Arduino code and reupload it if need.

Share

    Recommendations

    • Trash to Treasure

      Trash to Treasure
    • Tape Contest

      Tape Contest
    • Arduino Contest 2019

      Arduino Contest 2019

    23 Discussions

    0
    None
    sblindheim

    Question 25 days ago on Step 4

    Hi, I bought the four Matrix display from the site you linked to, did everything in your instructable, yet, somehow, the display is in the wrong order. Example; m1: !! m2: p! m3: to m4: S, so the display is showing !! p! to S. Any idea on how to change the order. I've double and triple checked my wiring, but I cant figure it out.

    4 answers
    1
    None
    AppsByDavideVsblindheim

    Answer 20 days ago

    2019/03/30 > Code and files updated: new display library!
    Let me know if it works for you!
    Have a nice day
    \\Davide

    0
    None
    AppsByDavideVsblindheim

    Answer 24 days ago

    Hello, it looks like the display circuit, internally, has been changed and doesn't match the library in the arduino code.
    Someone other reported this issue. I will implement this new (hope universal) library as soon as I'll have some free time (It's not my first job):

    https://majicdesigns.github.io/MD_MAX72XX/

    You can try it yourself if you want , it shouldn't be difficult.
    The library supports 4 different matrix display type. (read the documentation on the site above)
    Have a nice day!
    \\Davide

    0
    None
    sblindheimAppsByDavideV

    Reply 24 days ago

    Hi! Thank you for the quick response. I will try myself, but arduino libraries is not something I have used a lot. Looking forward to seeing your new library, and I totally understand this isn't your first job. Thanks again!

    0
    None
    AppsByDavideVsblindheim

    Reply 24 days ago

    Perfect!
    I forgot to say that the above library comes with simple examples. You can try and see in few minutes if your display works correctly.
    Let me know if you will do it before me :)

    0
    None
    AppsByDavideVDennisB36

    Reply 3 months ago

    Hello DennisB36,
    Tutorial and code updated to show distance in centimeters or inches.
    Follow the tutorial and choose the right #define in code

    Bye
    Davide

    0
    None
    AppsByDavideVAppsByDavideV

    Reply 3 months ago

    Hi, the tutorial and code has been updated.
    Now supports centimeters and inches.

    Bye
    Davide

    0
    None
    denxmail

    1 year ago

    Hi,

    Nice job! I just found this and realized that my project is quite the same. I added an ambient light sensor to detect the car (based on its light on) to activate/deactivate the display. Check my one here:

    https://www.instructables.com/id/Garage-Parking-He...

    Anyway your display is much better than mine - and a lot simpler. Great work!

    1 reply
    0
    None
    AppsByDavideVdenxmail

    Reply 1 year ago

    Thank you, i like your work too, The light sensor is a good idea :)

    0
    None
    AppsByDavideV

    1 year ago

    Hello Everyone!

    The Arduino code has been updated, now the display turns off when standstill at STOP position for more than 10 seconds!

    0
    None
    IvanJ60

    1 year ago

    great
    how to turn off the display STOP when the car is parked after 5 minutes ??
    When a car is not in the garage the display turns off and that's ok.
    thank you

    1 reply
    0
    None
    AppsByDavideVIvanJ60

    Reply 1 year ago

    Hi,

    i think it should be possible.
    I will try when i will have some free time.

    Stay tuned :)

    0
    None
    ScottD172

    1 year ago

    HOW IN THE WORLD DID YOU FIND THAT LIBRARY?

    Great work. Stupendous. I have been searching high and low for a library that can work with the 4 digits in a row. I did a nice scrolling clock but had to cut them apart and rotate them 90 degrees each. NOBODY seemed to have a library that could drive that 8x32 (4-module) unit. And they do not cut apart easily.

    So EXCELLENT WORK!

    1 reply
    0
    None
    AppsByDavideVScottD172

    Reply 1 year ago

    Hi ScottD172,

    thank you :)
    But i must say this library is not mine. I just sligtly modified it for my needs.

    Credits to:
    Iotmodules https://github.com/iotmodules/fourMatrix

    0
    None
    hs3xha

    2 years ago

    Thank you.

    0
    None
    andhikategas

    2 years ago

    If i want to change the matrix display with lcd display, is it still working ? and what about the source code . thx

    1 reply
    0
    None
    AppsByDavideVandhikategas

    Reply 2 years ago

    Hi,

    of couse you can use an LCD modifying the code. The goal of the matrix was to read it at an higher distance (few meters).
    At this moment i haven't an LCD to develop the new code but it should be simple with a little of programming skill.
    Just send the measure referring the LCD library and connect the LCD following examples on internet.

    Bye

    0
    None
    JoeP151

    2 years ago

    The wife NEEDS this!