Tuesday, July 16, 2013

Adding Ping Ultrasonic Distance Sensors, So It Don't Go Boom!

I'm adding ultrasonic distance sensors to my telepresence robot to keep it from running into walls or other obstacles which may damage it. Ping ultrasonic sensors use sonar to create a pulse that it can read by sending a signal out and seeing how fast it bounces back. In my code, I generally say if the sensor returns a value that is under 20 centimeters, then cut the motors. I have yet to figure out what happens once the robot is within that 20 centimeters. Since the power to the motors is cut, how am I going to get out of that situation? I've got a couple ideas but want to think about it a little more. 


I've got two sensors working really well right now. They both work completely independent of each other and they don't interfere with the motor code that's on the Arduino Mega. So far everyone's playing nice together. I found a library that allows an array of sensors to work together and so far, it's doing everything I want to do with the sensors. It's called NewPing and can support an array up to 15 sensors.

Parallax sells these sensors for $29 but I found them on ebay at 5 for $10. I plan to have 4 total; two in the front at about 20 degree angles and the same for the back.
Proof of concept for the sensors. The finished product will look way better.

No comments:

Post a Comment