Collision Detection Robot

Hi Guys,

I am currently working on a collision detection wheeled robot using Arduino and a Parallax Ping sensor…

I know there is lots of code out there for this type of thing but I learn better when I write some code myself first, then I will feel comfortable using more ‘advanced’ code…it’s just a thing with me, heh…

So, with that in mind, I thought I’d throw out my current understanding of how the code should work and see if I can get some input from ya’ll to see if I am moving in the right direction…

Okay, here goes…the ping sensor bounces sound off objects in its path. It then sends the distances back to the Arduino…so, if I write some IF statements that say something like “if an object is within 1 foot of Herbert(my robot’s name), send control info to the motors to turn left 90 degrees”…

This is super simplified and I know it…I just want to know if that is the basic ‘gist’ of collision avoidance code…

Eventually Herbert (named after H.G. Wells and as an homage to Star Trek) is going to have IR sensors down low in front and on the sides to help him see his surroundings, but we’re starting out with just the ping sensor…

Once again, I’m not looking for code…I know there is code out there…I want to understand the mechanisms of the code on my own…

Thanks again for all your help!

Annie in Idaho

You have the basics down. Translating that into code is pretty simple.

Handling the case where the left turn does not result in an obstacle free path is the tricky part.

Thanks, Paul…

I’ll start slow…slow motor speed, simple code, etc…then I’ll work my way up!

By this weekend I should have some YouTube video of the Herbert project so far…I wish I woulda got a shot of the smoking transistors the other day…that would’ve been great video! Oh well, next time I blow something up I’ll try to get a shot, lol…

Hey Annie, welcome to the wonderful world of Arduino! :slight_smile:

There are alot people using the Arduino and other MCU’s to build robots at http://letsmakerobots.com, alot of people upload their code too to give you some examples. :slight_smile:

Take a look at this one in particular, I think it was posted on Arduino a while back but couldn’t find the link:

Happy building! Can’t wait to see it rockin. :slight_smile: