Experiment 6 Obstacle Avoidance

Share for us

The wiring for this experiment is based on Experiment 5, so after the last experiment, just turn it off. Connect the SunFounder Uno board to your computer with a USB data cable. Upload the sketch under Smart Car V2.0 for Arduino\Code\Car_6_AvoidObstacle, and then remove the USB cable.

Experimental Principle

The principle of this experiment is similar to that of experiment 5, and the difference is when it detects an obstacle 30cm ahead, it will turn right to avoid.

Note: DO NOT increase the car’s speed too much, in case that the sensor in the front may be damaged due to great inertial effect upon stop. Besides, the ultrasonic can only detects the obstacle in front of the car, that is, the car will turn right every time it detects an obstacle 30cm in front.

Experimental Phenomena

Turn on the switch. When the car detects an obstacle in front (within 30cm), it will turn right to avoid it; when there is no obstacle ahead, it will just move forward.