Introduction: Obstacle Avoiding Robot Using Ultrasonic Sensors

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