Using Servo motors for robot obstacle avoidance


#1

I would like to experiment with the obstacle avoidance sketches in the Arduino Makeblock libraries.

I have seen examples on the Internet where the ultrasonic sensor is swiveled to the left and then to the right to determine which direction the robot should turn.

Would the sensor have to be mounted on a servo motor in order to do this? Has anyone got any practical tips?


#2

Hi

Your program would flow something like this…

  1. Move forward, check sensor. Is something in front of me?
  • if sensor reading says there is nothing real close (i.e. 20cm) go back to step 1.
  • if sensor reading says there is something close (i.e. 10cm) go to step 2.
  • if sensor reading says there is something really close (i.e. 5cm) back up a few cms then go to step 2.
  1. swing sensor using servo to the left, record sensor reading then swing sensor using servo to the right, record sensor reading.

  2. If left reading > right reading, then left is more open than right so turn robot to the left and go back to step 1.

  3. If right reading > left reading, then right is more open then left so turn robot to the right and go back to step 1.

Add lights and beeps as desired.

Regards
Michael


#3