Introduction: Arduino - Obstacle Avoiding Robot (with L293D)

Picture of Arduino - Obstacle Avoiding Robot (with L293D)

This instructable is the written version of my "Arduino - Obstacle Avoiding Robot (with L293D)" YouTube video that I've uploaded recently. I strongly recommend you to check it out.

My YouTube Channel

Step 1: Tutorial

In this video is explained step by step.

Dual H-Bridge Motor Driver for DC or Steppers - 600mA - L293D

This is a very useful chip. It can actually control one motor independently. We will use in its entirety the chip in this tutorial. Pins on the right hand side of the chip are for controlling a one motor. Pins on the left hand side of the chip are for controlling second motor.

You can run four solenoids, two DC motors or one bi-polar or uni-polar stepper with up to 600mA per channel using the L293D.

Step 2: Hardware Required

Picture of Hardware Required
  • Arduino Uno R3
  • Dual H-Bridge L293D Motor Driver
  • HC-SR04 Ultrasonic Module Distance Sensor
  • Bracket / Holder for HC-SR04
  • DC Motors and Wheels
  • Bovine Wheel
  • Plate or Chassis
  • Jumper or Wires
  • Batteries and Battery Holdes
  • Glue Gun or Cable Ties
  • Breadboard

Step 3: Create a Chassis

Picture of Create a Chassis

In this step; We are doing chassis installation.

You can use any plate for the chassis. But do not use a metal!

  1. Let's first mount the wheels.
  2. Then let's mount the battery holder.
  3. Finally mount Arduino and breadbord.

Step 4: Create Power Distribution

Picture of Create Power Distribution

I am using a breadboard for distribution to VCC and GND. For to be adjacent to the motor driver.

Step 5: All VCC and GND Connections

Picture of All VCC and GND Connections

All VCC-GND connect with wires to the L293D motor drive and the batteries.

Each chip contains two full H-bridges (four half H-bridges). That means you can drive four solenoids, two DC motors bi-directionally, or one stepper motor. Just make sure they're good for under 600 mA since that's the limit of this chip.

Normally we can connect both of these to the Arduino 5V pin. We used a powerful motor, or a higher voltage motor. So we provided the motor with a separate power supply using pin 8 connected to the positive power supply and the ground of the second power supply is connected to the ground of the Arduino.

Step 6: DC Motor Connections

Picture of DC Motor Connections

You can run four solenoids, two DC motors or one bi-polar or uni-polar stepper with up to 600mA per channel using the L293D.

You can use OUT1 and OUT2 for the left motor.
OUT4 and OUT3 can use for the right motor

Step 7: Digital Input Connections

Picture of Digital Input Connections

The L293D has two +V pins (8 and 16). The pin '+Vmotor (8) provides the power for the motors, and +V (16) for the chip's logic.

Digital 2 to OUT1

Digital 3 to OUT2

Digital 4 to OUT4

Digital 5 to OUT3

Step 8: HC-SR04 Connections

Picture of HC-SR04 Connections

Sensor VCC to Breadboard VCC

Sensor GND to Breadboard GND

Sensor Trig to Arduino Digital12

Sensor Echo to Arduino Digital11

Step 9: Finally; Battery, Wheels and Sensor Mounting

Picture of Finally; Battery, Wheels and Sensor Mounting

We're making the final touches ...

Then connect the robot to the computer for programming.

Step 10: Code

Picture of Code

Step 11: If I Was Helpful

Picture of If I Was Helpful

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.

Visit My YouTube Channel


bobzesnob (author)2017-05-01

A 9 volt battery wouldn't hurt the circuit because the l239d and arduino regulate the power

AkhileshT6 (author)2017-03-11

can we connect 9v battery as power supplu please help in that

ahmet_024102 (author)2016-11-06

Gerçekten çok başarılı bir çalışma olmuş emeğine sağlık mertcan kardeş.
yalnız öndeki tekerlek nasıl bir tekerlek anlayamadım. hazır mı satılıyor
Proje on numara proje keşke 10 sene önce meslek lisesinde bu dersleri verselerdi.

MertArduino (author)ahmet_0241022016-11-06

Yorumların ve desteğin için teşekkür ederim. Ön tarafta kullanmış olduğum tekerlek 'sarhoş tekerlek' olarak satılmakta. Çok çeşidi var. İnternet üzerinden çeşitleri inceleyebilirsin.

coreyy276 (author)MertArduino2017-03-03


jazzas24 (author)2016-11-26

Somewhy i cant not drive my own robot. It looks like it is missing amps or something? motors aint spinning while on batteries. Robot is working fine while connected to USB/ PC. I am using L293D motor shield.

What can be the problem? Thanks

MertArduino (author)jazzas242016-11-27

I will try to help;

- If the motors are moving with USB, please check your external power connections for L293D.

- It may be a simple suggestion, but it has happened before, so renew your external battery. (That means the battery you are using does not have enough power.)

- I need to see your robot in order to produce a solution. If possible, upload the images of the robot here.

vincent44 (author)2016-11-11

Eğer bir keskin yakınlık sensörü ve nasıl kullanabilirim?

MertArduino (author)vincent442016-11-12

Hi vincent44,

Where are u from? Because I don't understand sorry :/ What did you mean "keskin yakınlık sensörü"?

ahmet_024102 (author)2016-11-06

bir sorumda bu tür paylaşımlar yapınca ücretsiz premium filan var mı merak ettim

MertArduino (author)ahmet_0241022016-11-06

Mesaj gönderirken fark ettim, sanırım senin premium aboneliğin mevcut :)

ahmet_024102 (author)MertArduino2016-11-06

evet aralıkta bitecek.

MertArduino (author)ahmet_0241022016-11-06

Paylaşımlardan ziyade paylaştığın projeler eğer özellikli ise, yani onların deyimiyle 'featured' ise premium üyelik hakkı tanıyorlar. Ben sana özelden bir premium hediyesi göndereceğim. O kodu kullanırsan bazı site özelliklerinden de yararlanabilirsin. Eğitim ve kurslar v.b.

About This Instructable




Bio: For more project and tutorial visit my YouTube channel Mert Arduino and Raspberry Pi
More by MertArduino:Arduino - Balance - Balancing Robot | How to Make?Arduino - MPU6050 GY521 - 6 Axis Accelerometer + Gyro (3D Simulation With Processing)NodeMCU ESP8266 - WiFi Robot Car Controlled by Application (Wifi Bot / Android / IoT)
Add instructable to: