Obstacle Avoiding Robot by Arduino and Ultrasonic sensor

When we see engineering and technology.  A term embedded system helps us to make our comfort and automatic things, these can be internet related, automation related and in many more category of technology. best electronic projects is a technical organization created with an intention to cater to the needs of an electronics hobbyist.

So, today we are going to make an awesome obstacle avoiding robot step by step tutorial. this robot can detect thing near him and make the decision itself by the microcontroller used in the robot. we use Arduino development board in obstacle avoiding robot. The sensor transmits some data in the ultrasonic waveform which come back after hitting the subject and the duration in this phenomena Divide with the speed of sound which gives the distance of the subjects.In this Obstacle Avoiding Robot by Arduino and Ultrasonic sensor, we learn the concepts of Ultrasonic sensor, it’s working, working principle, concepts, uses, calculation and many more things. ultrasonic based obstacle avoiding robot uses ultrasonic wave principle to work. it is very good projects to learn the embedded system. You can make many other projects like line follower robot  

Obstacle Avoiding Robot by Arduino and Ultrasonic sensor
Obstacle avoiding robot by Arduino and the ultrasonic sensor works on the ultrasonic frequency. the ultrasonic sensor gives the distance of the object. then Arduino gives output to the robot motor according to this distance and your instructions. the basic work of the ultrasonic sensor is measuring distance in centimeters. so we can use this in our many best electronics and engineering projects. 

Component Required for obstacle avoiding Ultrasonic robot:-

  • Ultrasonic Sensor
  • Arduino Uno
  • Chassis
  • 4 motos
  • Motor driver L2N8
1. Ultrasonic Sensor:-

                 ultrasonic sensor work on the Ultrasonic frequency at the range of 40000 hz. It has two component in the module. one is a transmitter which is known as Trigger and another is a receiver which is called as Echo. It transmits the Ultrasound of 40000 hz . and receive it by the Receiver in the module after some time. a sound wave is generated and transmitted through the transmitter and this soundwave comeback to the receiver by collision with an object.

The ultrasonic sensor is widely used in embedded projects as well as in robotics projects. very easy to use and have only 4 pins Echo, Trig, GND, Vcc. you can make many other projects with the ultrasonic sensor Arduino such as distance measures device, Stick for blind persons which can be very useful. the ultrasonic sensor has a very high-frequency range for sound. which we can not hear.

To know more about the ultrasonic sensor download the data sheet and read it carefully. definitely, you will find something useful for your projects and maybe you find some more projects on the ultrasonic working principle. you can learn also the interfacing to the AVR, Arduino, Raspberry Pie and with many other controllers. In this post, we will teach you how to use the ultrasonic sensor with Arduino. 

ultrasonic sensor
Distance calculation in ultrasonic sensor:-
sound wave generates and transmits by the transmitter. now, this sound wave collides with any objects and come back to the receiver. the duration is taken by soundwave helps to calculate the distance cover by the soundwave. as we know the velocity of soundwave. and we get the duration to come back the sound wave. now we have both duration and velocity. can we calculate the distance by  the formula
working of ultrasomnic sensor

2. Arduino Uno 

As we know the Arduino is an open-source microcontroller. having 14 GPIO pins and 6 analog pins. works on 5v-9v. to learn Arduino go through this.
we can connect the ultrasonic sensor with the digital pins. in ultrasonic sensor we need to trigger by the digital pins in some microsecond duration.as you can see in the  CODE given below. we not need any serial connection with the ultrasonic sensor.

3. Chassis:-
 Assemble all component on the chassis. According to the image shown in fig 1
4. Motor driver L2N8
The motor driver module is used to give sufficient power supply to the motor. arduino cannot give sufficient power supply. it can give 3.3v and some more. so we use L2N9 or L2N3D motor driver to give more accurate supply to the motor.

Obstacle avoiding robot connections/ultrasonic sensor interface with arduino 

Obstacle avoiding robot connections/ultrasonic sensor interface with arduino
  • Connect ultrasonic Trig pin to Arduino pin9
  • Connect ultrasonic Echo pin to Arduino pin10
  • Connect Arduino pin 5 pin to Arduino L2N8  pin IN1
  • Connect Arduino pin 6 pin to Arduino L2N8  pin IN2
  • Connect Arduino pin 7 pin to Arduino L2N8  pin IN3
  • Connect Arduino pin 8 pin to Arduino L2N8  pin IN4
  • Connect Arduino Vcc and Gnd with  Ultrasonic sensor Vcc and Gnd
  • Connect L2N8 5v with arduino Vcc and Gnd to Gnd.
  • Give 9v,12v supply to the L2N8

CODE  Obstacle Avoiding Robot by Arduino and Ultrasonic sensor

int duration=0;
long distance=0;
void setup() {
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
void loop() {
digitalWrite(9, HIGH);
digitalWrite(9, LOW);
duration= pulseIn(10,HIGH);
 digitalWrite(5, LOW);
  digitalWrite(6, HIGH);
  digitalWrite(7, HIGH);
  digitalWrite(8, LOW);  
  digitalWrite(5, HIGH);
  digitalWrite(6, LOW);
  digitalWrite(7, HIGH);
  digitalWrite(8, LOW);
put this code into your Arduino IDE and upload to your Arduino Uno.
All the best
Obstacle Avoiding Robot by Arduino and Ultrasonic sensor /arduino obstacle avoiding robot, arduino projects, arduino ultrasonic projects, 

Leave a Reply

Your email address will not be published. Required fields are marked *