Sunday, January 5, 2014

One ping, and one ping only

While bouncing off the walls with whiskers is a lot of fun, for the sake of my walls it is time to find another method of obstacle avoidance that involves less blunt force trauma.  

There are many ways to detect obstacles without touching them including infra red LEDs, ultra sonic, lasers and cameras to name a few common types.  Each has benefits and trade offs choosing the right choice will depend on the use case.

Today I am testing out the Ping ultrasonic distance sensor to see how it performs.  Hopefully it will be suitable as the primary obstacle detection sensor for Boe-bot.  

Ultra sonic distance detection works on the principle of sending out high frequency pulses and listening for the echo of these pulse off objects.  The longer the time it takes for the echo to return from an object, the farther away it is.  Since the speed of the wave is assumed to be constant (and it pretty much is), using the formula Rate*Time=Distance, you can solve for distance.  Simple in theory but as we'll see the devil is in the details.  

Test Setup

The ping sensor was mounted on Boe-bot's breadboard area.  For the experiment, I removed the whiskers.  

Since this is a test of distance measurement and object detection, having an easy and repeatable way to measure distances is important to collecting good data.  Surprisingly, a quilting board laid out with an inch wide grid pattern from the craft store met my needs.  With this setup I was able to test distances of up to 60 inches.  Putting the setup on a table with several feet of room around it gave me confidence that I wouldn't get noise in my data.  



The tests
A cardboard box (shown in the image above) with the face perpendicular to Boe-bot and no horizontal offset showed accurate distance measurement throughout the entire test range (5 to 60 inches).  


Actual DistancePing MeasuredDifference
6059.840.26%
5050.000.00%
4039.760.59%
3030.71-2.36%
2020.08-0.39%
1010.24-2.36%
55.12-2.36%

The story was very different once the box was angled.  Turning the cardboard box to face Boe-bot at a 45 degree angle resulted in a failure to detect the box from any distance!  The Ping sensor was able to detect the box once it was less than 30 degrees.  

The next test was to see how object shape impacted detection.  A cylinder with a six inch diameter was used to if the round face would impact accuracy.    


Actual DistancePing MeasuredDifference
6061.02-1.71%
5050.79-1.57%
4040.94-2.36%
3030.71-2.36%
2020.47-2.36%
1010.24-2.36%
55.51-10.24%

The next step is to see how well the Ping performs detecting objects off of the central axis.  To test this, I took an object and moved it in one inch increments from directly in front of the Ping until it was no longer detected.  The following graphic (yellow lines) shows the limits of where Ping was able to detect objects.  


In the real world, Boe-bot face could multiple objects at the same time.  This presents a unique challenge since the Ping sensor only returns a single value with each measurement.  I tested this by placing three objects in front of Boe-bot, each of which the Ping sensor was able to detect individually.  A large object at 40 inches, a medium one at 30 inches and small object at 20 inches.  In this scenario, the Ping sensor detected the medium object at 31 inches.  I then removed the small object and moved the large object to 20 inches, this resulted in a measurement of 20 inches.  


Not every object Boe-bot will come into contact with (or hopefully not come into contact with) is a regularly shaped object.  The final test is a crumpled ball of aluminum foil.  With a variety of faces, it was like some kind of magical top.  The aluminum foil ball would appear and disappear depending on the angle.


Next steps
That is a lot of data!  The next article will dig into analyzing these findings and how the Ping can be applied to helping Boe-bot navigate.


No comments:

Post a Comment