Note

Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.

Why Join?

  • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.

  • Learn & Share: Exchange tips and tutorials to enhance your skills.

  • Exclusive Previews: Get early access to new product announcements and sneak peeks.

  • Special Discounts: Enjoy exclusive discounts on our newest products.

  • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.

👉 Ready to explore and create with us? Click [here] and join today!

11. Obstacle Avoidance¶

In this project, the Zeus car will move forward automatically, and two obstacle avoidance modules and an ultrasonic module will prevent it from hitting obstacles.



How to do?

  1. The ESP32-CAM and the Arduino board share the same RX (receive) and TX (transmit) pins. So, when you’re uploading code, you’ll need to first disconnect the ESP32-CAM to avoid any conflicts or potential issues.

    ../_images/unplug_cam1.png
  2. Open the 11_obstacle_avoid.ino file under the path of zeus-car-main\examples\11_obstacle_avoid.

  3. After the code is uploaded successfully, slide the power switch to ON to start the Zeus Car.

    • Zeus car will move forward.

    • An ultrasonic module detects obstacles in front, if detected, the car turns left.

    • When the left obstacle avoidance module detects an obstacle, the car turns right, and when the right obstacle avoidance module detects an obstacle, the car turns left.

Note

Before use, you need to adjust the detection distance of the two obstacle avoidance modules to 15CM, the steps are as follows

  • Start by adjusting the right obstacle avoidance module. During transportation, collisions may cause the transmitter and receiver on the infrared module to tilt. Therefore, you need to manually straighten them.



  • Place an obstacle about 15cm away from the IR obstacle avoidance module.

  • On the module are two potentiometers, one to adjust the sending power and one to adjust the sending frequency. By adjusting these two potentiometers, you can adjust the detection distance.

  • Then you can adjust a potentiometer, and if at 15cm, the signal light on the module illuminates, the adjustment is successful; if it doesn’t, adjust another potentiometer.

    ../_images/zeus_ir_avoid.jpg
  • Calibrate the other obstacle avoidance module in the same way.