Project: Obstacle Avoiding Robot
Projects are intended to consolidate the knowledge you have absorbed in previous lessons. This one will help you apply what you've learned about motors and the ultrasonic sensor.
In this project, you will build your very own obstacle avoiding robot.
Requirements:
- Build a circuit with four DC motors, motor drivers and an ultrasonic sensor. The motors will be used to power the wheels for your robot-car.
- Program the robot to move forward when there is no obstacle and to turn left or right when it detects an obstacle in its path.
- Ensure the robot avoids collisions and operates autonomously.
- Create a robot chassis using cardboard, or by 3D-printing it, if you prefer.
Assignment
Project
Step 1: Planning
- Think about the components you will need for this project and start planning how these components will fit together in a circuit. How many motor drivers will you need?
- Draw a simple sketch using pen and paper of your robot and plan what it will look like. Have fun!
- Create a schematic using a tool like
Fritzing
or by hand, if you prefer.
Step 2: Building your circuit
- Gather all the components you will need for this project.
- Build the circuit using your breadboard, jumper wires and the components you would have prepared earlier.
- Attach the motors, wheels and ultrasonic sensor to the chassis.
Step 3: Programming
- Declare all the variables you will need to use in this program. Try to use variables whenever it's possible.
- Write your program using the requirements above. Remember to use the libraries you will need.
- Upload your code, debug, and repeat until you have a functional robot!
Stuck?
If you get stuck, don't worry! There are a few helpful ways to troubleshoot and understand the problem.
- Use your serial monitor to debug - it's a very helpful tool!
- Refer to official documentation or guides such as the Arduino Docs.
- Search the problem online. If your console reports an error, simply copy paste it online. It's likely someone else had the same issue as you.
- Ask in forums and online communities. Good places to ask for help are: