Computing stuff tied to the physical world

Let’s build a GPA

If you have a garage – and a car – you may be familiar with this little recurring problem: parking your car and not bumping into the wall in front you. You want to place the car as close as possible to the wall… but no further. Scratching or damaging the car is no fun.

So let’s make some sort of “Garage Parking Aid” to solve this. It needs to sense the distance from the wall to our car, and tell us how much further we can go. So we’re going to need:

  • a contact-less distance sensor
  • an indicator to let us know what it sees
  • a microcontroller to make everything work together
  • a power source

Here’s a commercial unit seen on internet, to illustrate the idea – but hey, that’s no fun:

Garageparkingsensor

For power, we’d like to make this thing easy to use and place on the wall in the garage, without having to string wires to it to supply power – so running on battery power would be nice. And not having to replace that battery every month or so would be even nicer.

Another requirement for this project, is that it should be really easy to build by anyone. That means: no special parts, and no soldering. That also means: no small Surface Mounted Device (SMD) components, only “through-hole” parts, i.e. components we can stick into a breadboard and hook up with simply a few wires.

Sensor

For sensing the car, there are a range of options we can choose from:

A mechanical switch would be low-cost: perhaps in the form or switches on the floor, a pressure mat, or even some sort of trip-wire placed in front of the wall? Nah, it’ll be hard to make any of these work robustly for a long time, and it’d be mighty inconvenient due to the wires needed to connect it all up to the rest of the circuit.

A light beam might work, but you need several of them if you want to measure distances, not just detect a single threshold. Again some wires involved, and probably a little mirror on the other end. Not impossible and clearly contact-less, but not convenient either.

A PIR (Passive Infrared) sensor is great for detecting motion, but it can’t measure distance, unfortunately. It reacts to heat, but is really meant for the detection body warmth – and the heat from a car arriving home from a long trip is bound to overwhelm the sensor, making it even more unlikely that a PIR sensor could be used to distinguish far from near.

An ultrasonic range finder – now that’s a lot more practical: when properly positioned on the wall, it could measure the distance to the nearest object in front of it. There is one unfortunate drawback though: it drives cats and dogs crazy – so let’s not go there…

There are small radar units which bounce a radar beam off an object and measure the (very short) elapsed time until it comes back. There are some very small and low-cost units on the market, but they are not able to measure at very close range. Using these for distances under 1 meter is going to be problematic.

We’re starting to run out of options, but there is also the infrared range finder – these units from Sharp work by reflecting an infrared beam off an object and measuring the angle at which it comes back, or rather, using the parallax effect:

Triangulation

(the above image is from ROBOTC.net)

Let’s pick such an IR sensor as first candidate, and see if it fits in.

Indicator

One of the first ideas for an indicator in this project was to use a 7-segment display to report measured distances in units of 10 cm: 1 = 10 cm, 2 = 20 cm, etc – up to 9 = 90 cm.

Note that the 7-segment display needs to be fairly large to be readable from 2..3 meters away, i.e. from the driver’s seat while approaching the wall. Also, it would require at least 7 current-limited output pins, as provided by a shift register or I2C I/O expander.

A much simpler option, is a single LED – blinking at a rate proportional to the distance, or rather: inversely proportional. A very fast-blinking LED would be a natural warning signal, whereas slow-blinking automatically gets associated with “keep going, you’re fine”.

Are there more options? Sure – how about a little servo moving a large needle on a dial, or a beeper with a loud sound. But if you think about it – proportional motion is not really easier to “read” than simple blinking, and sound is perhaps not a good idea when there’s a loud engine noise coming from the car itself.

Let’s explore the blinking LED and the 7-segment display, and see how it goes.

Microcontroller

This is almost a no-brainer, after the Getting Started series: if we can somehow fit the – breadboard-friendly! – LPC810 ┬ÁC to this project, it’ll build on what we already know.

Power

As mentioned before, the GPA needs to run on battery power, if possible. A coin cell would not last very long, but it’d be nice if we could use 2, 3, or 4 AA cells. These could be either disposable alkaline batteries, or the more environmentally-friendly “Eneloop” batteries. Using traditional NiMh batteries is not recommended, due to their high self-discharge rate.

Construction

To make it very simple to build this circuit, we’ll be using a solderless breadboard in this project. Though originally intended for experimentation and temporary builds, it’s also possible to use these for more permanent projects, as you will see.

There are many ways to put a more permanent twist on the GPA, from a simple cardboard or wooden enclosure, to 3D-printing a custom case or mounting brackets. In a way, the enclosure is where things get personal: whereas an electrical circuit is bound by its design constraints to operate properly, with the enclosure you can be as creative as you like!

DSC 4864

This series will show how to build the above GPA – simple & rugged enough for daily use.

If cars or garages are not your thing: just add motors and wheels to turn it into a robot!

[Back to article index]