Cheetah Fox 1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 14

THE UNIVERSITY OF DA NANG OF SCIENCE AND

TECHNOLOGY FACULTY OF ADVANCED SCIENCE


AND TECHNOLOGY

REPORT
TEAM 4

Supervisor: Lê Quốc Huy

Da Nang, 2024
DESIGN ROBOT MEASURED IN THE MAZE

TABLE OF CONTENTS

PART 1: OVERVIEW ROBOT

1.1. Overview of the robot

PART II: DESIGN SYSTEM: SELF-PROPELLED ROBOT MEASURED


IN THE MAZE
2.1. Hardware design
2.1.1. DC gear motor V3
2.1.2. Module L298N
2.1.3. Board Arduino uno R3
2.1.4. Ultrasonic sensors HC-SR04
2.2. Software design
2.3. Assembly and design. Embed the code in the robot\
PART III : IMPLEMENTATION PROCESS
PART IV: RESULTS
PART V: ANALYZE & PROPOSE SOLUTIONS
PART VI : VALUABLE LESSONS

TEAM MEMBERS
- Phan Đăng Khôi Vỹ (Leader): Coder 1, develop, comment, and build robots
- Nguyễn Phạm Lan Phương : Coder 2, comment, and evaluate problems
- Huỳnh Khải Văn : Develop, comment, and build robots
- Dương Thị Bích Ngọc : Write reports, summaries, and evaluate problems
- Nguyễn Hữu Duy Nguyên : Write reports, comment and build robots
PART I: OVERVIEW MOBILE ROBOT
1.1. Overview of the robot
The maze sensor robot is a type of robot designed to automatically move and find its way in a maze.

This robot is equipped with sensors to detect and locate barriers in the maze, thereby determining the

optimal path to escape the maze. This helps the robot self-shape and adapt to its surrounding

environment without human intervention.

Below are some important characteristics of sensor robots navigating mazes:

 Sensors: Robots are often equipped with sensors such as infrared sensors, ultrasonic sensors,

or contact sensors to detect changes in the environment. Sensors help the robot recognize

walls, corners, and other signs to determine the path.

 Control algorithm: The robot uses a control algorithm to decide the direction of movement

based on data from sensors. These algorithms are often designed to optimize the search for

the shortest path or minimize getting stuck in a maze.

 Automatic control: Path-finding sensor robots often have automatic control capabilities,

meaning they can adjust their speed and direction of movement without human intervention.

 Application: This type of robot is often used in many fields such as education, scientific

research, and entertainment. They can be used to simulate or simulate real-life situations and

work in groups to solve problems.


PART II: DESIGN SYSTEM
2.1. Hardware design

2.1.1. DC MOTOR GEAR V3

The V3 geared DC motor has good quality along with its ease of assembly, bringing cost
savings and convenience to users.
Specifications:
 Operating voltage: 3-6 VDC
 Current consumption: 60mA Transmission ratio: 1:120
 Number of rpm: 100 rpm at 6V.
 Moment: 4500mg. cm
2.1.2. Module L298N

L298N can control 2 DC motors or 1 4-phase stepper motor.

Structure Describe
The inlet pins control the direction of rotation of
IN1 & IN2
motor A
The inlet pins control the direction of rotation of
IN3 & IN4
Motor B
ENA Activate PWM signal for Motor A
VIB Activate PWM signal for Motor B
OUT1 & OUT2 Output pins for motor A
OUT3 & OUT4 Output pins for motor B
12V Power input 12
5V Power up the logic circuit inside IC L298N
GND Ground pin

Features and specifications of the L298 module :


 Control module: 2A L298N
 Control chip: Pair H-Bridge L298N
 Voltage supplied to the motor (Max): 46V
 Motor supply current (maximum): 2A
 Logic voltage: 5V
 IC operating voltage: 5-35V
 IC operating current: 2A
 Logic current: 0-36mA
 Maximum power (W): 25W
 Current sensor for each motor
 Heatsink for better performance
 Power-on LED indicator

2.1.3. Arduino UNO R3

Arduino UNO R3 is an open-source microcontroller board based on the Microchip ATmega328


microcontroller developed by Arduino. cc. The board is equipped with sets of Digital and Analog
input/output pins that can communicate with various expansion boards. The Arduino Uno circuit is
suitable for those who are new to and passionate about electronics, and programming... Based on the
open platform provided by Arduino.cc, you can easily build your project as quickly as possible
(Robot programming, self-propelled vehicles, LED on/off control...).

Arduino Uno R3 Datasheet :


Control chip ATmega328P
Operating voltage 5V
Input voltage (recommended) 7- 12 V
Input voltage (limited) 6- 20 V
Number of Digital pins 14 (of which 6 provide PWM output)
Number of PWM Digital pins 6
Number of Analog pins 6
DC per I/O 20 mA
DC on pin 3.3V 50 mA
Length 68.6 mm
Width 53.4 mm

2.1.4. Ultrasonic sensor HC-SR04


- Ultrasonic Sensor HC-SR04 is a type of ultrasonic sensor used to measure distance. It uses
ultrasonic waves to emit a signal and then receives a reflected signal back from the object. Based on
the time it takes for the reflected signal to return, we can calculate the distance from the sensor to the
object.
- Use x3 for 3 directions.

Specifications:
 Voltage: 5V DC
 Operating current: < 2mA
 High level: 5V
 Low level: 0V
 Maximum angle: Not more than 15 degrees
 Distance: 2cm-450 cm (4.5m)
 Accuracy: 3mm
 Output signal: High pulse level 5V, low-level 0V
 Connection mode: VCC / Trig (T-Trigger) / Echo (R-Receive) / GND
Principle of operation :
To measure distance, we will emit a very short pulse (5 microseconds - ú) from the Trig pin. Then,
the sensor will generate a HIGH pulse at the Echo pin until it receives a reflected wave from this pin.
The width of the pulse will be equal to the time it takes for the ultrasonic wave to be emitted from the
sensor and return.
The speed of sound in air is 340 m/s (physical constant). Once we have calculated the time, we will
divide it by 2 then multiply by the mentioned speed to get the distance.
We will be following these steps to measure the distance:

- Initially, we will set the TRIG pin to High (5V) for 5 microseconds.

- After that, the ultrasonic module will send out sound waves of 40Khz frequency and record the
time.

- The sound waves will travel down to the surface of the liquid in the tank and reflect.

- The reflected wave will travel back to the transducer.

- The ultrasonic module will receive the reflected wave and timestamp the received time.

- Finally, the ultrasonic module will put the ECHO pin high in the time (microseconds) to respond to
the sound wave and calculate the distance.

Requirements that need to be fulfilled :


We set the goal that the robot must run stably, maintain balance, and perform tasks such as avoiding
obstacles in front (distance of 10 cm). Compact car that runs on batteries. Accurate measurement
sensors. The robot is designed to successfully avoid obstacles and escape the maze.

2.3. Assembly and design:


1. Connect the wheel (motor) to the L298N module.
To connect the wheel (motor) to the module L298N, follow these steps:

1. Connect the wire of the first wheel to OUT1 and OUT2.


2. Connect the wire of the second wheel to OUT3 and OUT4.
3. Use IN1 and IN2 to control the direction of the first wheel, and use IN3 and IN4 to control the
direction of the second wheel.
4. Use ENA to adjust the speed of the first wheel, and ENB to adjust the speed of the second wheel.

2. Connect the L298N module to the Arduino board


To connect the L298N module to the Arduino board, follow these steps:

1. Connect the 12V wire to one side of the switch.


2. Connect the red wire from the battery to the switch, and add another red wire to the switch.
3. Connect the 5V wire to the positive terminal of the breadboard. This will supply power to the
sensors and the board.
4. Connect the black wire of the power supply to one black wire of the GND of the Arduino board
circuit.

3. Connect 3 ultrasonic sensors HC-SR04 to the Arduino uno R3 board.

To connect the 3 sensors, we will plug their GND pins together into the negative terminal on the
breadboard. Then, from the breadboard's negative terminal, we will add a common wire to connect to
the GND pin of the Arduino Uno. The VCC pins of the three sensors will be attached to the anode on
the breadboard. Then, from the breadboard's anode, we will add a common wire to connect to the 5V
pin of the Arduino Uno. To handle the trig and echo, we need to plug in the declaration.

Part III: Implementation process


After receiving the task, the group met together to assign tasks. With two programmers, 3 mechanics,
the whole group learned together about how to create a robot, its components, and its operating
principles. Even though no one knows about coding or robots, we still actively learn, share, and
exchange knowledge with each other. After being given the components that same afternoon, we sat
together to test all the components, make sure everything worked normally, and check to see if there
were any missing components. The next day, we gathered at the school to carry out assembly, and
there were many additional problems. We changed the round frame to a rectangular one and the front
wheel to a multi-way wheel. And the car assembly process takes about 2 days. Next is the code for
the car; this is the most time-consuming part of the team. Initially, we came up with the idea of the
car running on the left wall, but because this algorithm is quite complicated and the car solving is
quite slow, we changed to the plan of the car running straight. Because the two wheels are not equal,
running straight can easily hit the wall. To solve this problem, we accelerated the left wheel to
minimize the deviation between the two wheels' speeds. First, we execute the code command to
measure the three sensors. When the sensors are fine, we continue to program the car to go straight,
then turn right, turn left, and go backward. The car had some problems, including duplicate
conditions and hitting walls quite a lot. It took us about 2 weeks to edit the command lines, which
was quite difficult. But fortunately, everyone in the group united to support each other and create
ideas.

PART IV: RESULT


General assessment
The robot is functioning efficiently, however, it can still not navigate through the entire maze.
Improvements are required to ensure that the robot can traverse various mazes with ease, without
getting stuck. We need to guarantee that it can handle any challenging situations that it may come
across. Moreover, this robot has some drawbacks such as the velocity of the wheel, and the messy
arrangement of wires.

const int th0 = 30;


const int th1 = 40;
const int th2 = 30;
// Khai báo chân cảm biế n siêu âm
// Ben trai
const int trig0 = A4;
const int echo0 = A5;
// Giua
const int trig1 = A3;
const int echo1 = A2;
// Ben phai
const int trig2 = A1;
const int echo2 = A0;
// Khoảng cách từ cảm biến đến vật cản
int mid;
int right;
int left;
// Khai báo chân động cơ
// motor phải
const int motorPin1 = 4;
const int motorPin2 = 5;
// motor trái
const int motorPin3 = 7;
const int motorPin4 = 6;
// Tốc độ motor
const int enB = 3;
const int enA = 11;

void moveForward(int speed = 115) {


digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);

analogWrite(enB, speed);
analogWrite(enA, speed + 9);
delay(250);
}

void turnRight(int speed = 120) {


digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);

analogWrite(enB, speed);
analogWrite(enA, speed + 9);
delay(350);
}
void turnLeft(int speed = 120) {
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);

analogWrite(enA, speed + 9);


analogWrite(enB, speed);
delay(350);
}

void stopMotors() {
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
}

void backWard(int speed = 90) {


digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);

analogWrite(enA, speed + 10);


analogWrite(enB, speed);
delay(350);
}

void turnAround(int speed = 80) {


digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);

analogWrite(enA, speed + 9);


analogWrite(enB, speed);
delay(750);
}

int getDistance(int trigPin, int echoPin)


{
unsigned long duration;
int distance;

digitalWrite(trigPin,0);
delayMicroseconds(2);
digitalWrite(trigPin,1);
delayMicroseconds(5);
digitalWrite(trigPin,0);
duration = pulseIn(echoPin,HIGH);
distance = int(duration*0.0343/2);

return distance;
}
void setup() {
Serial.begin(9600);
// Khai báo chân làm OUTPUT hoặc INPUT
pinMode(trig0, OUTPUT);
pinMode(echo0, INPUT);
pinMode(trig1, OUTPUT);
pinMode(echo1, INPUT);
pinMode(trig2, OUTPUT);
pinMode(echo2, INPUT);

pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
pinMode(motorPin3, OUTPUT);
pinMode(motorPin4, OUTPUT);

pinMode(enA, OUTPUT);
pinMode(enB, OUTPUT);
}

void loop() {
// Đo khoảng cách từ cảm biến
left = getDistance(trig0, echo0);
mid = getDistance(trig1, echo1);
right = getDistance(trig2, echo2);

// Giá trị khoảng cách đo được từ cảm biến


Serial.print("Trai:"); Serial.print(left); Serial.print(",");
Serial.print("Giua:"); Serial.print(mid); Serial.print(",");
Serial.print("Phai:"); Serial.print(right); Serial.print(",");
Serial.println();

if (left > th0) {


stopMotors();
delay(100);
turnLeft();
moveForward(80);
} else if (mid > th1) {
stopMotors();
delay(100);
moveForward();
} else if (right > th2) {
stopMotors();
delay(100);
turnRight();
moveForward(80);
} else {
stopMotors();
delay(100);
turnAround();
}
}

PART V: ANALYZE & PROPOSE SOLUTIONS


1. For robot
- This robot does not navigate through the complete maze and sometimes it gets stuck in walls.
To address this issue, we should optimize the code and restructure other components to enable
smoother movement for the robot.
- We need to adjust the code to slow down the robots. The wires need to be arranged neatly so
that the robots can be precise and orderly.
- As the speed of two wheels is not equal, the car can easily hit the wall when moving forward.
To solve this problem, we accelerated the left wheel to minimize the deviation between the
two wheels' speeds.
- We execute the code command to measure the three sensors. When the sensors are fine, we
continue to program the car to go straight, then turn right, and left.
2. For team
- Through this project, we can realize the importance of teamwork. Teamwork brings us
numerous benefits like diverse perspectives, enhanced creativity, and innovation, improved
problem-solving, etc.
- However, there is an unequal distribution of workload among the team members. Sometimes,
this leads to conflicts between group partners so we need to discuss to find solutions.

PART VI : VALUABLE LESSONS


- Teamwork is one of the important values for success at work. Working in groups offers several
advantages:
1. Division of Labor: By working in groups, tasks can be divided among members based on
their strengths and skills, leading to increased efficiency and productivity.
2.
2. Support and Collaboration: Group members can provide support to each other, share
resources, and collaborate on tasks, leading to better outcomes than if individuals were
working alone.

3. Learning Opportunities: Working in groups allows individuals to learn from each other,
acquire new skills, and gain insights into different approaches and techniques.

4. Increased Motivation: Group dynamics can foster motivation and accountability. The shared
goals and mutual support within a group can help individuals stay focused and motivated to
achieve their objectives.

5. Better Decision Making: Group discussions allow for the exploration of multiple perspectives
and the evaluation of various options, leading to more informed and well-rounded decisions.

6. Networking: Group work provides opportunities for networking and building relationships
with others, which can be valuable for personal and professional development.
- Diligence and meticulousness are essential in technical works. Diligence is essential for
achieving goals, producing high-quality work, building trust and reputation, fostering
personal growth, adapting to change, overcoming challenges, and setting a positive example
for others. It's a valuable trait that contributes to both individual success and the success of
teams and organizations. And, being meticulous is essential for maintaining accuracy,
ensuring quality, demonstrating professionalism, building trust, enhancing efficiency,
developing problem-solving skills, and meeting customer needs. It's a valuable trait that
contributes to individual success and organizational excellence.

You might also like