Obstacle Avoiding Robot Using Ultrasonic Sensors

5,069

13

6

Published

Introduction: Obstacle Avoiding Robot Using Ultrasonic Sensors

About: Interesting about Electronics,Robotics,Automation,Biomechatronics

We are going to build a Obstacle Avoiding robot using Ultrasonic sensors(HC SR 04) and Arduino Uno board.Robot moves avoiding obstacles and choosing the best way to follow by sensors.

List of Main Components :-

  • Arduino Uno - 1
  • Ultrasonic Sensor (HC SR 04) - 3
  • 5v Relay Board - 1
  • 12 V Battery - 1
  • 12 V Gear Motor - 4
  • Motor Brackets - 4
  • Chasi - 1
  • Wheels - 4
  • Screws and nuts
  • Switch -1
  • Jumper Cables -10

Step 1: Arduino Uno Board

Arduino Uno is a micro controller board based on the ATmega328P. It has 14 digital input and output pins, 6 analog inputs.Operating Voltage is 5 V with external power supply.There are many advantages,easy to coding and uploading,easy to error corrections,available different sensors and other devices,can be used for led control,motor control and any other devices.

When give power supply to Arduino board,use 5 volt or 9 volt battery.But do not use 12 volt directly to Arduino. If has to use 12v battery,give it through 5v regulator circuit.

Step 2: Ultrasonic Sensor (HC SR 04)

The robot has three Ultrasonic Sensors where are front,left and right.Robot works according to these sensors.An Ultrasonic sensor is a device that can measure the distance to an object by using sound waves.There are four pins which are VCC (5v power supply),GND (Ground),Trig and echo.There are two transducers ,one for Transmit & the other for Receive.Both are fixed on a single PCB with control circuit.Ultrasonic distance measurements from about 2 cm to 400 cm. Also is a high frequency sound of frequency 40 KHz.

Principle of Operation

From Arduino generate a short 20 uS pulse to the Trigger input to start the ranging.The Ultrasonic Module will send out an 8 cycle burst of ultrasound at 40 khz and raise its echo line high.

It then listens for an echo, and as soon as it detects one it lowers the echo line again. The echo line is therefore a pulse whose width is proportional to the distance to the object.

By timing the pulse it is possible to calculate the range in inches/centimeters.

The module provides an echo pulse proportional to distance.

uS/58=cm or uS/148=inches.

Step 3: Other Components

Available different sizes in motors shaft diameter (4 mm,6 mm).Make sure which size you need.

Jumper Cable should be Male to Female and Male to Male.

Step 4: Sensors With Arduino Connection Diagram

Front Sensor :-

Echo pin - Arduino pin 6

Trig pin - Arduino pin 7

VCC pin - 5V

GND - ground

Left Sensor :-
Echo pin - Arduino pin 8

Trig pin - Arduino pin 9

VCC pin - 5V
GND - ground

Right Sensor :-
Echo pin - Arduino pin 10

Trig pin - Arduino pin 11

VCC pin - 5V
GND - ground

Step 5: Relay Board With Arduino Connection Diagram

Relay pin 1 - Arduino pin 2.

Relay pin 2 - Arduino pin 3.

Relay pin 3 - Arduino pin 4.

Relay pin 4 - Arduino pin 5.

Step 6: 12 Volt and Relay Connection

NC - Normal Closed

NO - Normal Open

C - Common

Here you can change polarity,if you need.According to that, motor rotating direction will change.

Motors should be connected to the common pins.

Step 7: Assembling

Left side and right side motors should be separated from each sides.Front side motors are parallel with back side motors.

Step 8: Codes

Step 9: Testing and Finishing

Share

    Recommendations

    • Make it Move Contest

      Make it Move Contest
    • Planter Challenge

      Planter Challenge
    • Casting Contest

      Casting Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    6 Comments

    How can I download those codes??

    your code doesnt match the wiring you done also the code mention two ENA,ENB which you never mentioned ?

    2 replies

    I don't know the wiring etc.. But I know that the logic he used the file attaches, can't do the work that robot is performing in the video.

    Thanks for your comment.This is the same codes that i did.You can check it.

    And i did not use any ena or enb.