REPORT

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

DESIGN MOBILE ROBOT MEASURED IN THE MAZE

TABLE OF CONTENTS
ABOUT TEAM MEMBERS
PART 1: OVERVIEW MOBILE ROBOT
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\
2.4. Image of robot
PART III: TEST AND EVALUATE. ANALYZE THE RESULTS.
PART IV: CONCLUDE
TEAM MEMBERS
Võ Tuấn Kiệt: coder 1
Bùi Thành Công: coder 2
Lê Quốc Duy: Develop, comment, build robots
Trần Văn Thanh Nhật: Design and assemble robots
Trần Vũ Hồng Phúc: write report, summaries and evaluate problems

*every members in this team also contribute to make a robot better

PART I: OVERVIEW MOBILE ROBOT


1.1 Overview of the robot
Mobile robot (abbreviated mobot) defined as a robotic vehicle

capability of self-moving, self-movement (programmable) under automatic control is able to


complete assigned work. In principle, the self-propelled robot's working environment may
be the ground, water, air, space, or a mix of these. The ground on which the robot can move

1
is either flat or changing, as well as convex and concave. This project has been thoroughly
investigated as a self-propelled robot in a maze.

Mobile robots are an important component in the industry of Robotics. Along with the
strong development of automation systems, self-propelled robots are more and more
perfected and show its benefits in industry and daily life. A very interesting issue when
researching self-propelled robots is how do robots know?

knows the position it is standing in and can move to a specified position, and can
automatically. Avoid the obstacles on the way. Therefore, the successful fabrication of the
topic

This will open up a new approach and contribute to promoting the application of robots
today more and more in daily life and in manufacturing research.

PART II: DESIGN SYSTEM


2.1. Hardware design

MATERIAL AMOUNT

2
Wheel 2

Robot’s frame 2

DC motor gear V3 2

Ultrasonic sensors HC-SR04 3

Board arduino uno R3 1

Module L298N 1

Battery box 1

Battery 2

2.1.1. DC MOTOR GEAR V3

* About DC motor gear V3


Image:

3
DC gear motor V3: Which is the type chosen and used most today for simple robot
designs. The good quality V3 geared DC motor and its ease of assembly provide cost
savings and user convenience.
Specification:
Operating Voltage: 3-6 VDC
Power Consumption: 60mA
Transmission ratio: 1:120
Number of revolutions per minute: 100 revolutions/1 minute in 6V.
Moment: 4500mg.cm
Yellow, Blue, Orange

2.1.2. Module L298N

* About module L298N


Image:

Module L298N

4
*Specifications

- Driver: L298N integrated 2 H bridge circuits


- Control Voltage: +5 V ~ +12 V
- Voltage of control signal: +5 V ~ +7 V
- Current of control signal: 0 ~ 36mA
- Wasted capacity: 20W (khi nhiệt độ T = 75 ℃)
- Storage temperatures: -25 ℃ ~ +130 ℃
*Structure
Signal Pins
1.DC motor 1 “+” or stepper motor A+
2.DC motor 1 “-” or stepper motor A-
3. 12V jumper - remove the jumper if using more than 12V power. This jumper is used to
power the voltage stabilizer IC to generate a 5V source if the source is above 12V, it will
burn the source IC.
4. Plug in the power cord to supply voltage to the motor from 6V to 35V
5. Plug in the GND wire of the source
6. 5V power output, if the input jumper is not drawn.
7. The Enable pin of Motor 1, this pin is used to provide PWM pulses for the motor. If using
a VK, then unplug the jumper and plug in the PWM pin. Keep it when used with stepper
motors.
8. IN1
9. IN2
10. IN3
11. IN4
12. The Enable pin of Motor 2, this pin is used to provide PWM pulses for the motor. If
using a VK, then unplug the jumper and plug in the PWM pin. Keep it when used with
stepper motors..
13.DC motor 2 “+” or stepper motor B+

5
14. DC motor 2 “-” or stepper motor B

Module L298N is a motor control module, the motor here is a geared motor. To be
flexible in keeping the vehicle stable, the engine must continuously reverse rotation thanks
to the H-bridge circuit integrated in the engine control module L298N.

On the other hand, to control the direction of rotation, we only need to reverse the
direction of the DC current through the motor, and the most common method is to use an H-
bridge. An H-Bridge circuit contains four switching components, the bulb. transistors or
MOSFETs, with the motor at the center forming an H-like configuration. By activating two
specific switches at the same time, we can change the direction of the current flow, thus
changing the current. direction of rotation of the motor.
2.1.3. Arduino UNO R3

* About Arduino UNO R3: Arduino is a hardware open circuit design platform (Open-
source hardware) and software (Open-source software). Arduino hardware are single-board
microcontrollers (Single-board microcontrollers) created in the town of Ivrea in Italy, in
order to build applications that interact with each other or with a more conducive
environment.

Introduced in 2005, the designers of Arduino strive to provide an easy, inexpensive way for
hobbyists, students, and professionals to create devices that can interact with the
environment through sensors and actuators. Popular examples for beginner hobbyists
include simple robots, temperature control, and motion detection. Accompanying it is an
integrated development environment (IDE) that runs on common personal computers and
allows users to write programs for the circuit using the Arduino language, a native language
developed based on C. /C++.

It is because of its convenience and simplicity for users that Arduino has become a
phenomenon in the world electronics village. The products of the Arduino user community
as well as the devices that support the Arduino are so large that they cannot be counted. It's
grown to the point where we can call it an ecosystem as diverse as the title - like Windows
or Android.

What can Arduino connect to?

6
With Arduino you can apply to simple circuits such as light sensor circuits turning lights on
and off, motor control circuits, ... or even higher, you can make products such as 3D
printers, Robots, etc. hot air balloons, drones, etc

An Arduino system can provide users with a lot of interaction with their surroundings with:

- The sensor system is diverse in types (measuring temperature, humidity, acceleration,


velocity, light intensity, object color, water flow, motion detection, metal detection, gas
detection, etc.)

- Display devices (LCD screens, LED lights, ...).

- Functional modules (shield) support wired connection with other devices or common
wireless connections (3G, GPRS, Wifi, Bluetooth, 315/433Mhz, 2.4Ghz,...), ...

- GPS positioning, SMS messaging, ...

Referring to the Arduino line of circuits used for programming, the first thing that people
often talk about is the Arduino UNO series. Currently, this circuit has been developed to the
3rd generation (R3).

7
Board Arduino uno R3

KEY INGREDIENTS ON BOARD ARDUINO

1: USB (USB Jack)

When connected to the computer board, it will be powered, and this is also the place to
transmit programming data from the computer to the circuit board.

2: Power Jack (POWER JACK)

Can be supplied from 5-20V but the manufacturer recommends 7-12V is reasonable, more
than 12V components in the circuit may overheat, below 7V may not be enough for the
circuit to work properly.

3: Power IC

Its main function is to provide a stable voltage for the control chip and operating peripherals

4: Vibrating Quartz

Each quartz oscillation corresponds to one chip clock. Usually on board UNO R3 will use
16Mhz quartz (meaning in 1s it will execute 16 million instructions. Note that 1 C
instruction will take many machine instructions)

5: Arduino Reset

8
When you want to get your circuit running again, you need this reset. You have 2 ways to
reset your arduino board, the first is to use the reset button (17) on the board, the second is
to use an external push button to connect to the reset position (5) on the circuit.

6: Source area

• Vin Pins: Supply external power to the Arduino, connect the positive pole of the source to
this pin, the negative pole of the source to the GND pin of the arduino

• 5V & 3.3V: 5V (or 3.3V) output voltage. The maximum allowed current at these pins is
500mA(for 5V) and 50mA(for 3.3V pin)

• GND: Ground pin

Note:

The Arduino Uno R3 has no input reverse protection. Therefore, you must be very careful,
check the negative - positive poles of the source before supplying the Arduino Uno R3.

• The 3.3V and 5V pins on the Arduino are the pins used to supply power to other devices,
not the input power pins. Power supply in the wrong place can damage the board. This is
not recommended by the manufacturer.

• Powering the Arduino Uno R3 externally without a USB port with a voltage below 6V
may damage the board.

• Supplying a voltage above 13V to the RESET pin on the board can damage the
ATmega328 microcontroller.

• The input/output current at all Digital and Analog pins of the Arduino Uno R3 if exceeded
200mA will damage the microcontroller.

• Supplying voltages above 5.5V to the Digital or Analog pins of the Arduino UNO will
damage the microcontroller.

• Amperage through any Digital or Analog pin of Arduino UNO exceeding 40mA will
damage the microcontroller. So if you're not using it to transmit or receive data, you'll need
a current limiting resistor.

7: Digital Pins

• There are 14 pins from pin 0 to pin 13 used to get signal or output digital signal (Digital
Input, Digital Output)

9
• Only pin 13 is connected to the LED solder on the board

• The pins marked ~(3,5,6,9,10,11) are pins that can output PWM pulses with a resolution
of 8 bits (values from 0-28-1 respectively 0 to 5V ) and have The value can be adjusted in
the range from 0 to 5V, used to change the motor speed or light brightness, ...

Note:

Each pin can withstand up to 40mA but should be used at 20mA . threshold

8: Analog Pins

The Arduino has 6 Analog pins from A0 to A5, these pins are commonly used as analog
inputs but can also be used as digital inputs or outputs. ) of the Digital pin9: AREF
comparator voltage
The AREF pin is used as a reference voltage for an analog signal. The voltage applied here
ranges from 0-5v and is the upper limit for analog input signals.

Some pins have special functions

Serial Pins

• These pins are used to communicate between the Arduino board and the computer or other
modules and devices.

• Includes 2 pins 0(RX) and 1(TX): used to send (TX - transmit ) and receive (RX -
Receive) TTL Serial data

• The most basic application that we often use is any Serial monitor through the Serial port
to view or check the value. This is a way to debug programs for arduino

SPI Pins

• The pins SS/SCK/MISO/MOSI are pins used for SPI (Serial Peripheral Interface)
communication.

• On the Arduino Uno board, the pins used for SPI communication are chan 10-13 and they
are also on the ICSP pins.

I2C Pins

SCL/SDA are pins used for I2C communication (pin A4 and pin A5)

10
Interrupt Pins

INT0 and INT1 are 2 pins used for interrupts, then the program will jump into the interrupt
function, finish executing the statements in the interrupt function, and then return to running
the main program.

Memory

The standard Atmega328 microcontroller provides users with:

- 32KB of Flash memory: the programming instructions will be stored in the Flash memory
of the microcontroller.

- 2KB for SRAM (Static Random Access Memory): the values of variables declared when
programming will be stored here. The more variables you declare, the more RAM you need.
In the event of a power failure, the data on the SRAM will be lost.

- 1KB for EEPROM (Electrically Erasable Programmable Read Only Memory): this is like
a mini hard drive - where you can read and write your data here without having to worry
about losing it when the power goes out like data on SRAM.

●Specifications Arduino UNO R3

Microcontrollers ATmega328 8 bit


Operating voltage 5V DC
Operating frequency 16 MHz
Consumption line About 30mA
Recommended input voltage 7-12V DC
Input voltage limit 6-20V DC
Number of Digital I/O pins 14 (6 pins hardware PWM)
Analog pins 6 (resolution 10 bit)
Maximum current per I/O chân
30 mA
pin
Maximum Output Current (5V) 500 mA
Maximum output current
50 mA
(3.3V)
Flash memory 32 KB (ATmega328)
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)
Arduino-based devices are programmed in their own language. This language is based
on the Wiring language written for general hardware. And Wiring is again a variant of C/C+

11
+. It's called the "Arduino language," and so does the Arduino development team. The
Arduino language originates from the popular C/C++ today, so it's easy to learn and
understand.
To program as well as send commands and receive signals from the Arduino circuit, the
development team of this project has also provided users with an Arduino programming
environment called the Arduino IDE.
• Programming for Arduino

Download Arduino 1.8.19 software to your computer to program the arduino circuit

2.1.4. Ultrasonic sensor HC-SR04


*About HC-SR04:

Ultrasonic sensor HC-SR04

HC-SR04 is an ultrasonic sensor mainly used to determine the distance of the target object.
It measures distance accurately using contactless technology, i.e. there is no physical
contact between the sensor and the object.
The transmitter and receiver are the two main parts of the sensor, the transmitter converts
the electrical signal into ultrasonic waves, and the receiver converts that ultrasonic signal
back into an electrical signal.
These ultrasonic waves are audio signals that can be measured and displayed at the
receiving end.
It provides precise measurement details and comes with a resolution of about 3mm, there
may be slight differences in the calculated distance from the object and the actual distance.
*Specifications:
- Voltage: 5V DC
12
- Operating current: <2mA
- High level: 5V
- Low level: 0V
- Maximum angle: Not more than 15 degrees
- Distance: 2cm-450cm(4.5m)
- Accuracy: 3mm
- Output signal: High pulse level 5V, low level 0V
- Connection mode: VCC/Trig(T-Trigger)/Echo(R-Receive)/GND

* Structure of ultrasonic sensor HC-SR04


a/ Ultrasonic generator
The structure of the ultrasonic transmitters and receivers is special ceramic speakers, which
emit high-intensity ultrasound at a frequency usually 40kHz for distance measurement

needs.
In principle, these speakers need a high voltage source to play well (manufacturer
announced = 30V). On the power circuit, IC MAX232 is used as a buffer. This IC will take
the signal from the controller, amplify the amplitude to +/-30V to power the upper speaker.
This IC will be switched through a transistor to limit current consumption.
b/ Reflective ultrasonic receiver unit
The receiver is a ceramic loudspeaker that is only sensitive to one frequency, such as
40KHz. Through a series of components such as OPAM TL072, NPN transistor… This
signal is continuously amplified in amplitude and finally passed through a comparator,
combined with the signal from the controller to return to the controller.
c/ Signal processing and control unit
Microcontrollers (PIC16F688, STC11, ...) are used as pulse generators, processing and
calculating the time from transmitting to receiving ultrasonic waves if TRIG signal is
received.
*Operating principle of sensor HC-SR04
To measure the distance with the ultrasonic sensor HC-SR04, we will emit a very short

13
pulse (5 microSeconds) from the Trig pin. Next, a HIGH pulse at the Echo pin will be
generated and transmitted by the sensor until it receives a reflected wave at this pin. At this
point, the pulse width will be equal to the time the ultrasonic wave is emitted from the
sensor and reflected back.
In air, the speed of sound reaches 340 m/s (constant), equivalent to 29,412
microSeconds/cm (106 / (340*100)).
Once we have calculated the time, we will divide by 29,412 to get the distance value.

Example of measuring liquid level in a tank with ultrasonic sensor HC-SR04:

We will have the following steps:

• Set the TRIG pin to High (5V) for 10 μs (microseconds)

• Then the ultrasonic module records the time and sends out 40Khz . frequency sound waves

• Ultrasonic waves propagate down to the liquid surface in the tank and reflect back

• The reflected wave travels back to the transducer

• The ultrasonic module receives the reflected wave and timestamps it received

Finally, the ultrasonic module puts the ECHO pin high in the time (microseconds) to
respond to the sound wave (Send – receive) and calculate the distance.

14
Result on ECHO pin: 58 μs/cm

So, if the ECHO pin goes high for 5800 μs (5.8 ms), then we calculate the distance between
the sensor and the liquid level in the tank as:5800μs / 58μs/cm = 100cm = 1m

* Diagram of connecting sensor HC-SR04 with Arduino uno R3 board.

2.2. Software design:

#define trigPin_l 2 // chân trig của sensor bên trái


#define echoPin_l 3 // chân echo của sensor bên trái

#define trigPin_c 4 // chân trig của sensor giữa


#define echoPin_c 5 // chân echo của sensor giữa

#define trigPin_r 6 // chân trig của sensor bên phải


#define echoPin_r 7 // chân echo của sensor bên phải

// L298N
#define ENA 9
#define IN1 11
#define IN2 8
#define IN3 13
#define IN4 12
#define ENB 10

15
long duration_l, duration_c, duration_r;
int distance_l, distance_c, distance_r;

void setup() {
Serial.begin(9600);
pinMode(trigPin_l, OUTPUT);
pinMode(trigPin_c, OUTPUT);
pinMode(trigPin_r, OUTPUT);

pinMode(echoPin_l, INPUT);
pinMode(echoPin_c, INPUT);
pinMode(echoPin_r, INPUT);

pinMode(ENA, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
pinMode(ENB, OUTPUT);
}

void sensorSet(long duration, int *distance, int trigPin, int echoPin) {


digitalWrite(trigPin, LOW);
delayMicroseconds(1);
digitalWrite(trigPin, HIGH);
delayMicroseconds(2);
digitalWrite(trigPin, LOW);
duration= pulseIn(echoPin, HIGH);
*distance= duration * 0.034 / 2;
}

void loop() {

sensorSet(duration_l, &distance_l, trigPin_l, echoPin_l);


sensorSet(duration_c, &distance_c, trigPin_c, echoPin_c);
sensorSet(duration_r, &distance_r, trigPin_r, echoPin_r);

// in các giá trị của sensor ra monitor


Serial.print(" || Distance_l: ");
Serial.print(distance_l);
Serial.print(" || Distance_c: ");
Serial.print(distance_c);

16
Serial.print(" || Distance_r: ");
Serial.println(distance_r);

//logic
if (distance_c > 10) {
(distance_l < 5) ? turnRight(8) : (distance_r < 5) ? turnLeft(8) :
mvForward(85);
stop(40);
} else if (distance_l > 20 && distance_r < 20) {
turnLeft(155);
stop(200);
} else if (distance_l < 20 && distance_r > 20) {
turnRight(170);
stop(200);
} else if (distance_l < 20 && distance_r < 20) {
turnRight(180);
stop(500);
}
}

// điều khiển L298N


void Motor(bool a1, bool a2, bool a3, bool a4, int a5, int a6) {
analogWrite(ENA, a5);
digitalWrite(IN1, a1);
digitalWrite(IN2, a2);
digitalWrite(IN3, a3);
digitalWrite(IN4, a4);
analogWrite(ENB, a6);
}

// qua trái
void turnLeft(int time) {
Motor(0, 1, 1, 0, 255, 255);
delay(time);
}

// qua phải
void turnRight(int time) {
Motor(1, 0, 0, 1, 255, 255);
delay(time);
}

17
// đi thẳng
void mvForward(int time) {
Motor(1, 0, 1, 0, 160, 150);
delay(time);
}

// dừng
void stop(int time) {
Motor(0, 0, 0, 0, 0, 0);
delay(time);
}
2.3. Assembly and design:
1. Connect the wheel (motor) to the L298N module.
- Connect the wire of the first wheel to OUT1, OUT2 and the wire of the 2nd wheel to
OUT3, OUT4 of L298N. IN1, IN2 are 2 poles that will control the direction of wheel 1.
IN3, IN4 are 2 poles that will control the direction of wheel 2. ENA is used to adjust the
speed of the first wheel. ENB is used to adjust the speed of the 2nd wheel.
2. Connect the L298N module to the arduino board
Connect the 12V wire to one side of the switch. Next, connect the red wire of the battery
and add 1 red wire to the switch. The 5V wire connects to the positive terminal of the
breadboard to supply power to the sensors and the board. The black wire of the power
supply combines with 1 black wire of the GND of the arduino board circuit.
3. Connect 3 ultrasonic sensors HC-SR04 to the Arduino uno R3 board.
We will plug the GND pin of the 3 sensors together to the negative terminal on the
breadboard. Then from the breadboard negative terminal add a common wire to connect to
the GND pin of the Arduino Uno. The VCC pins of the three sensors are attached to the
anode on the bread board. Then from the breadboard anode add a common wire to connect
to the 5V pin of the arduino Uno. As for trig and echo, plug in the declaration.

Image of our teamwork:

18
2.4. Product:

Video:

PART III: TEST AND EVALUATE. ANALYZE THE RESULTS.

19
TEST, ANALYZE AND THE CONTRIBUTION OF TEAMMATES

The robot runs well but still can't run to cover the whole maze. Need to improve in some
places so that the robot can run on many different mazes, without being too difficult to
move. Guaranteed to be able to handle any difficult situation.

We need to work together in groups more effectively, team members actively learn, and
come up with actionable ideas. Contribute a piece of knowledge to the whole team to
achieve success later.

One last note should be made about cost. If the investment is assessed for the short term, it
is considered very expensive. However, if the project is successful, it will most likely pay
off in the long run. Overall, mobile robots have a lot to offer the industry, albeit with some
limitations.

PART IV: CONCLUDE


ADVANTAGES
- Automated robots have been put on the assembly line. Automated robots make human
life easier and more convenient. Following are the benefits of automated robots:
1.Increased flexibility
Self-propelled robots can work in different conditions. Helping people do heavy
work and making life more convenient for people. We can create mini robots to explore
difficult terrain where humans cannot interfere.
2. Easy to integrate
The integration of autonomous mobility robots into any facility is surprisingly
simple. The only thing you actually need to give the autonomous robot is a map of the
facility. This is how the robot can navigate the facility and fulfill the tasks you've given
it.
You don't need to set up specific paths, place anything on the floor, or prohibit
humans and forklifts from operating in regions where robots are being used because of
this ability to seamlessly integrate the robots.
Once the robots have a map of your warehouse, which can take a single human a day
or two to create, they can utilize their sensors and onboard cameras to complete the task.

20
3. Autonomous robots perform well in environments with a large workload.
Autonomous robots work to improve the efficiency of your business by lowering
journey time. The less time an employee spends traveling, the more time they spend
picking and filling orders in their zone of the warehouse. The good news is that
autonomous robots perform admirably when faced with a large amount of labor. As a
result, the robots are able to significantly reduce staff travel time.

DRAWBACKS
1. The cost of a mobile robot
The cost of making a self-propelled robot is also quite expensive. To make a
complete robot we need quite expensive materials such as circuit boards, chips,
spare devices, etc. The manufacturing of a robot also depends on the working
conditions of the robot and different working environments. We also have to
experiment and evaluate to come up with some reasonable calculations.
Therefore, we need to consider a number of problems, come up with safe
solutions. Make sure it doesn't cost too much
2. Potential Job Losses
One of the most significant worries about the adoption of robotic automation
is the impact on workers' jobs. The danger is that if a robot can execute at a
faster, more consistent rate, humans will be obsolete. These concerns are
understandable, but they are not entirely correct.

During the early years of the industrial revolution, the same was asserted, and
as history has shown, humans continued to play an important role. This is
exemplified by Amazon. During a period in which they went from using roughly
1,000 robots to over 45,000, the employment rate has risen substantially.

REFERENCES

[1] Trịnh Quang Tùng, Trần Văn Đến, Trịnh Thúy Tình, Đặng Văn Trung “ Thiết kế và chế tạo robot vẽ
tranh’’ , Đại học Mỏ- Địa Chất Hà Nội, 2017

21
[2] Nguyễn Thị Phương Chi Khoa Điện - Đại học Kỹ thuật Công nghiệp “ Thiết kế xe điều khiển từ xa qua
bluetooth design mini car controlled via bluetooth’’

[3] Thạc sĩ Trần Thái Anh Âu khoa Điện – Đại học Bách Khoa Đà Nẵng “ Thiết kế robot mini tự hành dò
đường, năm 2010”

[4] http://arduino.vn/result/5473-robot-hai-banh-tu-can-bang-2-wheel-self-balancing- robot

[5] http://codientu.org/

[6] http://arduino.vn/bai-viet/893

[7] https://vi.wikipedia.org/wiki/Segway_PT

[8] http://doc.edu.vn/tai-lieu/do-an-xe-hai-banh-tu-can-bang-di-chuyen-tren-dia-hinh- phang-799/

[9] https://howtomechatronics.com/tutorials/arduino/arduino-dc-motor-control-tutorial-l298n-pwm-h-
bridge/

[10] https://mcuoneclipse.com

[11] https://create.arduino.cc/projecthub/twob/self-balancing-robot-using-blubug-8894c6

[12] http://www.instructables.com/id/2-Wheel-Self-Balancing-Robot-by-using-Arduino-a

22

You might also like