1 of 20

Obstacle Detecting Autonomous Car: A Step Toward Safer Roads

1

Problem: Too many car crashes causing a great number of deaths.

Name: Veer Dave

School: Sierra Vista Middle School

Grade: 7th

Teacher: Mrs. Gordon

2 of 20

Abstract

Problem:

In 2022, 42,514 people lost their lives in car crashes, which resulted in an economic cost of $340 billion for the United States. This alarming statistic highlights the urgent need for solutions to reduce motor vehicle collisions and enhance road safety.

Objective:

To address this issue, I decided to build an obstacle-avoiding car that can autonomously detect and stop before colliding with an object. The goal was to design a prototype that would demonstrate how autonomous technology can help reduce accidents on the road.

Materials and Procedure:

To build the obstacle-avoiding car, I needed several components. After testing my initial design, I finalized the following materials: Acrylic sheet (for the car base), Arduino Uno, Motor Driver Shield, Jumbo battery, Four TT Gear Motors, Servo Motor, Ultrasonic sensor, Four wheels, Jumper wires, and Zip ties

Steps Taken:

  1. Assembly:�I started by attaching the Arduino Uno to the acrylic sheet, followed by placing the Motor Driver Shield on top of the Arduino. Each component was carefully connected using jumper wires to ensure proper functioning.
  2. Programming:�After all components were securely attached, I wrote the code that would enable the car to detect obstacles and stop automatically when it was in danger of colliding with an object.
  3. Testing:�Once the car was fully assembled and programmed, I tested it to ensure that the system worked as expected. The car successfully detected obstacles and stopped just before making contact with them.

Data and Analysis:

The United States has experienced significant population growth, and the rate of traffic fatalities has increased by 38% per 100,000 people over the last four decades. My project aimed to combat this rise in road accidents by creating a car capable of autonomously avoiding collisions.

In version one of my design, I used cardboard as the base, but it was not sturdy enough to support the weight of all the components, causing the car to fail. In version two, I switched to an acrylic sheet (about ½ cm thick), which provided the necessary strength and durability. I also replaced screws with Zip ties, which helped prevent parts from loosening during operation. The second version performed much better, successfully avoiding obstacles by stopping just in time.

Conclusion:

The obstacle-detecting autonomous car prototype demonstrates the potential of technology to reduce traffic accidents and save lives. If widely implemented, such systems could significantly improve road safety, making driving easier and less dangerous for everyone. This project validates the concept of autonomous vehicles as a feasible solution to the ongoing problem of motor vehicle collisions.

2

3 of 20

Introduction (Background Research)

Objective:To build a self-driving car that can avoid obstacles using sensors and motors, and to learn C++/Java programming for Arduino.

Components and Functions:

  • Ultrasonic Sensor:�Sends sound waves to detect obstacles by measuring the time it takes for the waves to return. The car uses this data to stop or change direction. The sensor is controlled by a servo motor that lets it rotate and scan in different directions.
  • TT Motors:�These small motors drive the wheels. The car uses four TT motors (one for each wheel) to move forward, backward, or turn.
  • Arduino Uno:�The brain of the car, controlling all components based on the sensor data and motor commands.
  • Motor Driver Shield:�Placed on top of the Arduino to control the motors, amplifying the signals from the Arduino.
  • Jumper Wires:�Used to connect the components together, allowing communication between them.
  • Acrylic Sheet:�The base of the car, providing a platform to mount all the components.

Criteria and Constraints:

  • Criteria: The car must be able to avoid obstacles effectively.
  • Constraints: The project must be completed within a limited budget.

3

4 of 20

The Engineering Solution, Prototype/Model to be tested.

The model I designed aims to help avoid obstacles, addressing the issue of car crashes across the U.S. It uses an ultrasonic sensor to detect obstacles, functioning similarly to a camera. The solution is to create a car equipped with this "camera" that detects obstacles in its path. Once an obstacle is detected, the car will automatically stop at a certain point to prevent a collision.

4

After putting on the wheels I realized that the cardboard would not work at all because of all the weight. I didn’t even get to put the Arduino in. I hot glued the Gear Motors so I had to take it out.

This model shows all of the components. It also shows what each component is connected to.

5 of 20

Materials

  • Arduino Uno(I already had)(1)
  • Motor Driver Shield(Didn’t have)(1)
  • Wheels(Didn’t have)(4)
  • TT Gear motor(Didn’t have)(4)
  • Servo Motor(I already had)(1)
  • Ultrasonic sensor(I already had)(1)
  • Battery(I already had)(1)
  • Jumper Wires(I already had)
  • Cardboard (About 9 cm by 15 cm)(1)Revised: Acrylic Sheet(Didn’t have)
  • Hot Glue(Already had)(1)
  • Drill(to drill in the holes)(Already had)(1)
  • Screws:(Already had)(8)Zip Ties(Already had)(2)
  • Screwdriver(Already had)(1)
  • Ruler(Already had)(1)
  • Sensor Holder(I used cardboard for it.)(Already had)(1)

Red Color = Revised materials.

Black color = Normal materials.

5

Arduino Uno

Ultrasonic Sensor

Motor Driver Shield

TT Gear Motors

6 of 20

Procedure

  1. Gather all materials
  2. Get the Cardboard. Revised: Get the Acrylic Sheet(Transparent)
  3. Make 8 holes on the base. Two on the right side and two on the left. It should be near the middle of the side. They should be side by side, 1 inch apart. Also make the holes for the Arduino.
  4. Take one Gear Motor and locate the positive and the ground wire attachments. Attach the wires there and do the same thing for all of the motors.
  5. Attach all four of the Gear Motors onto the base. One on each corner.
  6. Place the wires of the Gear Motor in each of the holes. Then, flip the model.
  7. Attach all of the wheels to the Gear Motors.
  8. Mount the Arduino on the center of the base. Use 4 screws to hold the Arduino in place. Revised version: Mount the Arduino on the center of the base. Use 2 Zip Ties to hold the Arduino in one place. One for one side of the Arduino and the other Zip Tie for the other side of the Arduino.
  9. Locate the holes on the Arduino and then screw it in, so it stays in place.
  10. Mount the Motor Driver onto the Arduino Uno. Connect the Motor Driver to the Arduino Uno so it stays in place.
  11. Connect the wires of the Gear Motor to the Motor Driver.
  12. Attach the Wires so that it stays in place. Use a screwdriver to make the wires stay in place. You can find the screws already on the Motor Driver
  13. Attach the Servo Motor on one side using zip ties.
  14. Take the sensor holder and attach it above the Servo Motor. This will attach the Servo Motor to the Ultrasonic Sensor. Screw the screw on top of the servo motor.
  15. Connect the Wires to the Ultrasonic Sensor.
  16. Glue the top of the wires onto the sensor holder.Revised Version: Use zip ties to attach the wires to the sensor holder.
  17. Make sure the ultrasonic sensor is facing forward.
  18. Connect the wires of the servo motor to the Motor Driver
  19. Make sure the Positive wire goes to +5V, the GND wire goes to GND, the Trig goes to A0, and the Echo goes to A1.
  20. Mount the battery and battery holder on the other side of the car.
  21. Use hot glue to attach the battery holder to the cardboard(base)Revised version: Attach the battery holder to the acrylic sheet(base).
  22. Connect the wires of the battery holders.
  23. Connect the USB cable to the Arduino Uno and connect the other end of the cable to your computer.
  24. Download the code and the libraries.
  25. Test the car by putting boxes around it, and then seeing if it hits the boxes or not.

Red Color = Revised procedure.

Black color = Normal procedure.

6

3.

5.

Step number 5 where I attached the Gear motors. I revised the cardboard with the acrylic sheet.

Step number 3 where I was making the holes on the Acrylic Sheet.

7 of 20

Results – Data/Observations

During testing, I collected data on the performance of the car. One key finding was that the car worked 90% of the time (9 out of 10 tests). It didn’t work the second time because the ultrasonic sensor had shifted slightly to the left.

I also measured the time it took for the car to travel from one place to another. While the speed was acceptable, the car was quite noisy during operation. In the first test, the car worked well, but in the second test, it bumped into a cardboard box. After identifying the issue, I quickly fixed it by adjusting the sensor alignment.

7

This is where I was testing my car against the obstacles, and it worked. The car stopped and then went back, trying another way to go there.

Obstacles in the way of the car

8 of 20

Revised Solution and Prototype/Model

I revised the prototype I originally built. Initially, I planned to use screws to secure the Arduino and battery holder. However, I realized that due to the material of my base, it would be easier to use zip ties instead. When I used screws, they would often fall out because the acrylic sheet had large holes, and the screws were too small for the thickness of the sheet. The screws needed to be smaller to fit the Arduino, but they didn't hold well. In contrast, using zip ties made the assembly much easier, and both the Arduino and battery holder stayed securely in place.

Overall, Version 1 (with the cardboard base) was easier to assemble because it didn't require a drill, and cardboard is a common household item. However, Version 2 (with the acrylic base) worked far better in terms of stability and durability.

8

This one is the “in progress” version of version two. The thing in the center is the motor Driver Shield. The four yellows on the corners are the Gear motors. And attached to them are the wheels.

Arduino

Motor Driver Shield

Wires

Gear Motors

Wheels

9 of 20

Revised Solution and Prototype/Model pt.2

The picture on the left shows two issues: 1) the cardboard was too weak, and 2) the cardboard bent easily. This is why I decided to revise the solution. In contrast, the two pictures on the right show a much more stable and neat setup.

One additional benefit of using the acrylic sheet is that it is transparent, allowing you to see the gear motors on the other side. While cardboard is inexpensive, it lacks the durability and stability that the acrylic sheet provides.

9

More stable

Being bent

Unstable and won't stick properly

The final product of my car. All I would need to do it connect the battery to the connecter and it would work.

Ultrasonic Sensor

Servo Motor

10 of 20

Revised Solution and Prototype/Model pt.3

10

I had to define all of the ports and set the max speed of the motors.

The first line of code is connecting the servo motor to a specific pin on the Arduino and the second line of code is telling the servo motor how many degrees to turn to look for obstacles. Look below.

These to pictures of the code are for the ultrasonic sensor. It is saying that the servo motor will look 170 degrees to the left and 50 degrees to the right. It always look left first.

These two pictures of my code are for the TT Gear Motors to move forward, backward, turn right, and turning left.

Steps Taken:�The first step was to define all the necessary ports and components for the project.�I began by programming the DC motor, using the void setup() function to initialize the servo motor and set its angle.�I then set up the void loop() function and declared two integer variables, distanceR and distanceL, both initially set to 0.�I created a movestop() function to halt the motors when necessary.�I developed a function to control the ultrasonic sensor so it can look both right and left.�Finally, I implemented functions to move the robot forward, backward, left, and right.

11 of 20

Discussion

Version 1:

Version 1 didn’t work at all. I couldn’t even test it because it kept breaking and bending. The cardboard was too weak to support the weight of the components. I barely finished assembling it, and when I finally tried to test it, it broke. This version was a complete failure. I also thought the screws on cardboard would be effective, especially when I found some extra ones at home. However, they didn’t hold well, and I had to find an alternative solution.

Version 2:

Version 2 was much better. The zip ties were a huge help, and the acrylic sheet base was strong and durable. It could support all the components' weight and functioned properly.

Overall, I realized that cardboard wasn’t a reliable base, and the acrylic sheet worked much better.

Performance:

The car worked 90% of the time (9 out of 10 attempts), which was a significant improvement.

Reflections:

The project didn’t turn out as I had expected. For example, I initially thought that the cardboard would work, but I was wrong.

11

12 of 20

Conclusion

Whenever I go on the road, I see self-driving cars everywhere. In my city, more than half of the people own Teslas, which can drive themselves. There are also other autonomous vehicles like Waymo, Zoox, Cruise, and RoboTaxis. These cars are all self-driving taxis, operating without a driver. Waymo, Zoox, and Cruise have a 360-degree camera mounted on the roof to observe the surroundings. The RoboTaxi, similar to a Tesla, uses many cameras on the exterior to navigate.

Inspired by this, I created an obstacle-avoiding car that uses ultrasonic sensors to detect obstacles. In real life, cars like Teslas use cameras—Teslas, for instance, have 23 cameras on the outside and one on the inside. The model I built worked as expected, and I learned a lot in the process. For example, I learned how to program in C++ and how to use libraries. I also enjoyed designing a mini car, which was both fun and educational. Throughout the project, I encountered many learning opportunities and developed problem-solving skills.

Solution and Results:

The solution I built was an obstacle-avoiding car that didn’t bump into any cardboard boxes. I believe the results were positive because the ultrasonic sensor used sound waves to detect obstacles. However, using cameras would likely improve the accuracy and clarity of obstacle detection, just like in real-world self-driving cars.

Challenges and Future Improvements:

One issue I encountered was the noise produced by the ultrasonic sensor when it turned. The car made a loud sound, which could be improved.

Looking ahead, I think I could experiment with different materials to build the car. The current base was quite sharp, and I ended up with many cuts while drilling. Trying a different, smoother material could make the construction process safer and more efficient.

12

13 of 20

Reflection/Application

I learned many valuable skills throughout this project, such as how to code in C++, assemble the car, and use libraries. I also gained a deeper understanding of how all the components work together. Another area where I made progress was in problem-solving. For example, one of the wheels wasn’t working, and I spent 45 minutes trying to fix it. I adjusted the wheel position, checked the jumper wires, and tried other solutions. Eventually, it hit me: I should replace the battery. Once I did that, the wheel started working perfectly.

If I could do something differently, I would have tightened the zip ties more carefully from the beginning. I struggled with this at first, and it took longer than expected. But in the end, I got it done. Also, I would have skipped the cardboard base entirely and used the acrylic sheet right from the start.

Next Steps:

The next step would be to make the car fully autonomous. I could also add a GPS system, allowing it to function more like a real-life Tesla.

With further improvements, driving could become much easier and safer. Drivers would no longer need to control the steering wheel, pedals, or other manual functions. They would simply enter the destination, and the car would take them there automatically.

13

14 of 20

Yearly snapshot. (n.d.). IIHS. Retrieved August 1, 2024, from https://www.iihs.org/topics/fatality-statistics/detail/yearly-snapshot

Wagner, L. (2019, February 3). How To Make A DIY Arduino Obstacle Avoiding Car At Home. YouTube. Retrieved August 1, 2024, from https://www.youtube.com/watch?v=1n_KjpMfVT0

How Ultrasonic Sensors Work – MaxBotix. (2023, March 1). MaxBotix. Retrieved August 1, 2024, from https://maxbotix.com/blogs/blog/how-ultrasonic-sensors-work

TT Motor — SunFounder Ultimate Sensor Kit documentation. (n.d.). SunFounder's Documentations! Retrieved August 1, 2024, from https://docs.sunfounder.com/projects/ultimate-sensor-kit/en/latest/components_basic/29-component_ttmotor.html#

Cameras. (2024, 06 14). Tesla. Retrieved August 1, 2024, from https://www.tesla.com/ownersmanual/modely/en_us/GUID-682FF4A7-D083-4C95-925A-5EE3752F4865.html

14

References Cited

15 of 20

16 of 20

17 of 20

18 of 20

19 of 20

20 of 20