My First Robot

So, I have been kind of dabbling with this thing for maybe 6 months (idea to conception) and well I don’t know what I’m doing wrong but it just doesn’t work the way I had expected it to. Maybe it has something to do with the IR sensor but it seems like it will avoid different colors of flooring in my office. Well in doing so it will end up completely ignoring walls and such and well not avoid them as planned. I have tried to make it as modular as possible. It’s still a work in progress. If you guys have any suggestions I would love to hear them.

Move and Obstacle avoidance

  • Actuators / output devices: one servo, Tamyia Gear box 58:1
  • CPU: Arduino
  • Power source: 4 AA batteries
  • Sensors / input devices: Sharp GP2Y0A21YK0F IR sensor
  • Target environment: indoor

This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/my-first-robot-20

First Try!

debugging the values of the IR sensor over USB to find out what values you are getting.

Sounds like the ir sensor is picking up contrasting colors

I would guess if you have a downward facing ir sensor for edge detection it is picking up the changeover from a lighter surface to black.  My little bot won’t drive onto my area rug because he doesn;'t like the black border, but  it will drive fine on a fully black surface.  IF you are using more than one ir (one for wall detection and one for edge detection) it might help to look at what order you’re reading them in your code to see if you are just giving priority to the edge detection instead of the obstacle sensor.  Good luck.

I actually only have the one

I actually only have the one IR sensor

good catch… "else if

good catch… “else if (range >= 500)” now reads “else if (range > 500)”