autonomous car obstacle avoidance

27,690

Circuit Image

The objective is to enable the car to avoid obstacles using ultrasonic sensor data to determine the nearest obstacle-free heading towards its destination. An ultrasonic sensor mounted on a servo takes distance measurements at various angles and selects the obstacle-free angle closest to the required direction for reaching the next waypoint. After initial testing, plans include experimenting with stereo cameras and employing edge detection algorithms, stereo vision, and optical flow techniques. The ultrasonic proximity sensor chosen for this project is the Parallax PING. This sensor was preferred over others because a direct front-facing sensor would require a trial-and-error approach for obstacle avoidance, which would be inefficient. Instead, a 2-D representation of the area in front of the car allows for multiple directional choices. While using multiple sensors could provide better resolution, it would be cost-prohibitive. Therefore, a single sensor mounted on a servo to collect readings while rotating was selected. A specific mounting kit for the ultrasonic sensor on a servo was designed for Parallax's Boe Bot, so modifications were made to the RC car to accommodate the servo. The number of measurements taken per pass was determined to be 36, providing a balance between speed and resolution. Additionally, a threshold distance for obstacle detection was established to prevent collisions while still allowing for viable path identification. Initially, both the sensor and servo were powered by the Arduino, but this led to data inaccuracies and erratic servo behavior. The solution involved powering both components from the RC car batteries with a voltage divider to step down the voltage. Adjustments were made to reduce the time taken for decision-making at the end of each pass by limiting the data displayed and increasing the serial transfer rate.

The circuit for the autonomous car's obstacle avoidance system utilizes an ultrasonic sensor, specifically the Parallax PING, which is connected to a servo motor to enable angular scanning of the environment. The servo motor is controlled by a microcontroller, typically an Arduino, which processes the distance measurements obtained from the ultrasonic sensor. The ultrasonic sensor emits sound waves and measures the time it takes for the echo to return, calculating the distance to the nearest obstacle.

The design incorporates a voltage divider to ensure that both the sensor and the servo are powered adequately from the RC car's battery, preventing power-related issues that could lead to erroneous readings or erratic behavior. The Arduino is programmed to initiate the servo's rotation, allowing the ultrasonic sensor to take a series of 36 distance measurements across a specified range of angles. This data is then analyzed to identify the closest obstacle-free path towards the next waypoint.

The system's effectiveness is enhanced by employing a threshold distance for obstacle detection, which is adjustable based on the desired safety margin. This threshold prevents the car from colliding with obstacles while still allowing it to navigate through available paths. The decision-making process is optimized by reducing unnecessary data output to the Serial Monitor and increasing the baud rate for faster communication, thus improving the responsiveness of the system.

Future enhancements may involve integrating stereo cameras for depth perception and employing advanced algorithms for edge detection and optical flow analysis, which will further refine the car's ability to navigate complex environments autonomously. These additions aim to improve the accuracy of obstacle detection and enhance the overall navigation capability of the autonomous vehicle.I need the car to avoid obstacles. This is a video of my autonomous car using ultrasonic sensor data to choose the nearest obstacle-free heading towards its destination. Basically, an ultrasonic sensor mounted on a servo takes distance measurements at a number of angles and chooses the obstacle-free angle

closest to that required to get to the next way point. After the car is up and running, I will experiment with adding stereo cameras and fiddle with edge detection algorithms, stereo vision (when images from the two cameras are compared, the parts with lots of differences tend to be closer while the parts with more similarities tend to be farther), and optical flow (while moving, the things that move faster tend to be closer and the things that move slower tend to be farther) I chose to use an ultrasonic proximity sensor. Specifically, I opted for a Parallax PING ( ). Here`s why I didn`t choose other sensor technologies: If the car only had a sensor measure distance directly in front of the car, it would have to avoid obstacles by guess and check it would drive until it sees an obstacle, back up, turn a little, and try again until it doesn`t see an obstacle.

This would take forever. With a 2-D representation of the space in front of it, the car can choose from a variety of directions. One option would be to buy a bunch of sensors and array them at different angles in front of the car, but it would be expensive to accomplish any respectable resolution with this approach.

A more attractive option would be to mount a sensor on a servo and collect readings while the sensor rotates. Fortunately, there is a kit for mounting the ultrasonic sensor on a servo ( ). However, this kit was designed for Parallax`s Boe Bot, not my RC car. So, I took off the front bumper of my RC car, machined a bracket for mounting the servo from an aluminium angle, and screwed the bracket into the holes where the bumper was.

One question to figure out is how many measurements I want the sensor to take in a single pass. If I take too many measurements, the pass will be slow and the car could crash while waiting for the sensor to complete its pass. If I take to few measurements, the car could fail to detect obstacles or available paths. I chose 36 measurements per pass, because it seemed to strike the balance between these extremes. I get a good resolution, but I am able to complete a pass in well under a second. Another balance that needs to be struck is choosing the distance below which the car classifies something as an obstacle.

If the distance is too short, the car could be unable to stop before crashing into something. If the distance is too far, the car could unnecessarily rule out viable paths. A wiring guide for the ultrasonic sensor suggests the sensor be powered by the Arduino ( ). The Arduino servo library also suggests that the servo be powered by the Arduino ( ). However, when I tried to power both devices using the Arduino, the sensor reported bad data and the servo misbehaved. To fix the issue, I ran both of the devices off of the RC car batteries, stepping the voltage down using a voltage divider.

Thanks to DuaneB from the Arduino forum ( ) for pointing out that inadequate power was the cause of the problem. One challenge I encountered while setting this up was that the car seemed to take forever at the end of each pass to decide where to go.

Two changes fixed this problem: I stopped displaying all of the measurements on the Serial Monitor sped up the Serial transfer rate from 9600 baud to 11520 baud. Thanks to dxw00d and Nick Gammon from the Arduino forum ( ) for these fixes. 🔗 External reference




Warning: include(partials/cookie-banner.php): Failed to open stream: Permission denied in /var/www/html/nextgr/view-circuit.php on line 713

Warning: include(): Failed opening 'partials/cookie-banner.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/nextgr/view-circuit.php on line 713