Introduction: How to Make a HC-SR04 Obstacle Avoiding Robot With Arduino
In this Instructable today, you will be shown how to make a Obstacle Avoiding Robot with a few cheap parts and a free open-source software coding platform IDE called Arduino. This is a great robotics project and is very easy to make. After you are finished, you can let it free and see what it can do!
Step 1: Parts Needed
Listed below are all the parts needed to build this. I have provided links if you need to buy them from Amazon
- 1 Arduino Board - (Mega 2560 or Uno R3) https://goo.gl/EZwZXj
- 2 3-6V Gear Motors https://goo.gl/BX9oQ6
- 1 Mini Servo Motor https://goo.gl/HVL1YD
- 1 HC-SR04 Ultrasonic Sensor https://goo.gl/JbRKhb
- 1 L298N H-Bridge Motor Driver https://goo.gl/RtgfTE
- 1 Mini Breadboard https://goo.gl/n37d7U
- 1 Battery Pack for 4 AA Battery https://goo.gl/6zw4qF
- 1 9V Battery with Battery Plug https://goo.gl/sh4nPW
- A few Male-Female and Male-Male Jumper Cables https://goo.gl/y99t22
- 1 Chassis https://goo.gl/HLWwsd --This is not required but is helpful. it gives you motors and wheels and a place to build your robot. If you don't buy this, it's OK and all you have to do is make your own chassis out of cardboard. If you do buy chassis, then you don't need the 2 motors --
- Caster Wheel https://goo.gl/U6CQwL -- Just if you build your own chassis.
Step 2: Connections
Now it's time to connect these parts you have collected and make this robot. Refer to my schematic for all the connections.
--For the motors, the orientation in which you place them will make a difference so plug them in and if after finishing, it doesn't go forward, try switching them.--
The ultrasonic sensor needs to spin with the servo motor so you either need to buy a ultrasonic bracket or use 2 pieces of cardboard to make one.
The 9V battery going to the L298N H-Bridge needs to be a 4 AA Battery Holder unless you can get the 9V battery to have 2 separate wires.
Step 3: Code
Now you need this machine you built to do something. We will achieve that using Arduino. If you already haven't done so, download Arduino IDE from this website - https://www.arduino.cc/en/Main/Software
After you do that, watch this video if you don't know how to upload a library to Arduino.
The video will also show you how to download the NewPing Library, to which the link is here. This is needed for the code to work. https://goo.gl/Qe6XU6
The code is here.
We have a be nice policy.
Please be positive and constructive.