Arduino - Obstacle Avoiding Robot (with L293D)

by MertArduino in Circuits > Arduino

48288 Views, 69 Favorites, 0 Comments

Arduino - Obstacle Avoiding Robot (with L293D)

cover_1.jpg

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

Tutorial

Arduino - Obstacle Avoiding Robot (with L293D)

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.

Hardware Required

vlcsnap-2016-11-03-21h30m42s740.png
vlcsnap-2016-11-03-21h30m59s740.png
  • 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

Create a Chassis

vlcsnap-2016-11-03-21h31m29s581.png
vlcsnap-2016-11-03-21h31m57s193.png
vlcsnap-2016-11-03-21h32m26s366.png
vlcsnap-2016-11-03-21h32m36s315.png
vlcsnap-2016-11-03-21h33m06s577.png

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.

Create Power Distribution

vlcsnap-2016-11-03-21h33m32s097.png
vlcsnap-2016-11-03-21h34m07s535.png
vlcsnap-2016-11-03-21h34m30s171.png

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

All VCC and GND Connections

vlcsnap-2016-11-03-21h35m12s965.png
vlcsnap-2016-11-03-21h35m29s808.png
vlcsnap-2016-11-03-21h36m20s964.png
vlcsnap-2016-11-03-21h36m31s573.png
vlcsnap-2016-11-03-21h36m55s576.png
vlcsnap-2016-11-03-21h37m23s683.png
vlcsnap-2016-11-03-21h38m09s609.png

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.

DC Motor Connections

vlcsnap-2016-11-03-21h38m32s990.png
vlcsnap-2016-11-03-21h39m17s271.png
vlcsnap-2016-11-03-21h43m50s746.png
FG95DGFIUOHPI30.LARGE.jpg

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

Digital Input Connections

vlcsnap-2016-11-03-21h40m18s173.png
vlcsnap-2016-11-03-21h40m36s661.png
vlcsnap-2016-11-03-21h41m00s892.png
FG95DGFIUOHPI30.LARGE.jpg

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

HC-SR04 Connections

vlcsnap-2016-11-03-21h41m59s895.png
vlcsnap-2016-11-03-21h42m16s900.png
vlcsnap-2016-11-03-21h43m38s525.png

Sensor VCC to Breadboard VCC

Sensor GND to Breadboard GND

Sensor Trig to Arduino Digital12

Sensor Echo to Arduino Digital11

Finally; Battery, Wheels and Sensor Mounting

vlcsnap-2016-11-03-21h43m50s746.png
vlcsnap-2016-11-03-21h44m11s113.png
vlcsnap-2016-11-03-21h44m22s177.png
vlcsnap-2016-11-03-21h44m58s322.png

We're making the final touches ...

Then connect the robot to the computer for programming.

Code

vlcsnap-2016-11-03-21h45m16s934.png
vlcsnap-2016-11-03-21h45m27s989.png

If I Was Helpful

vlcsnap-2016-11-04-09h02m47s139.png

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