Introduction: Autonomous Car
I completed this project as a requirement for my robotics course and I had a good time working through it. I learned about how to integrate an Arduino Uno and ultrasonic sensor to an old RC car. I really enjoyed working on this project and hope you do too!
There are a couple of things I need to work out (e.g. the car sometimes doesn't properly read in the sensor value and causes the car to move back and forth without real cause) - you'll see what I mean when you watch the attached video. But if you're looking for a starting point, please feel free to use this set of steps. I think it'll be beneficial :)
Step 1: Gather the Materials
To make your own autonomous car you will need the following materials:
- RC powered toy car with built in motors
- Arduino Uno - https://www.arduino.cc/en/main/arduinoBoardUno
- Adafruit Motor Shield - https://learn.adafruit.com/adafruit-motor-shield-...
- Ultrasonic Sensor - http://howtomechatronics.com/tutorials/arduino/ul...
- 9V batteries x 2
Step 2: Wire the Arduino and Motorshield With Ultrasonic Sensor
1. Stack the Motorshield on top of the Arduino Uno
2. The circuit:
· VCC connection of the sensor attached to +5V
· GND connection of the sensor attached to ground
· TRIG connection of the sensor attached to digital pin 2
· ECHO connection of the sensor attached to digital pin 4
Step 3: Wire the RC Car Motors to the Motorshield
- Take the two wires connected on the front motor and connect them to either M1 or M2
- Unscrew the top of the selected motor input
- Insert the wires in each of the two slots and screw back down to ensure they stay
- Take the two wires connected on the back motor and connect them to either M3 or M4
- Unscrewthe top of the selected motor input
- Insert the wires in each of the two slots and screw back down to ensure they stay
Step 4: Add Code to the Arduino
You will need to include two libraries to the top of the page:
- Wire
- Adafruit Motorshield
To install, go to Sketch > Include Library > Manage Libraries
- Type in "Wire" into the Filter your search...
- Click on the first one and select Install
- Type in "Adafruit Motor Shield" into the Filter your search...
- Click on the first one if you're using version 1 or the second one if you're using version 2
Go back into Sketch > Include Library and scroll down to find:
- Wire - click it to include it into the code
- Adafruit Motor Shield... - click it to include into the code
Viola! You've successfully installed the libraries and included the in your autonomous car code!
*The file attached is all the code required to run the car*
Attachments
Step 5: Video of Autonomous Car in Action
Step 6: Related Links
The following are links that inspired me to do this project:
https://www.instructables.com/id/Arduino-Powered-Au...
https://www.instructables.com/id/give-your-rc-car-b...
https://www.instructables.com/id/Simple-RC-car-for-...
http://makezine.com/projects/build-android-powered...
http://www.robotshop.com/letsmakerobots/how-make-a...
3 Comments
Question 1 year ago
In the video the car is moving back and forth, is there a problem?
6 years ago
Cool car. If you want to make the video easier to view, you can upload it to YouTube and embed it on the page using the Embed Video tool in the step editor. That way people will be able to view the video on the page without having to download it.
Reply 6 years ago
Thanks for the suggestion - it's updated now.