Slider

***পরম করুনামই আল্লাহর নামে শুরু করিলাম*** بسم الله الرحمن الرحيم *** বিসমিল্লাহির রাহমানির রাহীম ***

Wednesday, May 3, 2023

Obstetrical avoiding and Manual controllable robot

A B S T R A C T
Obstacle detection and avoidance can be considered as one of the most captivating term in designing robots. This technology provides the robots with senses which it can use to traverse in unfamiliar environments without damaging itself. In this paper an Obstacle Avoiding Robot is designed which can detect obstacles in its path and maneuver around them without making any collision. We can consider it as an autonomous robot when we use it in auto mode and manually it can be controlled via our smartphones as well  as, it successfully maneuvered in unknown environments without any collision. The hardware used in this project is widely available and inexpensive which makes the robot easily replicable. This paper introduce us with the outcome that can objectify itself in many scopes. The robot would have the capacity to detect obstacles in its path based on a predetermined threshold distance. After obstacle detection, the robot would change its course to a relatively open path by making autonomous decision. It would require no external control during its operation in auto mode ,it can run   under our guidance with the help of manual mode installed in the device. It can measure the distance between itself and the surrounding objects in real-time. It would be able to operate effectively in unknown environment, where human penetration may be fatal. With the growth and evolution of robotic terms our research can be introduced as another venture to generate quality outcomes.
 Keywords: obstacle avoidance, ultrasonic sensor, Arduino microcontroller, autonomous robot, replicable

I N T R O D U C T I O N
The scientific and engineering discipline that is focused on the understanding and implementation of artificial land embodied capabilities are termed as robotics.  Modern robots have come a long way since the first initiation in 1950s and rooted itself as an enduring aid in the advancement and evolution of humankind. Robots took many forms, based on its application, and its size varied from a giant 51 feet to microscopic level. The term “obstacle avoidance” is now used in modern robotics to denote the capability of robot to navigate over an unknown environment without having any collision with surrounding objects (Duino-Robotics, 2013). Obstacle avoidance in robots can bring more flexibility in maneuvering in varying environments and would be much more efficient as continuous human monitoring is not required. This project developed an obstacle avoiding and self-supervising robot which can move without any collision by sensing obstacles on its course with the help of the ultrasonic distance sensors. Robots guided with this technology can be put into diversified fields, e.g., driverless vehicles, autonomous cleaning, automated lawn mower and supervising robot in industries. .It would require no external control during its operation in auto mode ,it can run   under our guidance with the help of manual mode installed in the device. It can measure the distance between itself and the surrounding objects in real-time. In addition to this there are few modes installed in this robot that aids the systematic functioning of the robot in different modes. It is a robot vehicle that works on arduino Microcontroller and employs an ultrasonic distance sensor to detect obstacles. The arduino board was selected as the microcontroller platform and its software counterpart, arduino Software, was used to carry out the programming. The integration of the ultrasonic distance sensor provides higher accuracy in detecting surrounding obstacles.




2. WORKING AND EXPERIMENTAL DETAILS 
A simple survey on Obstacle Avoiding Robot is designed here. Robotics is an interesting and fist growing field. Being a branch of engineering, the applications of robotics are increasing with the advancement of technology. The concept of Mobile Robot is fast evolving and the number of mobile robots and their complexities are increasing with different applications.

Figl: 1 

There are many types of mobile robot navigation techniques like path planning, self – localization and map interpreting. An Obstacle Avoiding Robot is a type of autonomous mobile robot that avoids collision with unexpected obstacles. In this research paper, an Obstacle Avoiding Robot is designed. It is an Arduino based robot that uses Ultrasonic range finder sensors to avoid collisions 


Fig: 2 

2.1 Component Description 
2.1.1Arduino Uno 

Arduino Uno is an mega 328p Microcontroller based prototyping board. It is an open source electronic prototyping platform that can be used with various sensors and actuators. Arduino Uno has 14 digital I/O pins out of which 6 pins are used in this project. 


Fig: 3 


HC – SR04 

It is an Ultrasonic Range Finder Sensor. It is a non-contact based distance measurement system and can measure distance of 2cm to 4m. 


Fig: 4 






L293D 

It is a motor driver which can provide bi-directional drive current for two motors. 






Servo Motor 

The Tower Pro SG90 is a simple Servo Motor which can rotate 90 degrees in each direction (approximately 180 degrees in total). 

Bluetooth Module HC-05 

HC-05 is a Bluetooth module which is designed for wireless comunication. This module can be used in a master or slave configuration.in this research smart device is connected via Bluetooth that makes the communication between the device and the robot. 


Fig: 5 


3. Design of Obstacle Avoiding Robot using Arduino 

Arduino is the main processing unit of the robot. Out of the 14 available digital I/O pins, 7 pins are used in this project design. The ultrasonic sensor has 4 pins: Vcc, Trig, Echo and Gnd. Vcc and Gnd are connected to the +5v and GND pins of the Arduino. Trig (Trigger) is connected to the 9th pin and Echo is connected to 8th pin of the Arduino UNO respectively. A Servo Motor is used to rotate the Ultrasonic Sensor to scan for obstacles. It has three pins namely Control, VCC and GND. The Servo Control Pin is connected to pin 11 of Arduino while the VCC and GND are connected to +5V and GND. L293D is a 16 pin IC. Pins 1 and 9 are the enable pins. These pins are connected to +5V. Pins 2 and 7 are control inputs from microcontroller for first motor. They are connected to pins 6 and 7 of Arduino respectively. Similarly, pins 10 and 15 are control inputs from microcontroller for second motor. They are connected to pins 5 and 4 of Arduino. Pins 4, 5, 12 and 13 of L293D are ground pins and are connected to Gnd. First motor (consider this as the motor for left wheel) is connected across the pins 3 and 6 of L293D. The second motor, which acts as the right wheel motor, is connected to 11 and 14 pins of L293D.The 16th pin of L293D is Vcc1. This is connected to +5V. The 8th pins is Vcc2. This is the motor supply voltage. This can be connected anywhere between 4.7V and 36V. In this project, pin 8 if L293D is connected to +5V supply. If the above Circuit Diagram of the Obstacle Avoiding Robot is unclear, the following image might be helpful.




4. Codes:


#include <NewPing.h>
#include <Servo.h>

Servo myservo;


#define TRIGGER_PIN 11
#define ECHO_PIN 10
#define MAX_DISTANCE 1000

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

#define motor_aPin1 A0
#define motor_aPin2 A1
#define motor_bPin1 A2
#define motor_bPin2 A3
#define motor_aEnable 5
#define motor_bEnable 6
#define OB_range 30

int LSlpin = 3;
int RSlpin = 4;
const int buzzer = 7;
int Blpin = 5;
int Hlpin = 6;

int i=0, pos = 0,current_distance=0;
int range0=0, range30=0, range60=0, range85=0,range90=0,range95=0, range120=0, range150=0, range180=0 ;
unsigned long previous_millis = 0;
char serialData;

void setup()
{
 Serial.begin(9600);
 myservo.attach(9);


pinMode(motor_aPin1,OUTPUT);
 pinMode(motor_aPin2,OUTPUT);
 pinMode(motor_bPin1,OUTPUT);
 pinMode(motor_bPin2,OUTPUT);
 pinMode(motor_aEnable,OUTPUT);
 pinMode(motor_bEnable,OUTPUT);
analogWrite(motor_aEnable,200);
analogWrite(motor_bEnable,200);


pinMode(buzzer, OUTPUT);
pinMode(LSlpin,OUTPUT);
pinMode(RSlpin,OUTPUT);
pinMode(Blpin,OUTPUT);
pinMode(Hlpin,OUTPUT);


}

void brake()
{
 digitalWrite(motor_aPin1,LOW);
 digitalWrite(motor_aPin2,LOW);
 digitalWrite(motor_bPin1,LOW);
 digitalWrite(motor_bPin2,LOW);
 digitalWrite(LSlpin,LOW);
 digitalWrite(RSlpin,LOW);
 digitalWrite(Blpin,HIGH);
 digitalWrite(Hlpin,LOW);

}

void forward()
{
 digitalWrite(motor_aPin1,LOW);
 digitalWrite(motor_aPin2,HIGH);
 digitalWrite(motor_bPin1,LOW);
 digitalWrite(motor_bPin2,HIGH);
  digitalWrite(LSlpin,LOW);
 digitalWrite(RSlpin,LOW);
 digitalWrite(Blpin,LOW);
 digitalWrite(Hlpin,HIGH);

}

void forward_right()
{
 digitalWrite(motor_aPin1,LOW);
 digitalWrite(motor_aPin2,HIGH);
 digitalWrite(motor_bPin1,HIGH);
 digitalWrite(motor_bPin2,LOW);
  digitalWrite(LSlpin, LOW);
 digitalWrite(RSlpin,HIGH);
 digitalWrite(Blpin,LOW);
 digitalWrite(Hlpin,LOW);

}

void forward_left()
{
 digitalWrite(motor_aPin1,HIGH);
 digitalWrite(motor_aPin2,LOW);
 digitalWrite(motor_bPin1,LOW);
 digitalWrite(motor_bPin2,HIGH);
  digitalWrite(LSlpin,HIGH);
 digitalWrite(RSlpin,LOW);
 digitalWrite(Blpin,LOW);
 digitalWrite(Hlpin,LOW);

}

void backward()
{
 digitalWrite(motor_aPin1,HIGH);
 digitalWrite(motor_aPin2,LOW);
 digitalWrite(motor_bPin1,HIGH);
 digitalWrite(motor_bPin2,LOW);
  digitalWrite(LSlpin,LOW);
 digitalWrite(RSlpin,LOW);
 digitalWrite(Blpin,HIGH);
 digitalWrite(Hlpin,LOW);

}

void backward_right()
{
 digitalWrite(motor_aPin1,LOW);
 digitalWrite(motor_aPin2,LOW);
 digitalWrite(motor_bPin1,HIGH);
 digitalWrite(motor_bPin2,LOW);

}
void backward_left()
{
 digitalWrite(motor_aPin1,HIGH);
 digitalWrite(motor_aPin2,LOW);
 digitalWrite(motor_bPin1,LOW);
 digitalWrite(motor_bPin2,LOW);

}

void left()
{
 digitalWrite(motor_aPin1,LOW);
 digitalWrite(motor_aPin2,HIGH);
 digitalWrite(motor_bPin1,HIGH);
 digitalWrite(motor_bPin2,LOW);
  digitalWrite(LSlpin,HIGH);
 digitalWrite(RSlpin,LOW);
 digitalWrite(Blpin,LOW);
 digitalWrite(Hlpin,LOW);

}

void right()
{
 digitalWrite(motor_aPin1,HIGH);
 digitalWrite(motor_aPin2,LOW);
 digitalWrite(motor_bPin1,LOW);
 digitalWrite(motor_bPin2,HIGH);
  digitalWrite(LSlpin,LOW);
 digitalWrite(RSlpin, HIGH);
 digitalWrite(Blpin,LOW);
 digitalWrite(Hlpin,LOW);

}

//i will describe it on presentation ........

int range(int pos)
{
 myservo.write(pos);
 delay(300);
 current_distance = sonar.ping_cm();
 if(current_distance==0)
 current_distance=100;
 if(current_distance > 0 && current_distance < 15){
 Serial.print("Brack");
 if(pos==90){
 backward();
 delay(500);}
 if(pos < 90){
 backward_right();
 delay(500);}
 if(pos > 90){
 backward_left();
 delay(500);}
 return current_distance;
 }
}

void loop()

{


Automatic: brake();
 delay(300);

while(1){

 if(Serial.available()>0)
 serialData=Serial.read();
 if(serialData=='M')
 goto Manual;


 above: range90=0;

 range90=range(90);
 delay(10);


 while(range90 >= OB_range ){

 if(millis()-previous_millis>2000){
 previous_millis=millis();
 range(180);
 delay(50);
 range(0);
 delay(50);}

 range90=range(90);
 analogWrite(motor_aEnable,150);
 analogWrite(motor_bEnable,150);

 forward(); Serial.print("Forward");


 if(Serial.available()>0)
 serialData=Serial.read();
 if(serialData=='M')
 goto Manual;
 }
 brake();


 if(range90 <OB_range)
 {
 analogWrite(motor_aEnable,100);
 analogWrite(motor_bEnable,100);
 brake();
 range60=0;
 range60=range(60);
 delay(200);
 range120=0;
 range120=range(120);
 delay(200);
 if(Serial.available()>0)
 serialData=Serial.read();
 if(serialData=='M')
 goto Manual;

 if(range60 >OB_range || range120 >OB_range )
 {

 if(range60 >= range120){
 forward_right();Serial.print("Turning Right");
 delay(50);goto above;}

 else if(range60 < range120){
 forward_left();Serial.print("Turning Left");
 delay(50);goto above;}
 }


 if(range60 <OB_range && range120 <OB_range)
 {
above1: range30=0;
 range30=range(30);
 delay(200);
 range150=0;
 range150=range(150);
 delay(200);
 if(Serial.available()>0)
 serialData=Serial.read();
 if(serialData=='M')
 goto Manual;

 if(range30 >OB_range || range150 >OB_range )
 {

 if(range30 >= range150){
 right();Serial.print("Turning Right");
 delay(100);goto above;}

 else if(range30 < range150){
 left();Serial.print("Turning Left");
 delay(100);goto above;}
 }
 if(range30 <OB_range && range150 <OB_range)
 {
 range0=0;
 range0=range(0);
 delay(200);
 range180=0;
 range180=range(180);
 delay(200);
 if(Serial.available()>0)
 serialData=Serial.read();
 if(serialData=='M')
 goto Manual;

 if(range0 >OB_range || range180 >OB_range )
 {

 if(range0 >= range180){
 backward_right();Serial.print("Turning Right");
 delay(200);goto above;}

 else if(range0 < range180){
 backward_left();Serial.print("Turning Left");
 delay(200);goto above;}
 }
 if(range0 <OB_range && range180 <OB_range)
 {
 backward();Serial.print("Brack");
 delay(200);
 goto above1;
 }
 }
 }
 }
 }

Manual: brake();
 delay(300);


 while(1){
 if(Serial.available()>0)
 serialData=Serial.read();
 if(serialData=='A')
 goto Automatic;

 if(serialData=='F')
 forward();
 if(serialData=='B')
 backward();
 if(serialData=='S')
 brake();
 if(serialData=='L')
 left();
 if(serialData=='R')
 right();
 }
}






5.Results and discussion


Before going to working of the project, it is important to understand how the ultrasonic sensor works. The basic principle behind the working of ultrasonic sensor is as follows. Using an external trigger signal, the Trig pin on ultrasonic sensor is made logic high for at least 10µs. A sonic burst from the transmitter module is sent. This consists of 8 pulses of 40KHz. The signals return back after hitting a surface and the receiver detects this signal. The Echo pin is high from the time of sending the signal and receiving it. This time can be converted to distance using appropriate calculations. The aim of this project is to implement an obstacle avoiding robot using ultrasonic sensor and Arduino. All the connections are made as per the circuit diagram. The working of the project is explained below.










When the robot is powered on, both the motors of the robot will run normally and the robot moves forward. During this time, the ultrasonic sensor continuously calculates the distance between the robot and the reflective surface. This information is processed by the Arduino. If the distance between the robot and the obstacle is less than 15cm, the Robot stops and scans in left and right directions for new distance using Servo Motor and Ultrasonic Sensor. If the distance towards the left side is more than that of the right side, the robot will prepare for a left turn. But first, it backs up a little bit and then activates the Left Wheel Motor in reversed in direction. Similarly, if the right distance is more than that of the left distance, the Robot prepares right rotation. This process continues forever and the robot keeps on moving without hitting any obstacles.










6.CONCLUSION


This device detects obstacles with the help of ultrasonic distance sensor to measures the distance to surrounding objects. Although the research is started with a single ultrasonic sensor, two more sensors is added since the robot had blind spots in its right and left direction for which it was having collision while maneuvering. Unlike the paper discussed above, it concentrates on coordinating multiple ultrasonic sensors for maneuvering without collision and also maintaining a minimum travel distance. Fig.2 describes this algorithm in a flow chart. The robot was designed to detect the presence of any object within the specified threshold distance. If any object is found within this distance, it is designated as an obstacle and the robot will turn away from it. The three ultrasonic sensors are placed in the frontal section of the robot at the right, middle and left position. The three sensors emit an ultrasonic pulse every 300 MS which echoes from the neighboring objects. Using time difference between the input and echo, the Arduino calculates the distance to the obstacle from which the echo is coming by using the constant speed of sound 340 m/s. When one of the sensors detects obstacle within the threshold distance, the robot changes its direction. Along with these basic movements, the robot is designed to handle a more complex situation when all three sensors have obstacles within the specified range. In this case, the robot will move backward for 10 MS and again check the distance to objects with the help of right and left sensors. The robot will then compare the two distances and move in the direction where the distance is appropriate. Hence there are many prospects of this device that will cultivate many aspects in the field of robotics.








No comments: