EEE 404 Map Generating Robot
EEE 404 Map Generating Robot
DE P A R T M E N T O F EL E C T R I C A L A N D EL E C T R O N I C EN G I N E E R I N G
Experiment 06
Design and Implementation of an Autonomous Map
Generating Robot
Evaluation Form:
IMPORTANT! You must complete this experiment during your scheduled lab period. All work
for this experiment must be demonstrated to and verified by your lab instructor before the end
of your scheduled lab period.
Signature of Evaluator:
IMPORTANT! Please carefully read and sign the Academic Honesty Statement, below. You will not
receive credit for this lab experiment unless this statement is signed in the presence of your lab instructor.
“In signing this statement, I hereby certify that the work on this experiment is my own and that I have not copied
the work of any other student (past or present) while completing this experiment. I understand that if I fail to honor
this agreement, I will receive a score of ZERO for this experiment and be subject to possible disciplinary action.”
2 Introduction
Robots explore the environment looking for walls and other environmental features. Robot’s movement
is described by rectilinear displacements and turns are performed without changing robot’s positions. In
free space, robots explore by travelling random distances and making random turns. A robot stops its free
movement when it detects a wall or an obstacle; in this case the robot follows the wall, or the edge of the
obstacle, for a certain distance. In this project, we are using an ultrasonic Distance sensor. It generates
sound waves beyond the scope of human hearing and measures distance by calculating the time required
by these waves to hit an obstacle and travel back. This is similar to the principle used by bats. Another
component that we are going to use is a servo motor. It differs from the usual DC motor in that it can turn
very precisely to a given angular position and hold its state there. When a servo motor is given pulses of a
specific duration, it moves to the corresponding angular position. We will be using both these
components to get a 180° field of view. After the system gets the reading from the surrounding using the
sensor and the motor, it will create a polar plot or map of the surrounding showing the position of
different objects in the field of view of our system using MATLAB and Arduino.
3 Hardware Requirement
This project uses the following hardware:
ARDUINO UNO (any Arduino footprint board can be used in place of the Uno)
The arduino UNO is a microcontroller board with 14 digital input/output pins, 6 analog inputs, a 16
MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button. The Uno is
ULTRASONIC SENSOR
HC-SR04 The sensor HC-SR04 takes all the readings. It emits ultrasonic waves which hits an obstacle
and reflects to the sensor after which it calculates the distance between the bot and obstacle.
There are four pins on the sensor : VCC, TRIG, ECHO and GND. Each of these pins are connected to
the arduino board via jumper wires. The VCC pin is connected to the 5V volt power supply, the TRIG
and ECHO pins are connected to output and input pins respectively on the arduino board and the GND
to one of the three ground connection pins on the board. VCC = +5VDC Trig = Trigger input of Sensor
Echo = Echo output of Sensor GND = GND
The two circular structures placed on the sensors circuit board are the main parts of the module. These
are the parts, which deal with sending out and receiving ultrasounds. To start ranging ,a high level
signal is sent for 10us using Trigger.The module sends eight 40 KHz signals automatically, and then
detects whether pulse is received or not. The range/distance of the sensor is calculated by the time
taken of the reflection of the ultrasound to reach the sensor. In simpler words it is the time interval
between the initial signal sent and the echo signal received by the sensor Distance= (Time x Speed of
Sound in Air)/2 where, Speed of Sound in Air = 340 m/s
• Low cost.
• Can effectively provide distance to objects.
• Produces tractable amount of data for interpretation. Disadvantages of Using the HC-SR04 Sensor
• Poorer discriminatory ability than vision
• Susceptible to noise/distortion • Can produce erroneous data (reflections)
TOWER PRO MG945 The ultrasonic sensor is placed on the servo so that it can take a 180° reading of
its surroundings. The servo has three wires coming out of it, of the three one is for power, one for
grounding and another for input. However, there are a couple of downsides of using the servo motor
they are:
IR SENSOR
Figure 4. IR sensor
Infrared (IR) sensors consist of both IR photodiodes and LEDs. The photodiode, acting as a
receiver, captures IR light emitted by the LED. When this emitted IR light strikes a surface, it
reflects back to the photodiode. The output voltage generated by the photodiode is directly
proportional to the reflectance of the surface, registering high for lighter surfaces and low for
darker ones. This property enables the sensor to distinguish between light and dark objects
based on their IR reflectance.
L298N module is a high voltage, high current dual full-bridge motor driver module for
controlling DC motor and stepper motor. It can control both the speed and rotation direction of
two DC motors. This module consists of an L298 dual-channel H-Bridge motor driver IC. This
module uses two techniques for the control speed and rotation direction of the DC motor.
4 Methodology
The working principle of a map-generating robot involves several key components and processes
working together to navigate its environment, collect data, and create a map. Here's an overview of the
general working principle:
Sensors:
The robot has various sensors such as LIDAR, cameras, ultrasonic sensors, IMUs, and possibly GPS.
These sensors gather data about the robot's surroundings including terrain, obstacles, landmarks, and its
own position and orientation.
Localization:
The robot uses sensor data and localization algorithms to determine its position and orientation within
the environment. Common localization techniques include sensor fusion, odometry, and SLAM
(Simultaneous localization and Mapping).
Mapping:
As the robot moves through the environment, it continuously collects sensor data.
Mapping algorithms process this data to create a representation of the environment.
Depending on the algorithm used, this representation can be in the form of an occupancy grid map, a
feature-based map, or a semantic map.
Obstacle Avoidance:
While navigating, the robot uses obstacle detection and avoidance algorithms to avoid collisions with
obstacles in its path. This may involve real-time analysis of sensor data to detect obstacles and adjust
the robot's path accordingly.
Iterative Process:
The map-generating process is often iterative, with the robot continuously updating and refining its
map as it explores new areas or encounters changes in the environment.
5 Software Requirement
We are using the following software:
The ARDUINO IDE to upload control code to the Arduino to rotate the servo and get distance data
from the ultrasonic sensor and also push it to the serial port.
MATHWORKS MATLAB to receive data from the serial line, process it and visualize it to a graph.
(For this install The MATLAB Support Package for Arduino Hardware which will let one use
MATLAB to communicate with the board through USB cable)
Working Process:
Start
Setup:
- Initialize serial communication
- Initialize Bluetooth communication
- Configure sensor pins and ultrasound pins
- Configure motor pins
- Initialize Servo motor
- Initialize Servo motor angle for different positions
- Read and store the distance from the Ultrasonic sensor at different angles
Loop:
- Read distance from Ultrasonic sensor
- Print distance to Bluetooth
- If both right and left sensors detect white:
- Move forward
- If right sensor detects black and left sensor detects white:
- Turn right
- If right sensor detects white and left sensor detects black:
- Turn left
Functions:
- servoPulse: Generate PWM for Servo motor
- Ultrasonic_read: Measure distance using Ultrasonic sensor
- forward: Move robot forward
- backward: Move robot backward
- turnRight: Turn robot right
- turnLeft: Turn robot left
- Stop: Stop robot
End
Task:
1. Construct a reference map.
2. Take data from a path similar to the figure in your respective terminal (e.g. any serial monitor). Make
the robot circle at least twice around the terrain.
7 Appendix
Appendix A: Acknowledgement
The labsheet is prepared by Md. Jawad Ul Islam, Dept of EEE, BUET, on 22/12/2023 under the
supervision of Dr. Celia Shahnaz and Dr. Shaikh Anowarul Fattah and modified on 11/11/2024 by Aye
Thein Maung.