Obstacle Avoiding Robot Using Ultrasonic Sensors

13,985

15

11

About: Passion and love for working with Industrial Automation, Innovation, Electronics, Robotics, Biomechatronics and Artificial Intelligence.

This is a simple project about 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.And please notice that is not a tutorial project, share your knowledge and comments with me.

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.There are many number of Sensor modules and other devices for Arduino.

When you are giving the power supply to Arduino board,use 5 volt or 9 volts.You should not power up by 12 volts. If you have 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

There are different sizes of diameter of motor shafts and hole size of the wheels.

Jumper Cable should be Male to Female.

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.

Step 8: Codes

Step 9: Testing and Finishing

Share

    Recommendations

    • 1 Hour Challenge

      1 Hour Challenge
    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest
    • Classroom Science Contest

      Classroom Science Contest

    11 Discussions

    0
    None
    isuruudaraionita2cristian

    Reply 4 weeks ago

    Hi,You have to modify the code according to bluetooth device.I never used bluetooth device.So I do not have good idea to explain you,sorry.But I am sure you can do that easily.

    0
    None
    Mahmoudk47

    1 year ago

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

    4 replies
    0
    None
    isuruudaraMahmoudk47

    Reply 9 months ago

    Hi dude,

    Better not to by heart wiring etc,please use your skills.I have checked several times before upload it.

    Thanks.

    0
    None
    AaqibJMahmoudk47

    Reply 1 year ago

    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.

    0
    None
    isuruudaraAaqibJ

    Reply 9 months ago

    Thanks for commenting,I think you can understand video is a demonstration for getting simple idea.

    Dude,

    Where I have kept objects and your objects, robot...,obviously it does not work same in video.But robot function is same.

    Also, better not to by heart the video and wiring etc,please use your skills.Because I check more times and did upload it.

    Thanks.

    0
    None
    isuruudaraMahmoudk47

    Reply 1 year ago

    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.