loading

Ever thought about building a robot but think that it`s too difficult, well now it`s not. It is a simple robot which is operated by an arduino and what it does is that it just roams around and avoids obstacles. It detects the obstacles with a HC-SR04 ultrasonic sensor. It is a simple project which anyone can build. Lets get started !!

Step 1: Materials Required

1. Arduino

2. HC-SR04

3. Robot chassis and motors

4. L293D IC

5. Breadboard

6. Jumper wires

7. 9v Battery

8. AA battery back (9v)

9. Double sided foam tape

And that's it !!

Step 2: Wiring and Schematic

You may find this step a bit complicated but its not. Follow these steps:

1. Connect pin 1, 9 and 16 together and connect it to 5v

2. Connect pin 4,5,12,13 together and connect it Gnd

3. Connect your 1st motor to pin 3 and 6

4. Connect your 2nd motor to pin 11 and 14

5. Connect pin 15 to digital pin 8

6. Connect pin 10 to digital pin 9

7. Connect pin 2 to digital pin 10

8. Connect pin 7 to digital pin 11

9. Connect HC-SR04 Vcc pin to 5v and Gnd to Gnd

10. Trig to digital pin 3 and Echo to digital pin 2

11. Battery pack's positive to IC pin 8 and Battery pack's Gnd to Gnd

12. Connect 9v battery's positive to Vin on Arduino and Gnd to Gnd

Step 3: Programming

The code very easy. You can also change the code and try different things. If the robot is going in weird directions, try changing all the digitalWrite, HIGH to digitalWrite, LOW and all the digitalWrite, LOW to digitalWrite, HIGH.

Have Fun !!

<p>This is what it says when I try to upload the code :</p><p>Error compiling for board Arduino/Genuino Uno.</p><p> /\</p><p>compliation terminated.</p><p>exit status 1</p><p>Error compiling for board Arduino/Genuino Uno. </p>
<p>I don't understand step 12. I hooked everything up but it didn't work. Do I still have to hook the Arduino to a 9v or computer? Why the battery pack and 9v and a 9v to power the Arduino. I'm so confused. Any clarity would be greatly appreciated. </p>
The battery pack is for the motors and the 9v battery is for the arduino
Sir i m not well experienced on Arduino. and i m getting errors as below. so plz help me.<br><br>Arduino: 1.6.6 Hourly Build 2015/08/25 04:58 (Windows 7), Board: &quot;Arduino Uno&quot;<br><br>Using library NewPing in folder: C:\Users\SKYuvraj\Documents\Arduino\libraries\NewPing (legacy)<br><br>D:\FAMILY\PERSONAL\SKYuvraj\Projects\arduino-nightly-windows\arduino-nightly\hardware\tools\avr/bin/avr-g++ -c -g -Os -Wall -Wextra -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10606 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -ID:\FAMILY\PERSONAL\SKYuvraj\Projects\arduino-nightly-windows\arduino-nightly\hardware\arduino\avr\cores\arduino -ID:\FAMILY\PERSONAL\SKYuvraj\Projects\arduino-nightly-windows\arduino-nightly\hardware\arduino\avr\variants\standard -IC:\Users\SKYuvraj\Documents\Arduino\libraries\NewPing C:\Users\SKYuvraj\AppData\Local\Temp\build2227180754621430662.tmp\sketch\sketch_oct10b.cpp -o C:\Users\SKYuvraj\AppData\Local\Temp\build2227180754621430662.tmp\sketch\sketch_oct10b.cpp.o <br>Robot.ino: In function 'void setup()':<br>Robot.ino:31:6: error: redefinition of 'void setup()'<br>sketch_oct10b.ino:1:6: error: 'void setup()' previously defined here<br>Robot.ino: In function 'void loop()':<br>Robot.ino:40:6: error: redefinition of 'void loop()'<br>sketch_oct10b.ino:7:6: error: 'void loop()' previously defined here<br>redefinition of 'void setup()'<br>
When I uploaded the program it is coming that compiling error so what should I do???
<p>Have you installed the &quot; new ping &quot; library ? If not then download it from &quot; https://code.google.com/p/arduino-new-ping/downloads/detail?name=NewPing_v1.5.zip&amp;can=2&amp;q= &quot; then extract the zip file in the library folder of arduino it will be in My documents then Arduino then libraries </p>
<p>Its awesome the project helped me a lot.</p>
<p>hey......2 things.....1. how did u connect the DC motors without a motor shield and 2. i want to connect a mini servo with the sensor so that it scans the area......plz help</p>
A motor shield has this same circuit the only difference is that it is on a PCB and if you want to add a servo check out the instructables in my favourite's named James - Your first arduino robot. Good Luck !!
<p>The schematic is right but the CODE is WRONG, look at this : </p><p>replace these lines.. :</p><p><br>void moveBackward(){<br> digitalWrite(Motor1Pin1, HIGH);<br> digitalWrite(Motor1Pin2, LOW);<br> digitalWrite(Motor2Pin1, LOW);<br> digitalWrite(Motor2Pin2, HIGH);<br>}<br><br><br>void moveForward(){<br> digitalWrite(Motor1Pin1, LOW);<br> digitalWrite(Motor1Pin2, HIGH);<br> digitalWrite(Motor2Pin1, HIGH);<br> digitalWrite(Motor2Pin2, LOW);<br>}<br><br>void moveRight(){<br> digitalWrite(Motor1Pin1, LOW);<br> digitalWrite(Motor1Pin2, LOW);<br> digitalWrite(Motor2Pin1, HIGH);<br> digitalWrite(Motor2Pin2, LOW);<br>}<br><br>void moveLeft(){<br> digitalWrite(Motor1Pin1, LOW);<br> digitalWrite(Motor1Pin2, HIGH);<br> digitalWrite(Motor2Pin1, LOW);<br> digitalWrite(Motor2Pin2, LOW);<br>}</p>
that typo is pin 17 should be pin 15, there is no,17th pin on the chip.<br>
<p>I changed it thanks for telling me </p>
thank you for this write up on using the L239 hbridge chip. im currently doing a build based on this guide.. just a heads up though, there is a typo on step 5 of your wire hook up.

About This Instructable

9,865views

74favorites

License:

Bio: I love Arduino and Raspberry pi and electronics.. i build robots and also other cool stuff so stay tuned !!
More by Arduino Tech:Solid State Tesla Coil Made Easy Raspberry Pi 2 - Getting Started Arduino Robot 
Add instructable to: