I used 2 Motors 2 wheels and a castor for this project, you can use the same by using 2WD robot kit which would give more power to this robot and it require less assembly. I used L293D Motor driver that can also be replaced by l298 Motor driver.

You can check the video about the working of this obstacle avoiding robot, where you cannot predict its next move, It moves by its own without using much sensors and complex coding.
* Place the ultrasonic sensor at the Front Edge of the chassis which allow the robot to detect obstacle easily.
* Connect the sensor to the Arduino,
* Connect the Motors to L298 or L293D Motor driver
* Make sure you are connecting correct logic pins of motor driver to the arduino pins.
Arduino code:
#define echopin 8 // echo pin
#define trigpin 9 // Trigger pin
int maximumRange = 30;
long duration, distance;
void setup() {
Serial.begin (9600);
pinMode (trigpin, OUTPUT);
pinMode (echopin, INPUT );
pinMode (4, OUTPUT);
pinMode (5, OUTPUT);
pinMode (13, OUTPUT);
pinMode (6, OUTPUT);
pinMode (7, OUTPUT);
}
void loop ()
{
{
digitalWrite(trigpin,LOW);
delayMicroseconds(2);
digitalWrite(trigpin,HIGH);
delayMicroseconds(10);
duration=pulseIn (echopin,HIGH);
distance= duration/58.2;
delay (50);
Serial.println(distance);
}
if (distance >= 30 ){
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
delay (200);
}
else if (distance >=15 && distance <= 25) {
digitalWrite (4,HIGH);
digitalWrite (5,LOW);
digitalWrite (6,LOW);
digitalWrite (7,LOW);
delay (1000);
}
else if (distance < 15){
digitalWrite (4, LOW);
digitalWrite (5, LOW);
digitalWrite (6,HIGH);
digitalWrite (7,HIGH);
delay (1000);
digitalWrite (4,LOW);
digitalWrite (5,HIGH);
digitalWrite (6,LOW);
digitalWrite (7, LOW);
delay (1000);
}
}
copy and paste the above arduino code and enjoy