Arduino Tutorial Obstacle Avoiding Robot 4WD - For beginners
In this tutorial, you will make obstacle avoiding robot.
This tutorial involves building a 4WD robot with an ultrasonic sensor that can detect nearby objects and change its direction to avoid these objects. The ultrasonic sensor will be attached to a servo motor which is constantly scanning left and right looking for objects in its way.
Reference
1. DC Motors connect to the Motor Shield
2. Left Motors connect to M1 and M2 (If the motors run backwards, change the (+) and (-) connections)
3. Right Motors connect to M4 and M3
4. The Servo motor connect to the Motor Shield
5. The HC-SR04 Sensor connections
6. Battery and on / off button connection
7. 2 seperate DC power supplies for the Arduino and motors
8. Attach the wheels
1. Open the new Arduino IDE page
2. Delete everything on the page
3. Get the code in video description
4. Paste empty Arduino IDE page
5. First Install the Arduino Library
6. The AF_Motor Arduino library
7. The NewPing Arduino Library
8. Restart the IDE
9. Now you can see the libraries you have installed
10. When you verify, you will not see any errors
1. Using DC Motors with the Motor Shield
2. Using the HC-SR04 with the NewPing Library
Example;
This initializes NewPing to use pin 12 for trigger output, pin 11 for echo input, with a maximum ping distance of 200cm. max_cm_distance is optional [default = 500cm]. If connecting using a single pin, specify the same pin for both trigger_pin and echo_pin as the same pin is doing both functions.
Reference
First of all, I would like to thank you for reading this guide ! I hope it helps you.
If you want to support me, you can subscribe my channel and watch my videos.