Introduction: Arduino Obstacle Avoiding Robot
In this instructable I will show you how to make your own obstacle avoiding robot!
We will use the Arduino uno board and an ultrasonic sensor. If the robot detects an object in front of it, with the help of a small servo motor, it scans the area left and right in order to find the best way to turn.
It has also a notification LED, an buzzer to play a tone when an object is detected and an button for changing the function of the robot (stopped / moving forward).
Official page: http://www.ardumotive.com/obstacle-avoiding-robot.html
It's very easy to make it!
So, let's get started!
Step 1: What You Will Need
For this project you will need:
- Arduino UNO (buy it from gearbest.com)
- Mini breadboard (buy it from gearbest.com)
- L298 motor driver module (buy it from gearbest.com)
- 2x dc motors with
wheels
- HC-SR04 ultrasonic sensor (buy it from gearbest.com)
- Micro servo motor (buy it from gearbest.com)
- Button
- Red LED
- 220 Ohm resistor
- 9V battery holder (with or without power jack)
- 8 spacers (male-female), 8 nuts and 8 screws
You will also need one big (metal) paperclip and an bead to make the back supporting wheel.
For the robot base I used a piece of plexiglass (12 x 9.5 cm). You can also use a piece of wood or metal (or two cd/dvd disks ).
The cost of the entire project is about 20$ :)
Tools:
- Drill machine
- Super glue
- Screw driver
- Hot gun glue (optional)
Power:
We will use an 9V battery to power on our robot because it's small and cheap, but it's not very powerful and will be empty after about one hour. Consider if you want to use a rechargeable battery pack (min 6V, max 7V) that will be more powerful but it will be also more expensive and bigger than the 9V battery.
Step 2: Prepare the Robot Base
Place all the hardware parts on plexiglass piece and mark it with a pen in order to open the holes with a drill. (1st image).
Begin with the bottom side, use a super glue to mount motors in the plexiglass piece. Make sure that they are perfectly aligned - use a triangle ruler (2nd image). Now attach the 9V battery holder.
Tip: You can also open holes for the motors and battery cables .
Step 3: Put the Hardware Parts on It
Use the spacers, screws and nuts to attach the Arduino uno board and the L298 module on plexiglass piece. The mini breadboard can be easily attached on it with the adhesive tape that already have at the bottom of it (1st image).
Now it's time to make the rear supporting wheel, use the paper clip and bead (2nd image). Finally, use a super glue (or hot gun glue) to attach it on the bottom side of the plexiglass.
Step 4: The "eyes" of Our Robot
Use a super glue to attach the tiny servo motor in the front side of our robot. Watch the first image above to understand how to put the ultrasonic sensor in the servo motor by using a small gear piece.
The second above image shows the completed part that will be the "eyes" of our robot.
Step 5: The Circuit
Now it's the time to make our circuit! The connections are pretty easy, watch the above image with the breadboard circuit schematic.
Tip: Use the breadboard only for the LED, button and buzzer, this will keep it simple and you can use the remain area to add more stuff on the future.
Step 6: The Code
Here is the code, embedded using Codebender!
Codebender is an online Arduino IDE - It's the easiest way to program your Arduino board directly from your browser! Just click on the "Run on Arduino" button and that's it! Try it! It's really amazing!
Plug an battery on it and press the function button once, your robot will start moving forward. To stop it, just press the button for one more time.
You can also press the 'Edit' button and start making your modification in the sketch.
For example, try to change the '10' cm value that is the distance that will make the robot to stop and 'look' for a clear path.
Note: if your robot doesn't move forward, try to change the pins of the motors (motorA1 and motorA2 or motorB1 and motorB2).
Step 7: Well Done!
Now you have your own Arduino Obstacle Avoiding Robot!!!
Check my page for more cool Arduino projects: www.ardumotive.com
I hope you liked this, let me know in the comments below, I would like to see photos of your cool robots!