0% found this document useful (0 votes)
30 views92 pages

PBL5

The document presents a project on a PCB Soldering Robot developed by students at the University of Danang, focusing on enhancing efficiency and reducing costs in PCB soldering processes. It discusses the advantages and disadvantages of using robots for soldering, including precision, speed, and safety improvements, while also addressing the challenges of investment and maintenance. The project aims to create a cost-effective solution for individuals and small organizations, integrating both manual and automatic soldering functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views92 pages

PBL5

The document presents a project on a PCB Soldering Robot developed by students at the University of Danang, focusing on enhancing efficiency and reducing costs in PCB soldering processes. It discusses the advantages and disadvantages of using robots for soldering, including precision, speed, and safety improvements, while also addressing the challenges of investment and maintenance. The project aims to create a cost-effective solution for individuals and small organizations, integrating both manual and automatic soldering functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 92

THE UNIVERSITY OF DANANG

UNIVERSITY OF SCIENCE AND TECHNOLOGY


FACULITY OF MECHANICAL ENGINEERING

PBL5: PCB SOLDERING ROBOT

Advisor: PhD. DOAN LE ANH


Students CAO HUU TRUONG TIEN (101210370)
:
PHAM HOANG ANH (101200348)
Class: 20.06
PREFACE
This project, titled PCB Soldering Robot, is the culmination of months of
research, analysis, and dedication. The work presented here explores the
operational system of industrial PCB soldering robots and our enhancement in
efficiency and the cost of our own PCB soldering robot. Through comprehensive
investigation and critical evaluation, this study aims to create a solution for high-
cost machines used in the industrial fields as well as keeping a better performance
for the PCB soldering robot.
The research process was both challenging and rewarding, as it allowed us to
deepen our understanding of mechanical and electronic operating systems. The
insights gained from this project have contributed significantly to our academic and
professional development. We are hopeful that the findings and discussions
presented will serve as a valuable resource for future studies in this domain.
We would like to express my deepest gratitude to PhD. DO THE CAN,
whose invaluable guidance, thoughtful feedback, and unwavering support were
instrumental in shaping this project. His expertise and encouragement have been
essential in the completion of this work. We are truly fortunate to have benefited
from his mentorship throughout this journey.
TABLE OF CONTENT
TABLE OF CONTENTS
Preface.....................................................................................................................................................................
CHAPTER 1: INTRODUCTION..........................................................................................................................
1.1/ Problem given:...............................................................................................................................................
1.2/ Problem solving:............................................................................................................................................
a/ advantages:........................................................................................................................................................
b/ disadvantages:...................................................................................................................................................
1.3/ PCb soldering robot:......................................................................................................................................
a/ integrated function:...........................................................................................................................................
b/ comparison with other products on the market:................................................................................................
c/ application and range of usage:.......................................................................................................................
CHAPTER II: DATA ANALYSIS........................................................................................................................
2.1/ Products available on the market..................................................................................................................
a/ 300W High Volume Desktop Soldering Robot For LED PCB Welding..........................................................
b/ Janome JR3204, flagship desktop PCB robot..................................................................................................
CHAPTER III: Circuit DIAGRAM....................................................................................................................
3.1/ circuit diagram:............................................................................................................................................
a/ x axis circuit diagram:.....................................................................................................................................
b/y axis circuit diagram:......................................................................................................................................
c/ z axis circuit diagram:.....................................................................................................................................
d/ circuit diagram of other components:..............................................................................................................
3.2/ Codes:..........................................................................................................................................................
Chapter 4: electronic components........................................................................................................................
4.1/ Microcontroller STM32F103C8T6:.............................................................................................................
a/ basic feature of stm32f103c8t6 blue pill:........................................................................................................
b/ why should we use stm32f103c8t6 blue pill for our product?:........................................................................
a/ basic feature of the hc-r04:..............................................................................................................................
b/ technical specifications:..................................................................................................................................
4.3/ Driver A4988:..............................................................................................................................................
a/ basic feature of a4988:....................................................................................................................................
1. step motor controlling.....................................................................................................................................
2. voltage and current..........................................................................................................................................
3. INTEGRATED PROTECTION......................................................................................................................
b/ direction and step control................................................................................................................................
1. sleep mode......................................................................................................................................................
2. pulse width modulation...................................................................................................................................
3. current limiter..................................................................................................................................................
4. pinouts and signals..........................................................................................................................................
c/ why should we use the a4988 for controlling robot:........................................................................................
4.4/ uSB TO TLL MODULE:.............................................................................................................................
a/ basic feature of the usb to tll module:..............................................................................................................
b/ core components and technical specifications:................................................................................................
c/ applications:....................................................................................................................................................
a/ basic feature of the 24v/12v TO 5v 5A module:..............................................................................................
b/ technical specifications:..................................................................................................................................
c/ applications:....................................................................................................................................................
4.6/ lIMIT SWITCH:..........................................................................................................................................
a/ basic feature of the limit switch:.....................................................................................................................
b/ technical specifications:..................................................................................................................................
Chapter 5: pcb wiring, 3d design and technical drawings.................................................................................
5.1/ What is a pcb?:.............................................................................................................................................
5.2/ 3d design:.....................................................................................................................................................
5.3/ technical drawings:......................................................................................................................................
Chapter 6: MECANICAL STRUCTURE OF THE MACHINE.......................................................................
6.1/ Frame structure:...........................................................................................................................................
a/ the tin extruder:...............................................................................................................................................
b/ the soldering grease extruder...........................................................................................................................
Chapter 7: The modules in our mechatronics system.........................................................................................
7.1/ What is a mechatronics system:...................................................................................................................
a/ sensor:.............................................................................................................................................................
a/ the tin extruder:...............................................................................................................................................

CHAPTER 1: INTRODUCTION
1.1/ PROBLEM GIVEN:
Nowadays, we are not too unfamiliar with electronic circuit boards in
electrical devices, they appear everywhere where people live. The creation of those
circuit boards must go through many stages and one of the most important stages is
soldering the points at the component's feet. “Soldering on the PCB board" is a job
that requires optimal precision from the welder. PCB soldering is the use of solder,
lead, or other solder alloys to help electronic components adhere tightly to the
wires in the PCB board so that electricity can pass from the wires through the
electronic components.
There are two methods of soldering PCB circuits: soldering with a soldering pen
and soldering with a hot air gun.
Soldering with a soldering pen is the use of a high-temperature pen tip to
melt the solder alloys, so that these alloys melt at the point that needs to be
soldered and stick there.
Soldering with a hot air gun is the use of hot air emitted from the torch tip to
melt the pre-determined solder alloys at the soldering points, causing the alloys to
stick together at the required soldering points and not spread out.
However, PCB soldering requires high precision, for electronics makers or
newbies, hand soldering has always been considered a trait skill to have. However,
even with specialist or automatic machine soldering, problems may have arisen.
Therefore, if humans oversee it, it will require a lot of concentration, and even a
little negligence will cause damage to PCB. Not to mention that using humans to
solder PCBs will result in uneven performance and sometimes situations such as:
 Low accuracy.
 Low soldering speed
 Uneven soldering quality
 Difficulties in soldering complex components.
 Cost of repair, labor, …
Soldering bridging is one of the most common soldering issues that can
occur on your PCB when soldering in hand or automatic soldering by machine. It
will lead to a short circuit and cause a component to burn up. The moisture on the
printed board or the components is also a problem. When soldering, the water
vapor will exhaust from the holes of the board, which may extrude the solder and
produce solder balls on the front side of the printed circuit board. PCB soldering
when exposed to flying solder joints will also cause significant health effects with
longterm exposure.

1.2/ PROBLEM SOLVING:


Using human power for jobs that require constant precision will cause
unpredictable consequences; to solve those problems we will replace them with robots.
PCB soldering robots will help the circuit boards to be welded with higher precision
and bring more advantages than using manual labor.

A/ ADVANTAGES:
The advantages that “PCB Soldering Robot” will bring are:
 PCB soldering robots could position and operate precisely, welding small
components with high precision down to the millimeter, ensuring that the welds
are performed in the correct position and with consistent quality.
 Soldering robots can solder continuously at a much faster speed than humans,
increasing production capacity without needing to rest. This reduces production
time and increases the volume of finished products at the same time.
 Soldering robots can precisely control the temperature, time, and amount of tin used
for each solder joint, ensuring consistent quality for all solder joints.
 Soldering robots eliminate human error, operate according to a preset program
with high precision, ensuring the welding process takes place according to
technical standards. This helps to minimize errors arising during the production
process.
 Soldering robots help minimize human exposure to these dangerous elements,
improving labor safety in the factory. Operators only need to monitor and program
the robot without directly participating in the welding process.

B/ DISADVANTAGES:
Along with the advantages there will also be certain disadvantages such as:
 The upfront investment in soldering robots, including equipment, installation,
and programming, can be high, making it less accessible for small-scale
manufacturers.
 While robots are dependable, they require regular maintenance to function
effectively. Downtime due to technical issues or malfunctions can impact
production schedules.
 Setting up the robot and programming it to oversee specific soldering tasks requires
technical expertise. Changes in product designs may require reconfiguration,
increasing the complexity of operations.
 Robots may struggle to adapt to different soldering tasks or PCB designs without
reprogramming or retooling, which can be time-consuming and expensive.

1.3/ PCB SOLDERING ROBOT:


PCB soldering robots are structured in many different structures. With the structure
of most 3D printers with the XYZ core structure, we have researched and launched
the PCB soldering robot product. From the XYZ core structure, we have
researched a welding robot product that integrates both "pen soldering" and "heat
soldering" functions in the same product.
A/ INTEGRATED FUNCTION:
Our PCB soldering robot will integrate two modes: “manual” and “automatic.”
“Manual mode” is the mode in which the user will automatically adjust the
soldering tip to the point to be soldered and perform soldering at that point.
“Automatic mode” is the mode in which the user will automatically load the
program so that the welding robot can automatically move to the welding point and
perform the welding function.
Each mode will control two different actuators. The actuator here will be the
“welding pen” or “torch head.”
The functions in the machine will be:
 Move the welding head along three axes XYZ.
 Soldering pen’s head automatically cleaning.
 Soldering at a single point 
Change the executive structure.
 Read memory cards. 
Computer control  PCB
image processing 
Automatic balancing.
B/ COMPARISON WITH OTHER PRODUCTS ON THE MARKET:
PCB soldering robot is a product that the market has researched and
developed for a long time with quite high precision. We can see that the products
on the market have been divided into many different segments such as automatic
soldering robots, automatic handheld soldering iron extrusion machines, hot air
soldering machines, etc. And popular types of soldering robots from brands such
as:
 Kurtz Ersa (Germany): A long-established manufacturer offering advanced
soldering robots such as the SR500, known for its durability and adaptability in
electronics production.
 Cosmic Corporation (Japan): Produces automated point soldering systems like
the PSU500 and XY Series, focused on improving soldering quality and
handling intricate electronic components.
Fig 1.3.1. PCB soldering robot (HAKKO) (1)

Fig 1.3.2. The soldering pen and lead extrusion mechanism (HAKKO) (1)
Fig 1.3.3. Handheld soldering machine with automatic temperature control (X-tronic 7040) (2)

Despite being a market product with quite stable accuracy and operation, this
handheld soldering machine comes at an expensive price. Therefore, we have
researched a PCB soldering robot with an affordable price but has all the features
of robots on the market.
The criteria we want to aim for are:
 Lower price than those in the market
 Features must be fully integrated as the market.
 The performance of each soldering may not be equal to the market but still maximizes.
 Stability ensures good operation (may not be as good as the market but we will
find the most feasible solutions for the problems that arise, so that customers
can automatically adjust so that the machine still works well).

The price of a PCB soldering robot in the international market (2)


C/ APPLICATION AND RANGE OF USAGE:
With the cost of making the product and the stability of the machine,
creating a machine that works well and continuously for a business is feasible for
us. But we still develop products with "enough" quality for individuals or small
organizations that want to apply it to soldering a certain circuit that is not too
complicated.
Because of this reason, our target customers are:
 Students who are working on projects or assignments
 Organizations who want to do research on problems with circuit soldering 
Individuals or organizations who want to save time designing PCB circuits.
CHAPTER II: DATA ANALYSIS

2.1/ PRODUCTS AVAILABLE ON THE MARKET


A/ 300W HIGH VOLUME DESKTOP SOLDERING ROBOT FOR LED PCB
WELDING

Fig 2.1. Winsmart double head SMT PCB soldering robot (3) Product
details:
 Origin: China
 Brand: Winsmart
 Certification: CE
 Model Number: SMTSR224
1. Overview: This Winsmart PCB soldering robot, also known as an automatic
soldering machine, is suitable for SMT soldering process in the later stage of
soldering temperature-sensitive electronic components and soldering process for
heat-sensitive components that cannot be re-soldered. The soldering robot has a
variety of soldering modes, soldering processes, effectively improving the quality of
the soldering process.

2. Features:
 Flexible and diverse soldering methods, with spot welding, drag welding (pull
welding) and other functions, and built-in screwing, dispensing, and handling
procedures.
 The equipment can store ninety-nine operating procedures.
 The same machine can process ninety-nine distinct products by soldering tins. The
mechanical arm of the equipment is made of aluminum profiles by open-die
casting. It is not deformed, rust-free and runs steadily.
 Programming can copy point-to-point and block-to-block to shorten the programming time.
 The equipment has the function of automatic cleaning, which stabilizes the quality
of soldering tin processing and prolongs the service life of soldering iron tips to a
certain extent.
 Multi-axis linkage manipulators are all driven by precision stepper motor and
advanced motion control algorithm, which can effectively improve the accuracy of
motion positioning and repetition.

3. Specifications:
Fig 2.2. Specifications of Winsmart double head SMT PCB soldering robot (3)

B/ JANOME JR3204, FLAGSHIP DESKTOP PCB ROBOT


Fig 2.3. JANOME JR3204 Flagship desktop PCB robot (4)

Product details:
 Origin: Flumasys
 Brand: JANOME JR3204
 High quality soldering controller from Tsutsumi
 Power: 150W – 200W
1. Overview: The automatic PCB circuit board component soldering system integrated
with robots has the following outstanding advantages:
 Automate traditional heat soldering methods for higher productivity.
 Increase accuracy and stability at each soldering point.
 Easy integration with many diverse types of robots 
Specialized and synchronized software for easy installation
2. Feature:
 Precise control of welding temperature
 Multiple types of welding tips can be selected to suit each application.
 Allows line welding to increase productivity.
 Automatic tin feeding and cutting units to increase weld quality.
 Allows the option of integrating nitrogen gas to protect the weld.
 Integrates with desktop robots, Scara robots, 6-axis robots.
 Integrates automatic welding point positioning camera system.
 Integrates automatic AOI quality inspection system.
Fig 2.4 Features of the JANOME JR3204 Flagship desktop PCB robot (5)
3. Specifications

Fig 2.5 Specification of the JANOME JR3204 Flagship desktop PCB robot (6)
CHAPTER III: CIRCUIT DIAGRAM

3.1/ CIRCUIT DIAGRAM:


A/ X AXIS CIRCUIT DIAGRAM:
Like 3D printers, the X-axis movement will be used to move the printing
table, but in our robot, we will not use a table to hold the PCB, instead we will
move the mechanism that holds the extruder carrying the Z axis. The PCB will be
fixed onto the ground. This is done by the travel mechanism change system and the
transmission system.
These systems are performed by a 20-tooth pulley head (mounted on a stepper
motor) connected to a GT2 belt and interacting with the pulley.
As shown in the diagram below:

Fig 3.1. X axis circuit diagram

1/ Step motor 1,8 deg


2/ GT2 20-tooth pulley 6mm
3/ GT2 belt
4/ Pulley heads
5/ One step distance of GT2 belt
6/ GT2 20-tooth pulley head

We see that to perform the conversion from rotary motion to translational


motion is when the step motor rotates, it will make the pulley head rotate, at this
time the pulley head will interact with the belt to make the belt move
translationally.
The belt will be attached to the soldering table mounting base, the welding table
when attached to the base will make the table move translationally.
To calculate how much one step of the step moves, we will analyze the parameters
of the components in the picture:
 Step motor: one step of step will rotate 1.8 degrees in this product we will use 1/16
step of step to achieve the highest accuracy.
 GT2 20-tooth pulley: each tooth of the pulley corresponds to 2mm distance on the
GT2 belt, the 20-tooth pulley will have a circumference of:
Pulley circumference = 20 x 2 = 40(mm).
 This means that 1 pulley turn will cause the belt to move 40mm.
 GT2 belt: like GT2 pulley, the tooth pitch of the belt is also 2mm. Then
we have:
1. Motor step angle: Step motors have a standard step angle of 1.8 degrees for each
full step.
2. Micro stepping: We use 1/16 steps, which means each micro step will be: Micro
step angle = 1.8/16 = 0.1125 (degrees)
3. GT2 20-tooth pulley: Each tooth of the pulley corresponds to 2 mm of distance
on the belt (because the GT2 belt has a tooth pitch of 2 mm). A 20-tooth pulley
will have a circumference of:
Pulley circumference = 20 × 2 = 40 mm
This means if the pulley rotates 1 revolution, it will move the belt 40 mm..
4. Number of micro steps required for one round: Since each microstep rotates
the motor by 0.1125°, the number of microsteps required to make a complete
revolution (360°) is:
Số microstep=360/0.1125 =3200 (microstep)
5. Travel distance in each microstep: Since 1 turn of the pulley corresponds to 40
mm, the travel distance in each microstep will be:
Distance per microstep = 40mm/3200= 0.0125(mm) So,
each microstep will travel 0.0125 mm.

B/Y AXIS CIRCUIT DIAGRAM:


Similar to the X axis, but instead of “moving” the soldering table, we will
use it to move the “soldering tip” (the soldering tip here is the component that
holds the soldering pen and the tin tube).
As shown in the chart below:

Fig 3.2. Y axis circuit diagram


1/ Step motor 1,8 deg
2/ GT2 20-tooth pulley 6mm
3/ GT2 belt 4/ Pulley head.
5/ Soldering tip mounting base
6/ One step distance of GT2 belt
7/ GT2 20-tooth pulley head
8/ Distance of 1 tooth of GT2 pulley head
9/ Step motor mounting base (Z1 propelling mechanism) 10/
Pulley head mounting base (Z2 propelling mechanism).

C/ Z AXIS CIRCUIT DIAGRAM:


Normally, with the XYZ core model, for the Z axis we will use 2 stepper
motors to hold the Y axis holder fixed and move the Y axis motor mount. Instead
of using the 20-tooth GT2 pulley like the X and Y axes, for the Z axis we will use a
coupling. Because of the stiffness and torsion of the T8 lead screw, we use it to
shape the fixed Z axis, the coupling helps the stepper motor to be attached to the
lead screw and make the lead screw rotate according to the stepper motor.
Please look at the given chart below:

Fig 3.3 Z axis circuit diagram

How ever, in order to minimize the design process, we will reduce two Z axes
down to one by mounting the mechanism holding one Z axis onto the extrut
1/ Step motor 1,8 deg
2/ Joint
3/ Step motor mounting base (Y propelling mechanism
4/ Lead screw connected to the step motor
5/ Pulley shaft mounting base
6/ Step motors 1 and 2 mounting base
7/ Barrier for 2 axes of Z axis.

We have the functions of the sub-components as given:


 Six mounting bases for 2 stepper motors help the 2 steps avoid oscillation during
operation to avoid errors during welding (this plate will be directly attached to
the ground).
 Seven barriers for 2 Z axes to fix 2 lead screw bars from vibrating during operation.
 Two joints to connect the motor and the lead screw shaft.
Similar to the X and Y axes, we will convert the travel from rotation to
translational motion. Unlike the X and Y axes, instead of using the GT2 belt, we
use the GT8 lead screw with one step of the step, which will make the "mounting
base" move 2mm. Here, we will attach 2 "mounting bases" to two axes to translate
the two axes in the same direction and the same distance. Two stepper motors will
be attached together with 1 control signal. To calculate the smallest distance that
the mounting base can move, we will analyze the available parameters such as:
 Step motor: one step of step will rotate 1.8 degrees in this product we will use 1/16
step of step to achieve the highest accuracy.
 T8 lead screw: 1 step will make the base mounted on the lead screw move 2mm Now
we have:
1. Motor step angle: one full step is 1.8°.
2. Micro stepping: Using 1/16 steps, that is, each micro step will rotate the motor:
Micro step angle = 1.8/16 =0.1125 (degrees).
3. Number of micro steps for one motor rotation: Since each micro step rotates the
motor 0.1125°, the number of micro steps to rotate one complete revolution (360°) is:
The number of micro steps = 360/0,1125 = 3200(step).
4. Travel distance per micro step: With 3200 micro steps to make 1 revolution and
each revolution moves 2 mm, the distance traveled in each micro step is:
Travel distance = 2/3200 = 0,000625(mm).
Conclusion:
Each 1/16 step (micro step) of the motor when using a T8 screw with a 2 mm thread
pitch will move 0.000625 mm.
D/ CIRCUIT DIAGRAM OF OTHER COMPONENTS:
1. Step motor rotation angle: A 1.8-degree stepper motor means that each full
step of the motor is 1.8 degrees. When using 1/16 step, each micro step of the
motor will be:
Micro step angle = 1,8/16 = 0,1125(degree).
2. Number of motor steps for one rotation: One full rotation of the motor is 360
degrees. The number of micro steps required to complete one revolution is: The
number of micro steps = 360/0,1125 = 3200 (step).
3. MK8 extruder: The MK8 extruder typically uses a gear with an outer diameter
of about 11mm. This gear will pull the tin based on its circumference. The
circumference of the gear is calculated using the formula:
Perimeter = π x diameter = 3,1416 x 11 =34,56(mm)
The MK8 extruder typically uses a gear with an outer diameter of about
11mm. This gear will pull the message based on its circumference. The
circumference of the gear is calculated using the formula).
4. Length of plastic extruded per micro step: Since there are 3200 micro steps
for one revolution, the length of plastic extruded per micro step is: Length =
34,56/3200 = 0,0108 (mm)
Therefore, for each micro step of the stepper motor (in 1/16 step mode), the MK8
extruder will extrude about 0.0108 mm.
5. Soldering set using step motor: When we control the welding table so that the
welding point has moved to the "welding head" at coordinate X, we will now
move the welding head and the mounting base at the Z axis so that the center
point at the welding head reaches the coordinate of the Y point at the welding
point and the center point is a distance "z" from the welding point at Z. Take the
origin at a straight line "-z" compared to the point at the tip of the pen. We can
see from the given chart below:
Fig 3.4 Circuit diagram of the soldering pen

 Initially: we move the welding table (yellow point) to the welding point along the
X axis
 Now we only work with the Y and Z axes.
 Then we consider the red point in figure 1 (the point of the soldering head).
 Now we have the point with coordinates (0, Z') and rotate it at an angle so that
the welding point coincides with the point to be welded (blue point) with
coordinates (y',0). We then use the following formula to find the angle to rotate

This formula corresponds to:

Given:
 θ is the rotation angle (in radians or can be converted from degrees to radians)).
 This rotation is counterclockwise if θ is positive and clockwise if θ is negative.

3.2/ CODES:
CHAPTER 4: ELECTRONIC
COMPONENTS

4.1/ MICROCONTROLLER STM32F103C8T6:


A/ BASIC FEATURE OF STM32F103C8T6 BLUE PILL:
The STM32F103C8T6 microcontroller is a microcontroller in the STM32
family from STMicroelectronics, based on the ARM Cortex-M3 architecture. Here are
the major features of this microcontroller:
 CPU

ARM Cortex-M3: 32-bit CPU with high performance and RISC architecture.
Operating speed: Up to 72 MHz which helps this microcontroller handle realtime
control tasks quickly...
 Memory
Flash: 64 KB of flash memory for program storage (versions with different flash
capacities are available, but the C8T6 has 64 KB).
SRAM: 20 KB RAM (dynamic memory) to store data during operation.
 GPIO (General Purpose Input/Output)
37 GPIO pins: configurable for distinct functions such as input, output, signal PWM,
SPI, I2C, UART, ADC, v.v.
Voltage withstanding: Each pin can handle up to 20 mA of current, enough to drive
small LEDs or relays without the need for auxiliary components...
 Peripheral communication
UART: three sets of UART for serial communication.
SPI: two set of SPI (Serial Peripheral Interface) for communicating with sensors and
serial communication.
I2C: two sets of I2C which support communication with I2C devices such as sensors,
EEPROM, OLED.
CAN: one set of CAN communications which supports automotive and industrial
applications.
USB: Supports USB 2.0 full speed to communicate with computers or other devices.
 ADC (Analog to Digital Converter)
10 ADC 12-bit channels: Can convert analog signals to digital signals with 12-bit
resolution. Maximum conversion rate is 1 million samples/second (1 Msps).
 Timers and PWM
3 set of Timer 16-bit: Used for real-time control and generation of PWM control signals.
PWM (Pulse Width Modulation): Supports multiple PWM channels to control motor
speed or LED brightness.

B/ WHY SHOULD WE USE STM32F103C8T6 BLUE PILL FOR OUR PRODUCT?:


For STM32F103C8T6 has the following features:
 ADC: ADC measurement allows us to run manual mode by adjusting the
potentiometer value so that the motor can move from the beginning to the end
of the journey.
 PWM: Helps control servo motors, steppers and cooling fans.
 UART communication: Used to connect to a computer and robot, convenient for setting
parameters on computer.
 I2C communication: Used to display robot information and control the robot on LCD.

 GPIO: Used to emit signals to LED lights, ... or receive signals from buttons.

Fig 4.1. Microcontroller STM32F103C8T6 Blue Pill (source: Internet)


4.2/ ULTRASONIC DISTANCE SENSOR HC-R04
A/ BASIC FEATURE OF THE HC-R04:
The HC-SR04 ultrasonic distance sensor is a widely used component in
electronics projects, known for its accuracy, cost-effectiveness, and ease of
integration with microcontroller platforms such as Arduino and Raspberry Pi. This
report provides a detailed analysis of the sensor's working principles,
specifications, and applications. The HC-SR04 operates using the principles of
ultrasonic sound waves and reflection. It consists of two main components:

 Transmitter: Emits ultrasonic sound waves at a frequency of 40 kHz.


 Receiver: Detects the reflected waves that bounce back from an object.

:
B/ TECHNICAL SPECIFICATIONS
 Operating Voltage: 5V DC
 Operating Current: <15 mA
 Frequency: 40 kHz
 Range: 2 cm to 400 cm
 Accuracy: ±3 mm
 Dimensions: 45 mm × 20 mm × 15 mm
 Trigger Pulse Input: 10 µs minimum
 Interface: 4 pins (VCC, GND, Trigger, Echo)
Fig 4.2. Ultrasonic Distance Sensor HC-R04 (source: Internet)

4.3/ DRIVER A4988:


A/ BASIC FEATURE OF A4988:
A4988 is a very popular step motor driver, commonly used to control stepper
motors in applications such as 3D printers, CNCs, and automated robots. Here are
the basic features of the A4988:
1. STEP MOTOR CONTROLLING
 A4988 supports bipolar step motor control, can control both coils of the motor to ensure
precise movement.
 Supports micro stepping with such values:
o Full step o One-
half step o One-
fourth step o One-
eighth step o 1/16
step
Fig 4.3. A4988 step motor driver (source: Internet)

2. VOLTAGE AND CURRENT


 Operating voltage:
o Voltage supplied to the motor: from 8V to 35V.
o Logic voltage (VDD): 3.3V or 5V (compatible with many other microcontrollers).
 Controlling current:
o Maximum current: 2A per coil with appropriate heatsink. o Maximum current can be
adjusted by a potentiometer on the module to protect the motor from overload.
3. INTEGRATED PROTECTION
 Over-current Protection: Automatically disconnects when current exceeds set
threshold.
Thermal Shutdown: Automatically shuts off when temperature is too high to avoid
damage.
 Short-Circuit Protection: Automatically disconnects when a short-circuit is detected in
motor winding.
 Undervoltage Lockout: Shuts down if voltage falls below safe level.
B/ DIRECTION AND STEP CONTROL
 Use 2 input signals from the microcontroller: o STEP: Step control signal
(controls the number of steps the motor moves).
o DIR (Direction): Rotation direction control signal
(clockwise or counterclockwise).
 Enable (EN): Enable or disable the usage of the motor.
1. SLEEP MODE
 A4988 has sleep mode when not in use, helping to save energy.
2. PULSE WIDTH MODULATION
 A4988 uses PWM to adjust the current supplied to the motor coil, helping to precisely
control motion and protect the motor from overload.
3. CURRENT LIMITER
 A4988 can adjust the maximum current to the motor via a potentiometer on the module.
This is useful to avoid overheating and damaging the motor...
4. PINOUTS AND SIGNALS
 MS1, MS2, MS3: Micro stepping control pins to select full, half, 1/4, 1/8, or 1/16 step
modes.
 RESET và SLEEP: Pins used to control the state of the driver (RESET to restart and
SLEEP to put the driver into sleep mode).

C/ WHY SHOULD WE USE THE A4988 FOR CONTROLLING ROBOT:
 We know that the signal from the microcontroller is a non-standard signal like the
PWM signal and in the A4988 there is a microprocessor that has restandardized
the signal.
 In addition, when running the motor, we need a "momentum" signal for the step and
the A988 has a built-in capacitor.
 In addition, we can adjust the step resolution of the step (1/2, 1/6, 1/16, ...) manually
because there is a control switch available in the A4988.

4.4/ USB TO TLL MODULE:


A/ BASIC FEATURE OF THE USB TO TLL MODULE:
A USB to TTL (Transistor-Transistor Logic) module is a critical tool for
facilitating communication between a computer's USB port and devices that
operate on TTL serial communication. This report provides an in-depth analysis of
the module's functionality, specifications, and applications. The USB to TTL
module serves as a bridge between USB interfaces and serial devices that use TTL-
level signals. It converts USB signals to TTL-compatible levels (typically 3.3V or
5V) and vice versa, enabling seamless communication.
Key functionalities include:
 Allowing PCs to communicate with microcontrollers, sensors, and other serial devices.
 Facilitatingdata transfer for programming and debugging.
 Acting as an interface for devices lacking native USB support.
B/ CORE COMPONENTS AND TECHNICAL SPECIFICATIONS:

 The USB to TTL module typically consists of:


 USB Connector: Provides a connection to the host device (PC or laptop).
 Integrated Circuit (IC): Handles USB to TTL signal conversion. Common ICs include
FT232RL, CH340, CP2102, and PL2303.
 Voltage Regulator: Ensures stable voltage levels for the TTL signals.
 Indicator LEDs: Show power status and data transmission activity.
 Pins/Headers: Output connections for TX (Transmit), RX (Receive), VCC (Power),
and GND (Ground).
Technical specifications:
 Operating Voltage: 5V or 3.3V (selectable in some modules)
 Baud Rate: Typically ranges from 300 bps to 1 Mbps
 USB Protocol: USB 2.0 (compatible with USB 1.1 and USB 3.0)
 Signal Levels: TTL logic (3.3V or 5V)
 Operating Temperature: -40°C to +85°C (varies by module)
 Supported OS: Windows, macOS, Linux
C/ APPLICATIONS:
 USB to TTL modules find use in various fields, including:
 Microcontroller Programming: Used to upload firmware to Arduino, ESP8266, and
other boards.
 Serial Communication: Facilitates communication with GPS modules, GSM modules,
and other peripherals.
 Debugging: Helps monitor and debug serial output from embedded systems.
 IoT Development: Interfaces IoT devices with development environments.
Fig 4.4. USB to TLL module (source: Internet)

4.5/ 24v/12v TO 5v 5A POWER MODULE:


A/ BASIC FEATURE OF THE 24V/12V TO 5V 5A MODULE:
The 24V/12V to 5V 5A power module, often referred to as a DC-DC buck
converter, is a critical component in power management systems. It steps down
higher input voltages (24V or 12V) to a stable 5V output, capable of delivering up
to 5A of current. This report explores the module's working principles,
specifications, and applications. This power module operates based on the buck
converter topology, which is a type of switched-mode power supply (SMPS). It
uses the following components to achieve voltage step-down:
• Inductor: Stores and releases energy to smooth the current flow.
• Capacitor: Stabilizes the output voltage.
• Switch (typically a MOSFET): Controls the energy transfer from input to output.
• Controller IC: Regulates the switching operation to maintain a constant output
voltage.
The module switches the input voltage on and off at high frequency. By
adjusting the duty cycle of the switching signal, it achieves a lower average output
voltage, efficiently converting power with minimal loss.

B/ TECHNICAL SPECIFICATIONS:
 Input Voltage Range: 12V to 24V DC
 Output Voltage: 5V DC
 Output Current: Up to 5A
 Efficiency: >90% (typical)
 Ripple Voltage: <50mV (typical)
 Operating Temperature: -40°C to +85°C
 Protection Features: Overload, over-temperature, and short-circuit protection 
Dimensions: Compact and lightweight, varying by manufacturer
C/ APPLICATIONS:
 The module is versatile and used in numerous applications, including:
 Automotive Systems: Powers USB chargers, dash cameras, and GPS devices from
a vehicle’s 12V system.
 Industrial Equipment: Supplies 5V power to sensors, actuators, and microcontrollers.
 IoT Devices: Provides stable power for wireless modules and embedded systems.
 Consumer Electronics: Powers smartphones, tablets, and other USB-powered devices.
 Renewable Energy Systems: Converts solar or battery power for 5V electronics.

Fig 4.5. 24v/12v TO 5v 5A power module (source: Internet)


4.6/ LIMIT SWITCH:
A/ BASIC FEATURE OF THE LIMIT SWITCH:
A limit switch is an electromechanical device used to detect the presence or
absence of an object, or to monitor and control the movement of machinery. It is
widely employed in industrial, commercial, and residential applications due to its
reliability and precision. This report provides an in-depth exploration of the
working principles, specifications, and applications of limit switches. The limit
switch operates mechanically through direct physical contact. It consists of the
following components:
 Actuator: The external part that encounters the moving object.
 Electrical Contacts: Opens or closes the electrical circuit based on the actuator's
position.
When the actuator is triggered by the motion or presence of an object, it
causes the internal contacts to change state (either open or closed), thereby sending
a signal to the control system or triggering a specific action.

B/ TECHNICAL SPECIFICATIONS:
 Operating Voltage: Varies between 5V to 240V AC/DC, depending on the model.
 Current Rating: Typically ranges from 1A to 15A.
 Contact Configuration: SPST, SPDT, DPDT (Single Pole Single Throw, Single Pole
Double Throw, Double Pole Double Throw).
 Mechanical Life: Up to 10 million operations (varied by model).
 Operating Temperature Range: -25°C to +80°C.
 Housing Material: Metal or thermoplastic for durability in harsh environments.
Fig 4.6. Limit switch (source: Internet)

CHAPTER 5: PCB WIRING, 3D


DESIGN AND TECHNICAL
DRAWINGS
5.1/ WHAT IS A PCB?:
A PCB (Printed Circuit Board) is a flat board made from non-conductive
materials (like fiberglass or epoxy) with thin layers of conductive material (usually
copper) etched or printed onto its surface to create electrical pathways. These
pathways connect electronic components such as resistors, capacitors, and
integrated circuits. PCBs are the backbone of modern electronic devices, offering a
reliable and cost-effective way to integrate and interconnect components in a
compact and organized manner. They are found in virtually all electronic devices,
from smartphones and computers to medical equipment and automotive systems.
1. The structure of a PCB:
A common PCB consists of 4 basic parts which are: substrate, copper layers,
solder mask and silkscreen. The base layer will stay in the center of the board and
then 2 layers of copper will be plated outside the base layer. Outside the copper
layer will be 2 layers of soldier mask and finally there are 2 layers of silkscreen.
The figure below will show us the basic structure of a PCB.

Fig 5.1.1. The structure of a common PCB (source: Internet)



Substrate (Base Material): This base layer provides mechanical support, holds
the components, traces and others and insulates them. Common materials used
to make these board’s base are fiberglass (FR4), Teflon or flexible plastics.

Fig 5.1.2. Pieces of fiberglass (FR4) (source: Internet)

 Copper Layer(s): Generally, the copper would always be the initiating layer and
the most important layer. The reason why it is important is that it makes real
connections in the layout of the PCB , where the current flows through. The
usual thickness of this layer is ¼ mil (35 micro-meters). The thicker the copper
layers are, the more expensive the PCB will be. Instead of wires, we use copper
layers in the Printed Circuit Board in terms of traces.
There are two copper layers, one at the top and the one on the bottom side. The
copper layer which is at the top is called as the Top layer and the copper layer
which is at the bottom is called as the Bottom Layer. These are the basic PCB
layers, also called as the cross-section of the PCB.

Solder Mask: A solder mask is a thin lacquer-like layer of polymer that is
usually applied to the copper traces of a PCB for protection against oxidation
and to prevent solder bridges from forming between closely spaced solder pads,
creating a short-circuit. Once applied, openings must be made in the solder
mask wherever components are soldered, which is accomplished using
photolithography. Solder masks are traditionally green but are also available in
many other colors.

Fig 5.1.3. Solder mask protecting trace and exposing solderable pads (source: Internet)

 Silkscreen: This layer basically does nothing related to electrically. Instead, we


can add additional information about the components like the component logo,
personal logo, etc. For example, if we’re printing the Integrated Circuit, the
name of the Integrated Circuit Component (Ex: 74AC14) can be printed here in
the middle and any other information in the sides. Silk screen should not be put
in the area where the soldering is going to be done (connection of the capacitors
or resistors or any other components on the Printed Circuit Board). The reason
is that the silk screen will make the solder joints weaken. The whole connection
of the components on the Printed Circuit Board will become weakened. So, we
just need to keep a margin between the components and keep it a little bit away
from each other which can make it reliable (ensure to keep them separate
enough).

2. Reason to use a PCB


 Compact and Organized Design: A PCB allows electronic components to be
connected in a compact, efficient manner, reducing the physical size of the
device.

Reliability and Durability: The fixed pathways and solid connections on a PCB
are more durable compared to traditional wiring, reducing the risk of loose
connections or short circuits.
 Ease of Assembly and Repair: Components are placed in a pre-designed layout,
which simplifies assembly and troubleshooting.
 Mass Production Capability: PCBs are designed for automated production,
making them ideal for manufacturing large quantities of electronic devices.
 Improved Performance: The precise layout of components and conductive
pathways ensures better electrical performance and reduced signal interference.
 Cost-Effective: While the initial design of a PCB requires expertise, the
production costs are low for large-scale manufacturing.

3.

4. Our PCB design and wiring:



5.2/ 3D DESIGN:
1. Autodesk Fusion:
In the digital age, the journey from concept to creation has been
revolutionized by powerful tools that enable us to visualize, design, and perfect our
ideas before they ever take physical form. Autodesk Fusion 360 is one such tool, a
versatile, cloud-powered 3D CAD software that combines design, engineering, and
manufacturing into a single platform. By using Fusion 360, we were able to
illustrate the first and foremost images of our PCB soldering robot in a 3D state,
allowing us to inspect the project virtually and decide what to improve or discard
from the project. In this way, we can bring our PCB soldering robot to a perfect
state and we can also plan our next steps to begin building the PCB soldering robot
in real life.

Fig 5.2.1. Autodesk Icon (source: Internet)

2. Our 3D design:
5.3/ TECHNICAL DRAWINGS:
Along with the ability to create 3D designs and simulate the process of the
PCB soldering robot, Fusion 360 is also able to create 2D technical drawings with
tools that help simplify the process of drawing stuff by hand, creating the perfect
drawings without the flaws of the human eyes and hands.
Our technical drawings:
CHAPTER 6: MECANICAL
STRUCTURE OF THE MACHINE
6.1/ FRAME STRUCTURE:
1. The X axis’s structure
2. The Y axis’s structure
3. The Z axis’s structure 4. The extruder’s structure
A/ THE TIN EXTRUDER:
B/ THE SOLDERING GREASE EXTRUDER
CHAPTER 7: THE MODULES
IN OUR MECHATRONICS
SYSTEM

7.1/ WHAT IS A MECHATRONICS SYSTEM:


Mechatronics is a pivotal field that integrates mechanics, electronics, and
computing, creating intelligent, adaptable, and versatile systems.
It combines mechanical engineering precision, electronic control, and
computer decision-making to innovate products and solutions. This
interdisciplinary approach represents a shift from traditional engineering to a
holistic method, leveraging each field's strengths for efficient and sophisticated
systems.
Mechatronics is crucial in modern engineering, evident in robotic arms,
medical devices, autonomous vehicles, drones, and advanced electronics.
The rise of IoT highlights its relevance, as it merges sensors, actuators, and
communication technology. Mechatronics addresses pressing challenges like
sustainable energy, advanced healthcare, and intelligent automation, optimizing
systems for performance and efficiency.
This guide simplifies mechatronic subsystems for a broad audience, from
students to professionals. It covers foundational aspects, demystifies sensors,
actuators, and control systems, and emphasizes software's role.
Practical applications in robotics, automotive, and healthcare industries
demonstrate real-world impacts. Emerging trends and future directions are
explored, aiming to inspire further innovation in mechatronics.
Fig 7.1.1. The fundamentals of Mechatronics (source: Internet)
Fig 7.1.2. A product of Mechatronics divided as modules

7.2/ The Interface module:


1. Purpose of the Interface module
The interface module is a pivotal component in a mechatronics system,
facilitating seamless communication between mechanical components, electronic
circuits, and control systems. This report delves into the purpose, design,
components, and applications of the interface module, emphasizing its role in
enhancing system integration and performance.
The interface module acts as a mediator that ensures proper communication
and coordination between various subsystems in a mechatronics setup. Its key
functions include:
 Converting signals from one form to another (e.g., analog to digital or vice
versa).
 Synchronizing data transmission between components.
 Isolating different subsystems to prevent interference or damage.
 Enhancing compatibility between hardware and software components.
2. Core components:
An interface module typically comprises the following elements:
 Signal Converters: Convert input signals into formats compatible with the
receiving subsystem.
 Microcontrollers or Microprocessors: Process data and manage
communication protocols.
 Communication Ports: Include USB, UART, I2C, SPI, and CAN bus for data
transfer.
 Power Supply Interfaces: Regulate and distribute power to connected devices.
 Isolation Components: Optocouplers or transformers for electrical isolation.
 Connectors and Cables: Facilitate physical connections between subsystems.
3. Design considerations:
Designing an effective interface module involves addressing several critical
factors:
 Signal Integrity: Ensuring minimal distortion or loss during signal transmission.
 Compatibility: Supporting multiple protocols and standards for broad
application.
 Scalability: Accommodating future system expansions or upgrades.
 Reliability: Operating effectively under varying environmental and operational
conditions.
 Latency Minimization: Reducing delays in data transmission for real-time
applications.
4. Challenges in Interface module design:
While essential, the design and implementation of an interface module pose
several challenges:
 Maintaining compatibility across diverse components and standards.
 Ensuring robustness in environments with electromagnetic interference (EMI).
 Achieving real-time performance in latency-sensitive applications.
 Balancing cost-effectiveness with advanced functionality.

7.3/ The Software module:


1. Purpose of the module:
The software module is a cornerstone of any mechatronics system, providing
the intelligence required to control, monitor, and optimize the performance of the
integrated mechanical and electronic components. This report outlines the purpose,
structure, functionalities, and applications of the software module in mechatronic
systems. The software module serves as the brain of a mechatronics system,
responsible for:
 Translating user commands into actionable instructions for hardware components.
 Monitoring system performance through real-time data acquisition and
processing.
 Ensuring seamless interaction between mechanical, electronic, and control
subsystems.
 Facilitating automation, diagnostics, and system optimization.
2. Core components:
The software module consists of several integral elements:
 Operating System (OS): Manages hardware resources and provides a platform
for application software.
 Control Algorithms: Implement logic for system operation, such as PID
(Proportional-Integral-Derivative) controllers.
 Communication Protocols: Facilitate data exchange between subsystems (e.g.,
UART, SPI, CAN, Ethernet).
 User Interface (UI): Provides an interface for users to interact with the system.
 Diagnostics and Logging Tools: Record system performance and identify faults.
 Firmware: Embedded software that operates low-level hardware components.
3. Design considerations:
Developing an effective software module involves addressing the following
factors:
 Modularity: Breaking down the software into reusable and interchangeable
components.
 Real-Time Processing: Ensuring timely responses to dynamic system inputs.
 Scalability: Accommodating future expansions or upgrades.
 Error Handling: Detecting and mitigating faults to ensure robust operation.
 Compatibility: Ensuring seamless integration with hardware components and
external systems.
4. Challenges in Software module design
Creating a robust software module presents several challenges:
 Balancing computational demands with hardware limitations.
 Ensuring real-time performance under variable operating conditions.
 Protecting the system against cybersecurity threats.
 Maintaining compatibility with evolving hardware and software standards.
 Testing and validating complex algorithms and interactions.

7.4/ The Processor module:


1. Purpose of the Processor module:
The processor module is a critical element in a mechatronics system,
serving as the central unit that executes control algorithms, processes data, and
facilitates communication between components. This report provides an overview
of its purpose, structure, functionalities, and applications, highlighting its role in
ensuring the efficiency and reliability of mechatronic systems. The processor
module acts as the computational core of a mechatronics system, responsible for:
 Executing control logic to manage system operations.
 Processing data from sensors to generate actionable outputs.
 Coordinating communication between mechanical, electronic, and software
components.
 Supporting real-time operations and decision-making.
2. Core components:
A processor module typically comprises the following elements:
 Microcontroller (MCU) or Microprocessor: The primary computational unit,
selected based on system complexity and processing requirements.
 Memory Units: Include volatile memory (RAM) for temporary data storage and
non-volatile memory (Flash/EEPROM) for program and persistent data storage.
 Input/Output (I/O) Interfaces: Facilitate communication with sensors,
actuators, and external devices.
 Clock Generator: Provides timing signals for synchronized operations.
 Communication Modules: Support protocols like UART, SPI, I2C, CAN, or
Ethernet for data exchange.
 Power Supply Circuitry: Ensures stable and efficient power delivery to the
processor and peripherals.
3. Design considerations:
The design of a processor module requires addressing several factors:
 Processing Power: Ensuring sufficient computational capacity for the intended
application.
 Real-Time Capabilities: Guaranteeing timely responses for dynamic systems.
 Energy Efficiency: Minimizing power consumption, especially in
batteryoperated systems.
 Scalability: Allowing system upgrades or additional functionalities.
 Robustness: Ensuring reliable operation in harsh environments.
4. Challenges in the Processor module design
Developing an effective processor module involves overcoming several
challenges:
 Balancing processing speed and energy efficiency.
 Ensuring real-time performance under variable load conditions.
 Protecting against electromagnetic interference and cybersecurity threats.
 Integrating with diverse hardware and software ecosystems.
 Testing and validating complex functionalities.

7.5/ The Communication module:


1. Purpose of the Communication module:
The communication module is an essential component in a mechatronics
system, ensuring the seamless exchange of data between various subsystems. It
enables effective coordination, real-time monitoring, and control, thus enhancing
the overall performance of the system. This report provides an in-depth analysis of
the purpose, components, functions, applications, and challenges associated with
the communication module. The primary objective of the communication module
is to facilitate efficient and reliable data transfer between sensors, actuators,
controllers, and other subsystems. Its key roles include:
 Supporting interoperability between diverse hardware and software components.
 Enabling real-time communication for critical system operations.
 Providing interfaces for external systems or networks.
 Ensuring data integrity and minimizing transmission errors.
2. Core components:
A typical communication module comprises the following elements:
 Transceivers: Convert signals for transmission and reception over
communication channels.
 Communication Protocol Controllers: Implement protocols like UART, SPI,
I2C, CAN, Modbus, or Ethernet.
 Wireless Modules: Support wireless communication standards such as Wi-Fi,
Bluetooth, Zigbee, or LoRa.
 Interface Connectors: Physical connectors for wired communication (e.g., USB,
RJ45, DB9).
 Error-Checking Mechanisms: Ensure data integrity through checksums or
parity bits.
 Buffers: Temporarily store data to manage transmission rates and prevent data
loss.
3. Design considerations:
Designing an effective communication module requires addressing the
following factors:
 Compatibility: Ensuring seamless integration with existing hardware and
software.
 Bandwidth and Latency: Meeting the speed and timing requirements of the
application.
 Scalability: Supporting system expansion and new communication standards.
 Reliability: Ensuring robust operation in noisy or interference-prone
environments.
 Power Consumption: Optimizing for low-energy operation, especially in
wireless modules.
4. Challenges in the Communication module design
While crucial, designing and implementing a communication module
involves several challenges:
 Managing trade-offs between speed, range, and power consumption in wireless
systems.
 Ensuring cybersecurity to protect against unauthorized access and data breaches.
 Achieving compatibility with a wide range of protocols and standards.
 Mitigating interference in environments with high electromagnetic noise.
 Balancing cost and performance in resource-constrained applications.

7.6/ The Actuation module:


1. Purpose of the Actuation module:
The actuation module is a cornerstone of mechatronic systems, translating
control signals into mechanical actions. It serves as the physical interface between
the control system and the mechanical components, driving motion, force, or other
outputs necessary for system operation. This report delves into the purpose,
components, functionalities, applications, and challenges of the actuation module.
The primary function of the actuation module is to execute actions determined by
the control system. Key objectives include:
 Converting electrical signals into mechanical energy.
 Generating precise and controlled movements or forces.
 Enabling interaction with the environment or other subsystems. 
Ensuring efficient and responsive system behavior.
2. Core components:
An actuation module typically comprises the following elements:
 Actuators: Devices such as electric motors, hydraulic cylinders, or pneumatic
actuators that produce motion or force.
 Power Drivers: Electronics that supply appropriate voltage and current to the
actuators.
 Feedback Sensors: Devices like encoders or potentiometers that monitor
actuator position, speed, or force.
 Mounting and Linkages: Mechanical components that connect actuators to the
system’s structure or load.
 Control Interface: Circuits or software enabling integration with the processor
module.
3. Design considerations:
The design of an actuation module requires addressing several critical
factors:
 Load Requirements: Ensuring sufficient torque, speed, or force to handle the
system’s operational demands.
 Precision and Accuracy: Meeting the system’s performance criteria with
minimal error.
 Power Efficiency: Optimizing energy consumption for sustainable operation.
 Durability and Reliability: Withstanding wear and environmental conditions. 
Compatibility: Seamless integration with the control and feedback systems.
4. Challenges in the Actuation module design
Designing an actuation module involves several challenges:
 Balancing size, weight, and power in compact applications.
 Managing thermal dissipation in high-performance systems.
 Ensuring robustness against vibrations, shocks, or environmental extremes.
 Minimizing cost without compromising quality or reliability.
 Achieving seamless integration with advanced control algorithms and feedback
systems.

7.7/ The Measurement module:


1. Purpose of the Measurement module:
A mechatronics system integrates mechanical, electrical, and computer
engineering elements to perform complex automated tasks. The measurement
module is a critical component in any mechatronics system, providing the
necessary data for system control, feedback, and performance evaluation. This
report outlines the key aspects of the measurement module, including its
components, working principles, applications, and challenges.

2. Core components:
The measurement module typically consists of the following key elements:
A/ SENSOR:
Sensors are the primary elements of the measurement module, responsible for
detecting physical quantities and converting them into electrical signals. Common
types of sensors used in mechatronics systems include:
• Position sensors: Encoders, potentiometers, and LVDTs.
• Speed sensors: Tachometers and rotary encoders.
• Force and pressure sensors: Strain gauges and piezoelectric sensors.
• Temperature sensors: Thermocouples and RTDs.
• Proximity sensors: Inductive, capacitive, and optical sensors.
A/ THE TIN EXTRUDER:
The raw signals from sensors often require processing before they can be used by
the system. Signal conditioning involves:
• Amplification: Increasing the magnitude of weak signals.
• Filtering: Removing noise and unwanted frequency components.
• Analog-to-Digital Conversion (ADC): Converting analog signals into
digital form for processing by microcontrollers or processors.
c. Data Acquisition System (DAQ)
The DAQ interfaces with the sensors and the control system. It collects the
conditioned signals and transfers them to the central processing unit (CPU) for
further analysis. A DAQ system may include:
• Multiplexers
• Sample-and-hold circuits
• ADCs

3. Design considerations:
4. Challenges in the Measurement module design

7.8/ The Assembly module:


1. Purpose of the Assembly module:
The assembly module is a critical component in the construction and
operation of mechatronics systems, serving as the bridge between mechanical
components, electronics, and control systems. This report explores the structure,
functionalities, and considerations involved in the assembly module of a
mechatronics system. The assembly module integrates various subsystems of a
mechatronics setup, ensuring they function cohesively. Its key roles include:
 Physically uniting mechanical and electronic components.
 Facilitating data and power transmission between subsystems.
 Providing structural stability and alignment.
 Enabling modular design for maintenance and upgrades.
2. Core components:
An assembly module typically includes the following:
 Chassis or Framework: Provides the structural base for mounting components.
 Fastening Elements: Screws, bolts, and adhesives ensure secure connections.
 Interfacing Connectors: Electrical connectors, data cables, and bus systems
facilitate communication.
 Motion Components: Bearings, actuators, and guides manage movement and
alignment.
 Sensors and Feedback Devices: Monitor system performance and ensure proper
operation.
3. Design considerations:
Designing an effective assembly module requires addressing the following
factors:
 Load Distribution: Ensuring weight distribution to prevent mechanical stress.
 Space Optimization: Compact designs that minimize unused space.
 Thermal Management: Proper ventilation or heat sinks to avoid overheating.
 Vibration Dampening: Materials or mechanisms to reduce the impact of
operational vibrations.
 Ease of Assembly: Simplified designs for faster and error-free assembly.
4. Challenges in Assembly module design:
Despite its importance, assembling mechatronics systems poses challenges,
including:
 Aligning mechanical and electronic components with high precision.
 Preventing electromagnetic interference in densely packed systems.
 Ensuring reliability under varying environmental conditions.
 Managing the complexity of modular designs.

7.9/ The Environment module:


1. Purpose of the Environment module:
2. Core components:
3. Design considerations:
4. Challenges in the Environment module design
CHAPTER 8: MODELING THE
6DOF ROBOT ARM USING
MATLAB

1.1. Gắn toạ độ, lập bảng tham số D-


H và các ma trận
Bài toán ví dụ: Mô hình hóa một cánh tay robot 6 bậc tự do như sau:

Hình 1. Robot 6DOF


Thiết lập các tọa độ và thông số đối với robot:

Hình 2.(a) Gắn hệ toạ độ lên Robot


Hình 2.(b) Gắn hệ toạ độ lên Robot trong SolidWorks

Bảng 1. Bảng tham số D-H


Khâu 𝜽𝒊 𝜶𝒊 𝒂𝒊 𝒅𝒊

1 𝜃1 90° 𝑎1 𝑑1

2 𝜃2 0 𝑎2 0

𝜃3 𝑑3
-
3 0
90°
4 𝜃4 90° 0 𝑑4

𝜃5
-
5 0 0
90°
6 𝜃6 0 0 𝑑6

C 1= cos(θ1) S1= sin(θ1) C 12= cos(θ1 +θ2 ) S12= Sin(θ1 +θ2 )……
Các ma trận biến đổi thuần nhất 𝐴𝑖:
𝐴1=[C 1 0 S1 ;
a1C 1
S1 0 -C 1 a 1 S1 ;
0 1 0 d 1;
0 0 0 1];
𝐴2=[C 2 - S1 0 ;
a2C 2
S2 C1 0 a 2 S2 ;
0 0 1 d 2;
0 0 0 1];
𝐴3=[C 3 0 - S3 ;
0
S3 0 C3 0;
0 -1 0 d 3;
0 0 0 1];
𝐴4=[C 4 0 S4 ;
0
S4 0 −C 4 0;
0 1 0 d4;
0 0 0 1];
𝐴5=[C 5 0 - S5 ;
0
S5 0 C5 0;
0 -1 0 0;
0 0 0 1];
𝐴6=[C 6 - S6 0 ;
0
S6 C6 0 0;
0 0 1 d 6;
0 0 0 1];

Ma trận biến đổi thuần nhất của hệ toạ độ gắn trên khâu chấp hành cuối của tay máy so với hệ
tọa độ gốc:
𝑇 = 𝐴1 ∗ 𝐴 2 ∗ 𝐴 3 ∗ 𝐴 4 ∗ 𝐴 5 ∗ 𝐴 6
Dùng Matlab để tính toán ma trận, Kết quả tính trong Matlab:
6𝑇
0
=
[- cos(θ6)*(sin(θ1 + θ2 + θ3)*sin(θ5) - cos(θ1 + θ2 + θ3)*cos(θ4)*cos(θ5)) - cos(θ1 + θ2 +
θ3)*sin(θ4)*sin(θ6), sin(θ6)*(sin(θ1 + θ2 + θ3)*sin(θ5) - cos(θ1 + θ2 + θ3)*cos(θ4)*cos(θ5)) -
cos(θ1 + θ2 + θ3)*cos(θ6)*sin(θ4), - sin(θ1 + θ2 + θ3)*cos(θ5) - cos(θ1 + θ2 + θ3)*cos(θ4)*sin(θ5),
a2*cos(θ1 + θ2) + a1*cos(θ1) - d4*sin(θ1 + θ2 + θ3) - d6*cos(θ1 + θ2)*cos(θ5)*sin(θ3) - d6*sin(θ1
+ θ2)*cos(θ3)*cos(θ5) - d6*cos(θ1 + θ2)*cos(θ3)*cos(θ4)*sin(θ5) + d6*sin(θ1 +
θ2)*cos(θ4)*sin(θ3)*sin(θ5); cos(θ6)*(cos(θ1 + θ2 + θ3)*sin(θ5) + sin(θ1 + θ2 +
θ3)*cos(θ4)*cos(θ5)) - sin(θ1 + θ2 + θ3)*sin(θ4)*sin(θ6), - sin(θ6)*(cos(θ1 + θ2 + θ3)*sin(θ5) +
sin(θ1 + θ2 + θ3)*cos(θ4)*cos(θ5)) - sin(θ1 + θ2 + θ3)*cos(θ6)*sin(θ4), cos(θ1 + θ2 + θ3)*cos(θ5)
- sin(θ1 + θ2 + θ3)*cos(θ4)*sin(θ5), a2*sin(θ1 + θ2) + a1*sin(θ1) + d4*cos(θ1 + θ2 + θ3) +
d6*cos(θ1 + θ2)*cos(θ3)*cos(θ5) - d6*sin(θ1 + θ2)*cos(θ5)*sin(θ3) - d6*cos(θ1 +
θ2)*cos(θ4)*sin(θ3)*sin(θ5) - d6*sin(θ1 + θ2)*cos(θ3)*cos(θ4)*sin(θ5);
- cos(θ4)*sin(θ6) - cos(θ5)*cos(θ6)*sin(θ4), cos(θ5)*sin(θ4)*sin(θ6) - cos(θ4)*cos(θ6),
sin(θ4)*sin(θ5), d1 + d6*sin(θ4)*sin(θ5);
0, 0, 0, 1]

Khâu chấp hành cuối của tay máy được gắn một hệ tọa độ như Hình 4:

Hình 4. Hệ tọa độ đặt vào khâu chấp hành cuối của tay máy
Với:

𝑛 𝑜𝑥 𝑎𝑥
𝑥 𝑜𝑦 𝑎𝑦] là ma trận cosin chỉ hướng của
𝑅 = 𝑜 hệ {𝑂6} so với hệ {O}
[𝑛𝑦 𝑧 𝑎𝑧
𝑛
𝑧

𝑝
𝑥

𝑃 = [𝑝𝑦] là vector tọa độ chỉ vị trí của hệ toạ độ khâu cuối (tâm 𝑂6) trong hệ tọa độ gốc.
𝑝𝑧
Khi đó ma trận 𝑇 có
𝑛 � �
dạng:

𝑇=[𝑦
𝑛𝑧
� �
� �
0 �

� �

𝑜 � �
� �
𝑥

𝑜

� ]

� �
𝑦






0

0 1

• Bài toán động học thuận: cho giá trị 3 biến khớp 𝜃1, 𝜃2, 𝜃3 tìm tọa độ vector P.
1.2. Bài toán động học thuận, ngược

𝒑𝒙 = a1.C1-d3.S1-d4.S23.C1+a2.C1.C2-d6.S23.C1.C5+d6.S1.S4.S5-
d6.C1.C2.C3.C4.C5+d6.C1.C4.S2.S3.S5
𝒑𝒚 = a1.S1-d3.S1-d4.S23.S1+a2.C2.S1-d6.S23.C5.S1-d6.C1.S4.S5-
d6.C2.C3.C4.S1.S5+d6.C4.S1.S2.S3.S5
𝒑𝒛 = d1+d4.C23+a2.S2- +d6.C23.C5+
d 6. S 23. S 45 d 6. sθ −θ . S 23
4 5

2 2
• Điều kiện ràng buộc các biến khớp: hạn chế bài toán đa nghiệm.
−170 < 𝜃1 ≤ 170
−132 ≤ 𝜃2 ≤ 0
0 ≤ 𝜃3 ≤ 142
−165 ≤ 𝜃4 ≤ 165
−105 ≤ 𝜃5 ≤ 105
−155 ≤ 𝜃6 ≤ 155

𝜃1, 𝜃2, 𝜃3, 𝜃4, 𝜃5, 𝜃6.


• Bài toán động học ngược: cho tọa độ vector p và vector R tìm giá trị 6 biến khớp

Với các robot 6 bậc tự do RRRRRR có trục khớp của 3 khớp cuối 𝜃4, 𝜃5, 𝜃6 cắt nhau tại 01
điểm, ta có thể sử dụng phương pháp Pieper. Phương pháp này có thể phân giải bài toán
động học ngược thành hai bước đơn giản hơn như sau:
o Xác định vị trí cổ tay (wrist position):
+ Với vector vị trí và định hướng của end effector đã biết, được biểu diễn bởi ma trận T
(gồm vị trí P và định hướng R).
Vị trí của hệ toạ độ khâu cuối: 𝑃 = [𝑝𝑥, 𝑝𝑦, 𝑝𝑧]𝑇
𝑛𝑥 𝑜𝑥 𝑎𝑥
𝑜𝑦 𝑎𝑦]
𝑜 𝑎
Định hướng

effector: 𝑅
của end
𝑧 𝑧

= [𝑛𝑦
𝑛𝑧
+ Sau đó, tính toán vị trí của cổ tay (wrist center), vị trí này là một điểm quan trọng vì nó
cho phép tách biệt các tính toán liên quan đến vị trí và hướng của end effector.

Hình 5. Vị trí của W là tâm của điểm O4  O5


Ta xác định vị trí cổ tay 𝑊 = [𝑤𝑥, 𝑤𝑦, 𝑤𝑧]𝑇 như sau:
𝑊 = 𝑃 − 𝑑6 ∗ 𝑍6 hay

𝑤𝑥 𝑝𝑥 − 𝑑6 ∗ 𝑎𝑥
𝑊 = [𝑤𝑦] = [𝑝𝑦 − 𝑑6 ∗ 𝑎𝑦]
𝑤𝑧 𝑝𝑧 − 𝑑6 ∗ 𝑎𝑧

Trong đó, d6 là chiều dài từ cổ tay đến end effector dọc theo trục z.

o Giải phương trình động học ngược cho các khớp:


Khi đã biết vị trí cổ tay, các phương trình động học ngược cho từng khớp có thể được
giải quyết. Cụ thể, các khớp có thể được chia thành hai nhóm:

dụng vị trí cổ tay W đã có để giải các khớp 𝜃1, 𝜃2, 𝜃3 bằng cách sử dụng các phương
Nhóm khớp gốc (base joints): Những khớp này ảnh hưởng đến vị trí của cổ tay. Sử

pháp hình học.


Nhóm khớp cổ tay (wrist joints): Những khớp này chỉ ảnh hưởng đến hướng của end
effector. Vì vậy các khớp 𝜃4, 𝜃5, 𝜃6 được tính theo ma trận biến đổi 03T, 36T và 06T
1.2.1. Tìm 𝜽𝟏

Hình 6. Hình chiếu vector W (cổ tay) lên 3 trục tọa độ gốc
Khi đã biết trước tọa độ vector W, ta hoàn toàn có thể xác định được:
𝑤𝑦
tan 𝜃1 =
𝑤𝑥
𝜽𝟏 = 𝒂𝒕𝒂𝒏𝟐(𝒘𝒚, 𝒘𝒙)
1.2.2. Tìm 𝜽𝟑
Hình 7. Tìm 𝜃3
Từ hình ta có:
𝑠 = Pz − 𝑑1
𝑟
𝑐
2 2 2 2 2
r =d c 2 + d 3 c 23 + 2 d 2 c 2 d 3 c 23
2

2 2 2 2 2
s =d 2 c 2 + d 3 s23 +2 d 2 c 2 d 3 s23
2 2 2 2
r + s −d 2 −d 3
c 3=
2 d 2 d3

s3=± √ 1−c32
2 2 2 2
r + s −d 2 −d 3
θ3 =atan 2(± √ 1−c 3 ,
2
)
2 d2 d3
Từ W kẻ thêm một đường vuông góc với l 2 ta có:
θ2=atan 2 ( s ,r )−atan 2(l 2 , s3 ,l 3 +l 3 c 3)

1.2.4. Tìm 𝜽𝟒, 𝜽𝟓, 𝜽𝟔


Ta có:
06𝑇 = 03𝑇 ∗ 36𝑇
=> 36𝑇 = 03𝑇^ − 1
∗ 06𝑇

𝑛𝑥 � 𝑎𝑥 𝑎𝑦 �

0𝑇 = 𝑇 = [𝑛𝑦
� �
� �

𝑛𝑧



� �

0 �
� 0 �
� �

� ]

� �


0

1
Vì vậy ta có vế trái:
6𝑇 =
3

[cos(t4)*cos(t5)*cos(t6) - sin(t4)*sin(t6), - cos(t6)*sin(t4) - cos(t4)*cos(t5)*sin(t6), cos(t4)*sin(t5),


-d6*cos(t4)*sin(t5);
cos(t4)*sin(t6) + cos(t5)*cos(t6)*sin(t4), cos(t4)*cos(t6) - cos(t5)*sin(t4)*sin(t6), sin(t4)*sin(t5), -
d6*sin(t4)*sin(t5);
cos(t6)*sin(t5), -sin(t5)*sin(t6), cos(t5), d4 + d6*cos(t5);
0, 0, 0, 1]
Vế phải:
[nx*cos(t1 + t2 + t3) + ny*sin(t1 + t2 + t3), ox*cos(t1 + t2 + t3) + oy*sin(t1 + t2 + t3), ax*cos(t1 + t2
+ t3) + ay*sin(t1 + t2 + t3), px*cos(t1 + t2 + t3) - a2*cos(t3) - a1*cos(t2 + t3) + py*sin(t1 + t2 + t3);
[ -nz, -oz, -az,
d1 - pz];
[ny*cos(t1 + t2 + t3) - nx*sin(t1 + t2 + t3), oy*cos(t1 + t2 + t3) - ox*sin(t1 + t2 + t3), ay*cos(t1 + t2
+ t3) - ax*sin(t1 + t2 + t3), a1*sin(t2 + t3) + a2*sin(t3) + py*cos(t1 + t2 + t3) - px*sin(t1 + t2 + t3)];
[ 0, 0, 0,
1]
• Cân bằng các phần tử vế trái và vế phải ở cột thứ 1, 2, 3 của ma trận, ta có:
−𝑐4 ∗ 𝑠5 = 𝑎𝑥 ∗ 𝑐123 + 𝑎𝑦 ∗ 𝑠123 (𝑉ị 𝑡𝑟í 1: 3) (1)

−𝑠4 ∗ 𝑠5 = −𝑎𝑧 (𝑉ị 𝑡𝑟í 2: 3) (2)


𝑐5 = 𝑎𝑦 ∗ 𝑐123 − 𝑎𝑥 ∗ 𝑠123 (𝑉ị 𝑡𝑟í 3: 3) (3)
−𝑠5 ∗ 𝑠6 = 𝑜𝑦 ∗ 𝑐123 − 𝑜𝑥 ∗ 𝑠123 (𝑉ị 𝑡𝑟í 3: 2)(4)
𝑐6 ∗ 𝑠5 = 𝑛𝑦 ∗ 𝑐123 − 𝑛𝑥 ∗ 𝑠123 (𝑉ị 𝑡𝑟í 3: 1) (5)
𝑠4
Từ (1),(2) ➔ −𝑠4 ∗ 𝑠5/−𝑐4 ∗ 𝑠5 = 𝑐 4 = tan 𝜃4
𝜽𝟒 = 𝐚𝐭𝐚𝐧𝟐 (−𝒂𝒛, 𝒂𝒙 ∗ 𝒄𝟏𝟐𝟑 + 𝒂𝒚 ∗ 𝒔𝟏𝟐𝟑)

Từ 𝑐6 𝜃6

𝜽𝟔 = 𝐚𝐭𝐚𝐧𝟐 (− 𝒐𝒚 ∗ 𝒄𝟏𝟐𝟑 + 𝒐𝒙 ∗ 𝒔𝟏𝟐𝟑, 𝒏𝒚 ∗ 𝒄𝟏𝟐𝟑 − 𝒏𝒙

∗ 𝒔𝟏𝟐𝟑) o Từ (3) 𝑐5 = 𝑎𝑦 ∗ 𝑐123 − 𝑎𝑥 ∗ 𝑠123

Từ (5) ta có 𝑠5 = (𝑛𝑦 ∗ 𝑐123 − 𝑛𝑥 ∗ 𝑠123)/𝑐6

𝜽𝟓 = 𝐚𝐭𝐚𝐧𝟐 ((𝐧𝐲 ∗ 𝐜𝟏𝟐𝟑 − 𝐧𝐱 ∗ 𝐬𝟏𝟐𝟑)/𝐜𝟔, 𝐚𝐲 ∗ 𝐜𝟏𝟐𝟑 − 𝐚𝐱 ∗


𝐬𝟏𝟐𝟑 )

1.3. Bản vẽ các khâu robot


Độ dài các khâu được cho như sau:
Bảng 2. Bảng thông số các khâu của robot (mm)
Khâu 𝜽𝒊 𝜶𝒊 𝒂𝒊 𝒅𝒊
𝑑1 =
𝜃1 𝑎1 = 68.59 168.0
5
1 90°

2 𝜃2 0 𝑎2 = 305 0

3 𝜃3 -90° 0 0

4 𝜃4 90° 0 𝑑4 = 215

5 𝜃5 -90° 0 0

6 𝜃6 0 0 𝑑6 = 36.4

2. Chuyển đổi sang Matlab

2.1. SimMechanics
• Xuất file SolidWorks sang file .xml ví dụ “AR3.xml” •
Chuyển mô hình vào Matlab, dùng lệnh:
smimport(AR3.xml');
Hình 6.1. Mô hình trên simulink

6.2. Giao diện điều khiển

Hình 6.2. GUI điều khiển Trong


đó:
• Các tiêu đề theta1, theta2, theta3, theta4, theta5, theta6, px, py, pz là các Slider gain từ 1-
9. Tương ứng với các edit 1-9. nx, ny, nz, ox, oy, oz, ax, ay, az tương ứng với edit
10/11/12/20/21/22/30/31/32. Khi dịch chuyển trên thanh slider gain, giá trị của nó sẽ thay
đổi. Các slider gain có giá trị là “num”.
Tác vụ 1: Di chuyển slider1/2/3/4/5/6/7/8/9 → xuất giá trị cho edit1/2/3/4/5/6/7/8/9
• 9 edit text từ ngoài chức năng hiển thị, còn có chức năng lấy giá trị từ bàn phím. Kiểu dữ
liệu là “string”.
Tác vụ 2: Nhập giá trị edit1/2/3/4/5/6/7/8/9 → xuất giá trị cho slider1/2/3/4/5/6/7/8/9
Tác vụ 3: Nhấn Run Model (Chạy hàm “RunBtn_Callback”) → Load mô hình AR3 lên trình
Mechanics Explorer để chạy mô phỏng trên SimMechanics.
Tác vụ 4: Nhấn FORWARD (Chạy hàm “ForwardBtn_Callback”) → lấy giá tri từ slider1/2/3/4/5/6 →
giải bài toán động học thuận → xuất giá trị cho edit7/8/9 → xuất giá trị cho slider7/8/9 → xuất giá
trị cho gain/gain1/gain2/gain3/gain4/gain5 → chạy mô phỏng trên SimMechanics.
Tác vụ 5: Nhấn INVERSE (Chạy hàm “InverBtn_Callback”) → lấy giá trị từ
edit7/8/9/10/11/12/20/21/22/30/31/32 → giải bài toán động học nghịch → xuất giá trị cho
edit1/2/3/4/5/6 → xuất giá trị cho slider1/2/3/4/5/6 → gán giá trị cho
gain/gain1/gain2/gain3/gain4/gain5 → chạy mô phỏng trên SimMechanics.
Tác vụ 6: Nhấn RESET (Chạy hàm “ResetBtn_Callback”) → reset mọi slider và edit về 0.
Tác vụ 7: Nhấn CLOSE (Chạy hàm “CloseBtn_Callback”) → gọi hàm “close”
• Bài toán động học thuận: tác vụ 3 → tác vụ 4.
• Bài toán động học nghịch: tác vụ 5.
• Vị trí ban đầu → tác vụ 6.
• Đóng cửa sổ → tác vụ 7.

1.3. Kết quả chạy thử

Hình 6.3. Giao diện mô phỏng Mechanics Explorer


Hình 6.4. Giao diện GUI và chạy Forward Kinematics

Hình 6.4. Inverse Kinematics

1.4. Code Matlab


function varargout =
GUI(varargin)
% GUI MATLAB code for GUI.fig
% GUI, by itself, creates a new GUI or raises the existing
% singleton*.
%
% H = GUI returns the handle to a new GUI or the handle to
% the existing singleton*.
%
% GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUI.M with the given input
arguments.
%
% GUI('Property','Value',...) creates a new GUI or raises the
% existing singleton*. Starting from the left, property value pairs are %
applied to the GUI before GUI_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property
application % stop. All inputs are passed to GUI_OpeningFcn via
varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only
one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help GUI

% Last Modified by GUIDE v2.5 07-Aug-2024 19:55:24

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @GUI_OpeningFcn, ...
'gui_OutputFcn', @GUI_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []); if nargin &&
ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else
gui_mainfcn(gui_State, varargin{:}); end
% End initialization code - DO NOT EDIT

% --- Executes just before GUI is made visible.


function GUI_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to GUI (see VARARGIN)

% Choose default command line output for GUI


handles.output = hObject;

% Update handles structure guidata(hObject,


handles);

% UIWAIT makes GUI wait for user response (see UIRESUME)


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = GUI_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see
VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure


varargout{1} = handles.output;
% --- Executes on button press in ResetBtn. function
ResetBtn_Callback(hObject, eventdata, handles)
% hObject handle to ResetBtn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
ModelName =
'AR3'; d1 =
168.05; d4 = 215;

d6 = 36.4;
a1=68.59;
a2=305; t1 =
0; t2 = 0; t3 =
0; t4 = 0; t5 =
0; t6 = 0;
set(handles.slider1,'value',t1); set(handles.slider2,'value',t1);
set(handles.slider3,'value',t1); set(handles.slider4,'value',t1);
set(handles.slider5,'value',t1); set(handles.slider6,'value',t1);
set(handles.edit1,'string',num2str(t1));
set(handles.edit2,'string',num2str(t1));
set(handles.edit3,'string',num2str(t1));
set(handles.edit4,'string',num2str(t1));
set(handles.edit5,'string',num2str(t1));
set(handles.edit6,'string',num2str(t1));

%xoay canh tay ben simulink


set_param('AR3/Slider Gain','Gain',num2str(t1)); set_param('AR3/Slider
Gain1','Gain',num2str(t2)); set_param('AR3/Slider
Gain2','Gain',num2str(t3)); set_param('AR3/Slider
Gain3','Gain',num2str(t4)); set_param('AR3/Slider
Gain4','Gain',num2str(t5)); set_param('AR3/Slider
Gain5','Gain',num2str(t6));
px=a2*cosd(t1 + t2) + a1*cosd(t1) - d4*sind(t1 + t2 + t3) - d6*cosd(t1 +
t2)*cosd(t5)*sind(t3) - d6*sind(t1 + t2)*cosd(t3)*cosd(t5) - d6*cosd(t1 +
t2)*cosd(t3)*cosd(t4)*sind(t5) + d6*sind(t1 + t2)*cosd(t4)*sind(t3)*sind(t5);
py=a2*sind(t1 + t2) + a1*sind(t1) + d4*cosd(t1 + t2 + t3) + d6*cosd(t1 +
t2)*cosd(t3)*cosd(t5) - d6*sind(t1 + t2)*cosd(t5)*sind(t3) - d6*cosd(t1 +
t2)*cosd(t4)*sind(t3)*sind(t5) - d6*sind(t1 + t2)*cosd(t3)*cosd(t4)*sind(t5); pz=d1
+ d6*sind(t4)*sind(t5);
set(handles.edit7,'string',num2str(px));
set(handles.edit8,'string',num2str(py));
set(handles.edit9,'string',num2str(pz));
set_param(ModelName, 'SimulationCommand', 'start');
% --- Executes on button press in ForwardBtn. function
ForwardBtn_Callback(hObject, eventdata, handles)
% hObject handle to ForwardBtn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA) d1
= 168.05; d4 = 215; d6 = 36.4; a1=68.59; a2=305;
%lay cac gia tri
dau vao
theta1,theta2,theta3
t1=get(handles.slid
er1,'value');
t2=get(handles.slid
er2,'value');
t3=get(handles.slider3,'value');
t4=get(handles.slider4,'value');
t5=get(handles.slider5,'value');
t6=get(handles.slider6,'value'); %xuat gia
tri cho cac block gain
set_param('AR3/Slider Gain','Gain',num2str(t1)); set_param('AR3/Slider
Gain1','Gain',num2str(t2)); set_param('AR3/Slider
Gain2','Gain',num2str(t3)); set_param('AR3/Slider
Gain3','Gain',num2str(t4)); set_param('AR3/Slider
Gain4','Gain',num2str(t5)); set_param('AR3/Slider
Gain5','Gain',num2str(t6));
%tinh toan dong hoc thuan
px=a2*cosd(t1 + t2) + a1*cosd(t1) - d4*sind(t1 + t2 + t3) - d6*cosd(t1 +
t2)*cosd(t5)*sind(t3) - d6*sind(t1 + t2)*cosd(t3)*cosd(t5) - d6*cosd(t1 +
t2)*cosd(t3)*cosd(t4)*sind(t5) + d6*sind(t1 + t2)*cosd(t4)*sind(t3)*sind(t5);
py=a2*sind(t1 + t2) + a1*sind(t1) + d4*cosd(t1 + t2 + t3) + d6*cosd(t1 +
t2)*cosd(t3)*cosd(t5) - d6*sind(t1 + t2)*cosd(t5)*sind(t3) - d6*cosd(t1 +
t2)*cosd(t4)*sind(t3)*sind(t5) - d6*sind(t1 + t2)*cosd(t3)*cosd(t4)*sind(t5); pz=d1
+ d6*sind(t4)*sind(t5);
% nx
% ny
% nz
% ox
% oy
% oz
% ax
% ay
% az
%xuat ket qua cho edit4/5/6
set(handles.edit7,'string',num2str(px));
set(handles.edit8,'string',num2str(py));
set(handles.edit9,'string',num2str(pz));
%xuat ket qua cho slider4/5/6 set(handles.slider7,'value',px);
set(handles.slider8,'value',py); set(handles.slider9,'value',pz);
%chay mo phong ben simulink
%set_param('robot_RRR', 'SimulationCommand', 'stop');
%set_param('robot_RRR', 'SimulationCommand', 'update');
set_param('AR3', 'SimulationCommand', 'start');

% --- Executes on button press in CloseBtn. function


CloseBtn_Callback(hObject, eventdata, handles)
% hObject handle to CloseBtn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close;

% --- Executes on button press in InverBtn. function


InverBtn_Callback(hObject, eventdata, handles)
% hObject handle to InverBtn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
d1 = 168.05; d4
= 215; d6 =
36.4; a1=68.59;
a2=305;
%lay cac gia tri dau vao nx,ny,nz,ox,oy,oz,ax,ay,az,px,py,pz px
= str2double(get(handles.edit7,'string')); py =
str2double(get(handles.edit8,'string')); pz =
str2double(get(handles.edit9,'string')); nx =
str2double(get(handles.edit10,'string')); ny =
str2double(get(handles.edit11,'string')); nz =
str2double(get(handles.edit12,'string')); ox =
str2double(get(handles.edit20,'string')); oy =
str2double(get(handles.edit21,'string')); oz =
str2double(get(handles.edit22,'string')); ax =
str2double(get(handles.edit30,'string')); ay =
str2double(get(handles.edit31,'string')); az =
str2double(get(handles.edit32,'string'));

%w la he toa do khop co tay


wx=px-d6*ax; wy=py-d6*ay;
wz=pz-d6*az; if
(wx>0&&wy>0)||
(wx>0&&wy<0)
t1=atan2d(wy,wx); elseif
wx<0&&wy>0
t1=180+atan2d(wy,wx); else
t1=-180+atan2d(wy,wx); end if
t1>170 t1=170; elseif t1<-170
t1=-170; end

%xac dinh goc theta 3 s=wz-d1;


r=sqrt(wx^2+wy^2);
c=sqrt(s^2+r^2); D=-(c^2-a2^2-
d4^2)/(2*a2*d4); disp(['D: ',
num2str(D)]); %
t3=atan2d(sqrt(1-D^2),D);
t3=acosd(D);

%xac dinh goc theta 2 beta=atan2d(s,r);


gamma=atan2d((d4*sind(t3))/c,(d4^2-c^2-a2^2)/(2*c*a2)); t2=beta-
gamma;

%xac dinh goc theta 4


t4=atan2d(-az,ax*cosd(t1+t2+t3)+ay*sind(t1 + t2 + t3));
%xac dinh goc theta 6
t6=atan2d(-oy*cosd(t1+t2+t3)+ox*sind(t1 + t2 + t3),ny*cosd(t1+t2+t3)-
nx*sind(t1 + t2 + t3));

%xac dinh goc theta 5


c5 = ay*cosd(t1+t2+t3)-ax*sind(t1+t2+t3); s5 =
(ny*cosd(t1+t2+t3) - nx*sind(t1+t2+t3))/cosd(t6);
t5=atan2d(s5,c5); if t5<0 t4=t4+180; end if t2 <-132
t2=132 elseif t2>0 t2=0 end if t3 <0 t3=0 elseif
t3>142 t3=142 end if t4 <-165 t4=165 elseif
t4>165 t4=165 end

%xuat gia tri cho edit1/2/3/4/5/6 set(handles.edit1,'string',num2str(t1));


set(handles.edit2,'string',num2str(t2));
set(handles.edit3,'string',num2str(t3));
set(handles.edit4,'string',num2str(t4));
set(handles.edit5,'string',num2str(t5));
set(handles.edit6,'string',num2str(t6));
%goi lai ham edit1/2/3/4/5/6
edit1_Callback(@edit1_Callback, eventdata, handles);
edit2_Callback(@edit2_Callback, eventdata, handles);
edit3_Callback(@edit3_Callback, eventdata, handles);
edit4_Callback(@edit4_Callback, eventdata, handles);
edit5_Callback(@edit5_Callback, eventdata, handles);
edit6_Callback(@edit6_Callback, eventdata, handles);
%xuat gia tri cho cac block gain ben simulink
set_param('AR3/Slider Gain','Gain',num2str(t1));
set_param('AR3/Slider Gain1','Gain',num2str(t2));
set_param('AR3/Slider Gain2','Gain',num2str(t3));
set_param('AR3/Slider Gain3','Gain',num2str(t4));
set_param('AR3/Slider Gain4','Gain',num2str(t5));
set_param('AR3/Slider Gain5','Gain',num2str(t6));
%mo phong simulink
set_param('AR3', 'SimulationCommand', 'start');

% --- Executes on slider movement. function


slider7_Callback(hObject, eventdata, handles)
% hObject handle to slider7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider a =
get(hObject,'value');%lay gia tr? slider1
set(handles.edit7,'string',num2str(a));%xuat gia tri
cho edit1

% --- Executes on slider movement. function


slider7_Callback(hObject, eventdata, handles)
% hObject handle to slider7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider a =
get(hObject,'value');%lay gia tr? slider1
set(handles.edit7,'string',num2str(a));%xuat gia tri cho edit1
% --- Executes during object creation, after setting all properties. function
slider7_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background. if
isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]); end

function edit7_Callback(hObject, eventdata, handles)


% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of
MATLAB % handles structure with handles and user data (see
GUIDATA)
% Hints: get(hObject,'String') returns contents of edit7 as text
% str2double(get(hObject,'String')) returns contents of edit7 as a double
a=get(handles.edit7,'string');%lay gia tri tu edit1
set(handles.slider7,'value',str2num(a));%xuat gia tri cho slider1
% --- Executes during object creation, after setting all properties. function
edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end

% --- Executes on slider movement. function


slider8_Callback(hObject, eventdata, handles)
% hObject handle to slider8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider


% get(hObject,'Min') and get(hObject,'Max') to determine range of slider a =
get(hObject,'value');%lay gia tr? slider1
set(handles.edit8,'string',num2str(a));%xuat gia tri cho edit1

% --- Executes during object creation, after setting all properties. function
slider8_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]); end

function edit8_Callback(hObject, eventdata, handles)


% hObject handle to edit8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit8 as text
% str2double(get(hObject,'String')) returns contents of edit8 as a double
a=get(handles.edit8,'string');%lay gia tri tu edit1
set(handles.slider8,'value',str2num(a));%xuat gia tri cho slider1

% --- Executes during object creation, after setting all properties. function
edit8_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER. if ispc &&
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end

% --- Executes on slider movement. function


slider9_Callback(hObject, eventdata, handles)
% hObject handle to slider9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider


% get(hObject,'Min') and get(hObject,'Max') to determine range of slider a =
get(hObject,'value');%lay gia tr? slider1
set(handles.edit9,'string',num2str(a));%xuat gia tri cho edit1
% --- Executes during object creation, after setting all properties. function
slider9_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background. if
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]); end

function edit9_Callback(hObject, eventdata, handles)


% hObject handle to edit9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit9 as text
% str2double(get(hObject,'String')) returns contents of edit9 as a double
a=get(handles.edit9,'string');%lay gia tri tu edit1
set(handles.slider9,'value',str2num(a));%xuat gia tri cho slider1

% --- Executes during object creation, after setting all properties. function
edit9_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER. if ispc &&
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end

% --- Executes on slider movement.


function slider1_Callback(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider


% get(hObject,'Min') and get(hObject,'Max') to determine range of slider a =
get(hObject,'value');%lay gia tr? slider1
set(handles.edit1,'string',num2str(a));%xuat gia tri cho edit1
ForwardBtn_Callback(hObject, eventdata, handles);

% --- Executes during object creation, after setting all properties. function
slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background. if
isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]); end

function edit1_Callback(hObject, eventdata, handles)


% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
a=get(handles.edit1,'string');%lay gia tri tu edit1
set(handles.slider1,'value',str2num(a));%xuat gia tri cho slider1

% --- Executes during object creation, after setting all properties. function
edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER. if ispc &&
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end

% --- Executes on slider movement. function


slider2_Callback(hObject, eventdata, handles)
% hObject handle to slider2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider


% get(hObject,'Min') and get(hObject,'Max') to determine range of slider a =
get(hObject,'value');%lay gia tr? slider1
set(handles.edit2,'string',num2str(a));%xuat gia tri cho edit2

% --- Executes during object creation, after setting all properties. function
slider2_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background. if
isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]); end

function edit2_Callback(hObject, eventdata, handles)


% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
a=get(handles.edit2,'string');%lay gia tri tu edit1
set(handles.slider2,'value',str2num(a));%xuat gia tri cho slider1

% --- Executes during object creation, after setting all properties. function
edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER. if ispc &&
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end

% --- Executes on slider movement. function


slider3_Callback(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider a =
get(hObject,'value');%lay gia tr? slider1
set(handles.edit3,'string',num2str(a));%xuat gia tri cho edit1

% --- Executes during object creation, after setting all properties. function
slider3_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]); end

function edit3_Callback(hObject, eventdata, handles)


% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit3 as text
% str2double(get(hObject,'String')) returns contents of edit3 as a double
a=get(handles.edit3,'string');%lay gia tri tu edit1
set(handles.slider3,'value',str2num(a));%xuat gia tri cho slider1

% --- Executes during object creation, after setting all properties.


function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER. if ispc &&
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end

% --- Executes on slider movement. function


slider5_Callback(hObject, eventdata, handles)
% hObject handle to slider5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider


% get(hObject,'Min') and get(hObject,'Max') to determine range of slider a =
get(hObject,'value');%lay gia tr? slider1
set(handles.edit5,'string',num2str(a));%xuat gia tri cho edit1

% --- Executes during object creation, after setting all properties.


function slider5_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background. if
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]); end

function edit5_Callback(hObject, eventdata, handles)


% hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit5 as text
% str2double(get(hObject,'String')) returns contents of edit5 as a double
a=get(handles.edit5,'string');%lay gia tri tu edit1
set(handles.slider5,'value',str2num(a));%xuat gia tri cho slider1

% --- Executes during object creation, after setting all properties. function
edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER. if ispc &&
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end
% --- Executes on slider movement. function
slider4_Callback(hObject, eventdata, handles)
% hObject handle to slider4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider


% get(hObject,'Min') and get(hObject,'Max') to determine range of slider a =
get(hObject,'value');%lay gia tr? slider1
set(handles.edit4,'string',num2str(a));%xuat gia tri cho edit1

% --- Executes during object creation, after setting all properties. function
slider4_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]); end

function edit4_Callback(hObject, eventdata, handles)


% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
a=get(handles.edit4,'string');%lay gia tri tu edit1
set(handles.slider4,'value',str2num(a));%xuat gia tri cho slider1

% --- Executes during object creation, after setting all properties. function
edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end

% --- Executes on slider movement. function


slider6_Callback(hObject, eventdata, handles)
% hObject handle to slider6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider


% get(hObject,'Min') and get(hObject,'Max') to determine range of slider a =
get(hObject,'value');%lay gia tr? slider1
set(handles.edit6,'string',num2str(a));%xuat gia tri cho edit1

% --- Executes during object creation, after setting all properties. function
slider6_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background. if
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]); end

function edit6_Callback(hObject, eventdata, handles)


% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit6 as text
% str2double(get(hObject,'String')) returns contents of edit6 as a double
a=get(handles.edit6,'string');%lay gia tri tu edit1
set(handles.slider6,'value',str2num(a));%xuat gia tri cho slider1

% --- Executes during object creation, after setting all properties. function
edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER. if ispc &&
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end
% --- Executes on button press in RunBtn. function
RunBtn_Callback(hObject, eventdata, handles)
% hObject handle to RunBtn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
ModelName = 'AR3';

% Opens the Simulink model


open_system(ModelName);
%set_param(ModelName,'BlockReduction','off');
%set_param(ModelName,'StopTime','5s');
%set_param(ModelName,'simulationMode','normal'); set_param(ModelName,
'SimulationCommand', 'start');

function edit10_Callback(hObject, eventdata, handles)


% hObject handle to edit10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit10 as text
% str2double(get(hObject,'String')) returns contents of edit10 as a double

% --- Executes during object creation, after setting all properties.


function edit10_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER. if ispc &&
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit11_Callback(hObject, eventdata, handles)
% hObject handle to edit11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit11 as text
% str2double(get(hObject,'String')) returns contents of edit11 as a double

% --- Executes during object creation, after setting all properties. function
edit11_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER. if ispc &&
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end

function edit12_Callback(hObject, eventdata, handles)


% hObject handle to edit12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit12 as text
% str2double(get(hObject,'String')) returns contents of edit12 as a double

% --- Executes during object creation, after setting all properties. function
edit12_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end

function edit20_Callback(hObject, eventdata, handles)


% hObject handle to edit20 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit20 as text
% str2double(get(hObject,'String')) returns contents of edit20 as a double

% --- Executes during object creation, after setting all properties. function
edit20_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit20 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER. if ispc &&
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end

function edit21_Callback(hObject, eventdata, handles)


% hObject handle to edit21 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit21 as text
% str2double(get(hObject,'String')) returns contents of edit21 as a double

% --- Executes during object creation, after setting all properties. function
edit21_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit21 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER. if ispc &&
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end
function edit22_Callback(hObject, eventdata, handles)
% hObject handle to edit22 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit22 as text
% str2double(get(hObject,'String')) returns contents of edit22 as a double % ---
Executes during object creation, after setting all properties. function
edit22_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit22 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER. if ispc &&
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end

function edit30_Callback(hObject, eventdata, handles)


% hObject handle to edit30 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit30 as text
% str2double(get(hObject,'String')) returns contents of edit30 as a double

% --- Executes during object creation, after setting all properties. function
edit30_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit30 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER. if ispc &&
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end

function edit31_Callback(hObject, eventdata, handles)


% hObject handle to edit31 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit31 as text
% str2double(get(hObject,'String')) returns contents of edit31 as a double
% --- Executes during object creation, after setting all properties. function
edit31_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit31 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER. if ispc &&
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end

function edit32_Callback(hObject, eventdata, handles)


% hObject handle to edit32 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit32 as text
% str2double(get(hObject,'String')) returns contents of edit32 as a double

% --- Executes during object creation, after setting all properties. function
edit32_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit32 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER. if ispc &&
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end
1.2. Vẽ thêm các bộ phận đầu hàn
và thiết bị đùn thiếc MK8
REFERENCE
Chapter 1
(1): https://www.hakko.com/english/products/hakko_hu100_hu101.html
(2): https://xtronicusa.com/X-Tronic-7040-PRO-X-%E2%80%A2-775-Watt
%E2%80%A2-Small-Footprint-Hot-Air-Rework-&-Soldering-Iron-Station
%E2%80%A2-Digital-Temp-Controls-C-F-Conversion-Calibration-Func-0-
30Min-Sleep-Auto-Cool-Down-Mute-Unmute-Sound-p459714619

Chapter 2
(3): https://www.pcbdepanelingrouter.com/sale-13724141-300w-high-
volumedesktop-soldering-robot-for-led-pcb-welding.html
(4): https://www.flumasys.com/products/fluid-management/automated-
dispensingsystems/janome-dispensing-systems-en/jr3204-2.html
(5):
https://temas.vn/filemanage/S%E1%BA%A3n%20ph%E1%BA%A9m/H%C3%A
3ng%20s%E1%BA%A3n%20ph%E1%BA%A9m/Temas/Catalog/Robot%20han/
TM-Soldering%20Solutions-V2-201007%20(compact%20size).pdf
(6):
https://www.flumasys.com/wpcontent/uploads/2021/09/Janome_JR3000_Series_C
atalogue.pdf

You might also like