Simple Parking Sensor




An experienced manager in Hi-Tech that never gets bored with technology or life
My car has only parking sensor for the Reverse, so when I enter the Garage there is no way to know if I am close enough to the wall to allow the door to close or too close that I can hit the wall with the car. So, decided to build a parking sensor that will be fixed on the garage wall. One of the limitations that I got is that there is no power nearby, so the parking sensor had to be battery powered.

Started it as first project with Netduino, that was chewing power. Found out that the Netduino board does not support power saver mode of the ARM processor, moved to Fio based Arduino board, and optimized power consumption over time. Now, the device can remain about two months without recharging battery. Still, in the future I will move to a different, more power conservative processor (probably the MSP430 from TI or by its name LaunchPad).

  • Battery powered
  • Requires charging only once in 60 days or more
  • Low cost
  • Easy to assemble
  • 4 LEDs indicating distance
  • Support single or multiple LEDs lights together

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Components Required

The following are the components you will need:
1. Arduino, better take the Fio based board or another one that does not have on-board FTDI
2. A 2,000 mAH LiPo battery that fits the Fio (the connector matches the Fio battery connector)
3. 4x Bright LEDs, 2xGreen, 1xYellow, 1xRed
4. 4x Resistors of 270 Ohm
5. small bread-board to solder the resistors and LEDs
6. LV-MaxSonar EZ1 MB1010 distance sensor
7, Some cables to connect LED board and the sensor

If you are using the Fio (recommended), you would also need a 3.3V FTDI board to program it.

If you do have power nearby the device, then you can buy any Arduino board instead of the battery and see some notes in next steps for power considerations.

Where to buy?
All goods can be purchased at your favorite electronics shop. None of those are very special components. One of the places is obviously Sparkfun (http://www,

Step 2: How It Works

When you are far from hitting the wall, the first green LED will turn on, then when getting closer, the 2nd one, then the yellow LED and finally the red LED will light up. You should stop when the red LED is on.

When no change in distance for some time (5 seconds), the device will turn off all LEDs and go to sleep. This fits the scenario of car parking in the garage or no car at the garage (where did you go :-)?).

The program is fairly simple, read analog input from the sensor, test the value against some thresholds and based on the result, set the number of LEDs to light up. Testing amount of time with no change in status and if that is for 5 seconds, the processor is put to sleep to preserve power. The processor wakes up every second to see if anything changed. If not, back to sleep. When in sleep, the entire device will consume 0.4mA and when working (without LEDs) it consumes several mA. When only one LED is lightening at a time, consumption is about 15mA. I tried 2 seconds of sleep as well, but it gave an awkward feeling when driving in as sometimes it took 2 seconds really before you saw some light... obviously not a good thing for people on the rush.

If you operate the device in the mode of single LED lightening at a time, expect about 2 months between recharging. If all LEDs that fit the distance will light up simultaneously, expect about a month between recharging.

To shorten the time the processor is up, I used 115,200 baud rate for the serial (only used for debugging). This reduced the awake time substantially. Removing serial output can further reduce awake time, but not dramatically I think.

Step 3: Assembly Instructions

Solder long cables to the sensor Vcc, GND and AN holes.
Connect Vcc to Arduino 3.3V
Connect Gnd to Arduino GND
Connect AN from Sensor to Analog  0 input of Arduino

Solder the 4 LEDs in the order of Green/Green/Yellow/Red. Note the polarity and see diagram attached
Set a resistor in series of each LED positive leg.
Connect the LEDs to Arduino as following:
  Digital pin 5 of Arduino to left most Green LED
  Digital pin 6 of Arduino to 2nd Green LED
  Digital pin 11 of Arduino to Yellow LED
  Digital pin 12 of Arduino to Red LED

Connect the FTDI (note the polarity) to the Arduino board and connect the FTDI to your USB.
Download the program to the Arduino board. If you want to see some debug output, make sure to change the Arduino terminal to 115,200 baud rate.
Connect the battery and let it charge (Fio has an on-board charger and LED indicator for the charging status).
When complete, put the thing in a box and you are done.

Special Notes;
If your parking space is outdoor, please ensure good sealing for the device and put the sensor in a shielded place (shield from rain). I have the sensor in outdoor shielded by window sill which is good enough. I placed some rubber between the two parts of the box and closed firmly. There is a flavor of the sensor that is designed for outdoor... but it cost much more and I am not sure there is good reason to spend that money. It works at my home for 7 months with no issues.

Step 4: Configuration and Parameters

You can change some parameters of configuration to the device in the program, Code has enough comments to tell you what to do. Basically you can:
1. Set the time to turn display off to anything you want. The code now uses 5 seconds (line 73).
2. If you want all LEDs that indicates a distance to light up together (much easier to read), then change the variable runningLeds to false (line 70). This will cost you in time between recharging on one hand, but is not that important if you are using an external power.
3. If you want to change the wiring from described, all you need is to modify the Leds array (line 65).
4. If you want more LEDs or less, you will need to change: NUM_LEDS (line 64), assign the new LED pin to Leds array (line 65) and add level threshold for it in ReadDistanceSensor() function
5. If you are using external power, you can disable the sleep code of the ARM, as there is no need for it. It is also possible to change the variable wdtTime code from 6 to 3 or less (line 79 ). That will be good enough.

  The picture of the code is from AVR IDE, I simply hate to use Arduino IDE for editing code and the Visual Studio plugin works so-so.

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    11 Discussions


    4 years ago on Introduction

    Hi what sensors would benefit my carpark system. I'm using netduino though.I'm doing a security system for my school project.Could you provide me with a little help? :-) my email is


    Reply 5 years ago on Introduction

    There is schematic for the LEDs connection inside.

    The piece that is not drawn in schematic is the sensor side, however here is the description to connecting it, should be fairly simple to handle without schematic I think:

    Solder long cables to the sensor Vcc, GND and AN holes.

    Connect Vcc to Arduino 3.3V
    Connect Gnd to Arduino GND
    Connect AN from Sensor to Analog 0 input of Arduino


    6 years ago on Introduction

    hey.. i have a question.. how about if i'm not going to monitor the distance.. what i want to do is.. the sensor will be on the top and i just want to monitor whether there is a car parked on the lot or none. can you give me some idea bout that? thanks..

    1 reply

    Reply 6 years ago on Introduction

    Sure, for that matter you still need a distance sensor. If it is cars, you better use ultrasonic sensor and not IR sensor. Cars paint and sun can reflect lights and make IR distance sensors fail.

    The presence of a car will be detected as an object sensed with shorter distance from sensor compared to no car (the distance difference would be the car height).

    What you will need to change in the code, aside from multiple LEDs is making the Arduino run forever and not go to sleep.


    7 years ago on Introduction

    Do you know if this ultrasonic sensor has any significant affects on animals? I'm afraid this might disturb my cat and/or other animals in the neighborhood.

    1 reply

    Reply 7 years ago on Introduction

    I know that cats are still climbing on my car when it is parking in this parking (their footprints on my front window are the least fun of it). I know the cats are going under my car too to get some shade now in the Summer, so I guess this has no effect on them at all.
    I don't have a dog, but sometimes friends with dogs comes to visit and didn't seem to have any effect on them either.

    I know that the frequency used by this sensor is VERY common in the security sensors too. Before PIR sensors where adopted, many alarm systems had an ultrasonic sensor to detect people in the room/salon/house.

    If you still have doubts, dig in the MaxBotics site:


    7 years ago on Introduction

    OK, smart guy :) just kidding. But seriously, how do you know when your car is in far enough to close the door? I have been dreaming about modding my safety eye sensors or some such set up to let me know as soon as I clear the opening so I can stop and leave as much room in front of the car as possible. So do you just know which LED you need to stop at? Or what? I mean, I know this will stop you from running in to the wall but how do you know when to stop? Am I even making sense?


    1 reply

    Reply 7 years ago on Introduction

    Hi again,
    The way I set it up (and tuned it with the thresholds in the code) is such that the distance sensor will cause the lit of the last LED (and it is Red one too) when the distance is about 20cm. I put the sensor itself under a window decoration so it is both hidden and I get better rain protection for it. It is then the car is about 15cm from the wall/window. Due to size of the car and parking space this leaves about same distance to the parking space door/gate. My wife car is even slightly longer and leaves even less space in the back. Bottom line I am measuring the distance in the front and turning the LEDs based on that distance.

    You could take a very different approach and do a cross beam close to the door that will trigger an LED on when you cross it and off when the beam is not crossed again, or with some processor and timing you can do a bit more sophisticated display if you like. I wanted to avoid beam crossing work as it requires things to be installed on both ends and you do not get any sense of progression like with distance sensor.

    Hope this helps.


    7 years ago on Introduction

    Not to be anti-techie, but my solution is to hang a foam anti-stress ball from a cord (I use paracord to make it cool) from the rafter of my garage roof. When the ball hits the windshield I stop.

    Works every time.

    Cost = $0.00

    1 reply

    Reply 7 years ago on Introduction

    This particular parking space has no roof, and yes there are other ways to solve the problem without technology. One can install rubber stoppers and few more ideas to address the same problem.