About Lesson
Obstacle Avoiding Robot
Introduction
Here we are going to see how to make an obstacle-avoiding robot. For making this project we need ultrasonic sensors, BO motors, and a Kblox Neo. An Obstacle Avoidance Robot is an intelligent robot, which can automatically sense and overcome obstacles on its path. It consists of a Microcontroller to process the data, and Ultrasonic sensors to detect the obstacles on its path. Obstacle avoidance is one of the most important aspects of mobile robotics.
Components required
- Kblox Neo
- Ultrasonic sensor
- Chassis
- BO motor [Qty-2]
- Wheels 75mm [Qty-2]
- Castor wheel
- Screw-driver
- Battery 9V
- Battery clip
- A to B USB cable
- Jumper wires [M-F, Qty-8]
Code
#include"kblox.h"
kblox kit;
void setup() {
Serial.begin(9600);
kit.motor_begin(12, 11, 5, 3); //define motors pins
kit.ultrasonic_begin(8, 9); // define ultasonic pins
}
void loop() {
int d = kit.ultrasonic_read(); //read distance and store in variable
Serial.println(d); //print data serially
if (d >= 25) { // if distance is more than 25 move bot forward
kit.forward();
}
else {
kit.right(); // if distance is less than 25 move bot right
}
}
Applications
- It can be used in automatic vacuum cleaning
- It can be mobile robot navigation
- They can also be used in dangerous environments, where human penetration could be fatal.