In November I offered to use an Arduino UNO as a reversing monitor.


It's a simple concept

  • Arduino
  • Ultrasonic ping sensor
  • NeoPixel LED's


You use the ping sensor to detect the distance and change the colour of the NeoPixel to show Green for safe, Orange for Warning and Red for Stop.


In Part 1 ( ) I made this comment :-


Part Two

I'm still completing the final parts of the code.

There have been some other distractions (inc silly season) and I want do some more testing on the code.

I have found a suitable enclosure but I need to live test it before I fit it to the enclosure.


The Ping sensor uses a Tx and Rx ultrasonic transducer to send out a burst of high frequency audio.

This causes ringing of the transducer and can cause the mounting hardware to resonate which may give false readings.

I've been finding that doing this work in a confined room results in lots of echo, and therefore my "same distance' measurement isn't the same.


I've also had some issue with the IDE and the colourisation of keywords, that threw me off for a few days.




Short Distances

I was getting random short distances that made no sense.

I tried slowing down the Ping rate which seemed to help, but not make the problem go away.


I tried changing the hardware, using the theory it was faulty, but still I got random values that were short.


I tried a new library, various averaging approaches and searched the internet to see if the issue was common.

I found a site where the author used the "Running Median" of several readings, and while the code seemed to work at short distances, anything longer than 1m seemed to cause these random short distance values.


In the end I needed to start assembling the hardware in order to take some photos.

During the assembly I followed the instruction here that specified adding a 1000uF capacitor across the NeoPixel power wires.


    100uF instead of the 1000uF   photo source : three minions (me, myself and I)


When I next connected the assembled unit to the computer, it behaved perfectly with no short distances.


So my conclusion is that while the lack of capacitor didn't impact on the Neopixels, it did manifest in the Ping Sensor which was hanging across the same 5v source.




While you can hardcode the distance trigger points, it makes much more sense to allow the user to set their own.

The problem is how do you make something user friendly, and fairly clear while capturing the distance.


I elected to use a single pushbutton, and detect it at power-up.

If it is pressed and held at power-up, the display changed to three Green pixels to indicate the SAFE distance is stored when you push the button.

Set_SAFE.jpg Set_WARN.jpg  Set_STOP.jpg

photo source : three minions (me, myself and I)


Once you have set the SAFE distance, the display changes to three Blue pixels to indicate the WARN distance when you push the button.

If it is pressed, then the display changed to three Red pixels to indicate the STOP distance is stored when you push the button.

Once it has stored all three values, it returns to normal.




When I started I was intending to use Orange for the Warning colour.

NeoPixels will do Orange but the brightness is so much less that I felt you may struggle to see it in bright daylight.

When you send the colour it is in the form of Red value, Green value, Blue value with a range of 0-255.

Hence RED is 255, 0, 0, GREEN is 0, 255, 0 and BLUE is 0, 0, 255 and so it is the next brightest colour available.





While the display is obvious, if the Ping Sensor is not working, or the distances aren't stored, then the sketch goes into an Error display mode.

I elected to make half the display Red while the other half was blank and alternate at about a 1 second rate.


It becomes very obvious there is an issue.

It is not easy to continually detect the Ping Sensor, as the library returns distances greater than the maximum as a zero, just as you get if there is no sensor.


I included a blanking routine that if it detected the same distance 120 times (approx. 60 secs) it made blanked the display.

If the ping sensor went faulty this would kick in, and it wouldn't come out of it when you reached the SAFE distance (Green).


Hence I think I covered all the errors I could.




This version was done for The Shed Magazine which use this version of Arduino UNO.

It allowed me to connect everything to the pins using female to female jumpers, but the same concept will work for a normal UNO.




photo source : three minions (me, myself and I)


The case is a food type container from a large retailer and at $2 makes a very suitable enclosure


I intend to make another version using a Prototype board to connect to the UNO that element14 kindly supplied



Did it work

Since my daughter moved out, I don't have a parking issue, but if she returns this would be much better than the "stick that moves" we used to have before.


The photos below show the false wall I put in my garage to test it out.

I was very happy with the results.

SAFE.jpg  WARN.jpg  STOP.jpg

photo source : three minions (me, myself and I)


Final STOP distance.jpg


This is the final distance, and from the drivers seat looks like it is touching.


Normally you would be reversing into the garage and having the issue of parking in the right spot, but everyone's needs are different, and this works forward or back.


The relative position of the display v the sensor may need changing to suit the vehicle and direction.

I mounted it over to the right to allow viewing in an external mirror.





Attached is the sketch and libraries needed to run it.

There are plenty of comments because later I won't remember why I did xyz, or what I was thinking.

Comments take no room in the compiled code but do make it easier for others to use your sketch.