Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

MECHATRONICS SYSTEM DESIGN

PROJECT REPORT

WRITTEN BY:
Richard – 11201702011
Axel Christopher Nathaniel – 11201702003

LECTURER:
Maralo Sinaga Dipl. Ing
Dr. Ir. Prianggada Indra Tanaya, M.M.E.
CHAPTER 1
INTRODUCTION

1. Background
As students of mechatronics in IULI we have obtained the knowledge in
mechatronics field of study for example, statics and mechanics of material, electrical
engineering, algorithm and programming, and machine elements. In this course we are
using all of the knowledge that we have obtained and implement it on SCARA robot as a
project.

2. Purpose
The purpose of this project to fulfill the requirements of getting a score in
mechatronic system design course. This project also helps us to gain some experience in
designing a mechatronic system. The project aimed to help us review the lesson that we
have learned in previous semesters for the OFSE that we are going to have next year.

3. Limitation
There are multiple limitations in this project which we have to solve. All of these
limitations can be solved using the knowledge that we have obtained from the previous
semester. Some of the limitations are,

3.1. Fabricating the Parts


The parts have a lot of unique features that are hard to fabricate and almost
impossible to make it on the mill.

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
3.2. Tool Used
The tools we used are basic tools, so we did not have access to some
features like keyway and dividing plate. The 3D printer we used also have limited
print dimension which limit the dimension of our final product.

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
CHAPTER 2
LITERATURE REVIEW

1. Mechanical
1.1. Static
Statics analysis used to calculate the reaction force on the bearing and also
on various components when it does not experience any acceleration. Statics
analysis of the project was calculated using bending moment and sigma forces
equation.

1.2. Kinematics
Kinematic analysis used to calculate the motion of the S.C.A.R.A. on the X and Y
axis. To calculate this we are using forward and inverse kinematics.

Figure 1 - Two Bars Linkage.

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
1.2.1. Forward Kinematics

1.2.2. Inverse Kinematics

1.3. Torque
Torque is a force that can cause an object to rotate on an axis. The
equation used to find the minimum torque to find the specification of the stepper
motor.

1.4. Center of Mass


Centre of mass used to simplify some of the calculations by representing
multiple mass into single point of mass. Most of the work used is done in the

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
CAD software by applying the material density to the Parts or override the parts
mass properties.

1.5. Belt and Pulley


To move the second link we are planning to use timing belt and pulley. The
second joint is located far from the motor and we have to make it belt driven so we
can be able to move the second link. The length of the belt is determined by,

2. Electrical
2.1. Arduino Board
Arduino is an open source hardware used as a controller. Arduino board
has a microcontroller that we can program to do a specific task. Arduino board
also consist of components required to run the microcontroller like, oscillator,
voltage regulator, and downloader. In this project, we are using Arduino board as
a controller. The board we are using is Arduino Mega 2560. The specification of
Arduino mega are:
Microcontroller used : ATmega 2560
Digital I/O pins : 54 (15 PWM output)
Analog Input Pins : 16
Flash Memory : 256 KB (8KB used by bootloader)
Clock Speed : 16 MHz

2.2. Sensors
Sensor is a device used to change physical quantity to electrical quantity
like, voltage and current. The use of sensor of this project is to sense the

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
minimum and maximum working angle of the motor. In this case we are using
limit switches to set the home position and the limit the motor to the maximum
angle of the link. The limit switch we are using is reed switch and mechanical
limit switch.

2.3. Motor
There are various types of motor on the market like, DC motor, servos and
stepper motors. The motor we are going to use in this project is stepper motor.
The stepper motor comes with advantages and disadvantages. Some of the
advantages are high precision, easier to control and can be operated with open
loop system. But these come with disadvantages like, low torque and high cost.

2.4. Stepper Motor Driver


The stepper motor used in this project require a stepper motor driver.
Stepper motor driver’s job is to send pulses to the coils of the motor. The driver
itself comes with microstepping that can furthermore increase the motor accuracy
while decreasing the torque of the motor. In this project we are using the TB6600
stepper driver and the DRV8825 stepper driver.

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
CHAPTER 3
METHODOLOGY
1. Block Diagram

Figure 2 - Block Diagram.

The block diagram shows the electrical connection of the scara robot. The thicker line
shows the power connection and the lighter line shows the signal connection on the scara robot

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
2. Flow Chart

Figure 3 : Inverse Kinematics Flow Chart

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
This flowchart shows the calculation process in order to choose the line to be used
by the SCARA robot. First of all, we read the start position of the SCARA robot. After
that, we input the end position, angular velocity 1 for line a and angular velocity 2 for
line b. Then we calculate the starting angle of the SCARA robot with the given input.
Furthermore, end angle of line a and b is calculated, with line a and b having 2 lines each,
so there are 4 values, end angle of line 1a, 2a, 1b, and 2b. From the end angles, we can
find the angle difference (delta theta) between starting and end angle of line 1a, 2a, 1b,
2b. Then we calculate the time difference of line 1a, 2a, 1b, and 2b. The next step is to
add time difference 1a and 2a which equals to time difference of line a, and also add time
difference 1b and 2b that equals to time difference of line b. We then compare the values
of time difference line a and b, if line a has lesser time difference than line b, we choose
line a, vice versa.

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
Figure 4 : Moving the Motor Flow Chart

The flowchart above explains how the system works after the line to be used has been
chosen. First of all, after determining the line to be used, we count the number of steps of line 1

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
and 2 by dividing delta theta 1 and 2 with 1.8, because 1 step is 1.8 degree. After we get the
number of steps, we send input pulse to motor A, telling the desired position for the motor to go.
There is delay afterwards to pause the process for a short period of time. Then, we compare the
values of number of steps generated by the motor, if it is less than the number of steps desired,
input pulses will be continuously sent, but if is equal to the number of steps desired, the motor A
stops and proceed to the next step. Next, input pulses are sent to motor B. Like in motor A, delay
is also present here. After the delay we compare the values of number of steps generated by
motor with the number of steps desired, same as in motor A, input pulses will be continuously
sent if number of steps generated is less than number of steps desired. But if the number of steps
generated is equal to the number of steps desired, motor B stops and the system goes on to
standby.

3. Calculation
3.1. Statics
Link 2 Assembly

Figure 5 - Link 2 Assembly Static Diagram.

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
Link 2 Assembly

Figure 6 - Link 2 Assembly Static Diagram.

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
3.2. Torque
Motor 1

Motor 2

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
CHAPTER 4
RESULT AND DISCUSSION

1. Result
The result of this project is working as intended however it still have some issues
that need to be fixed in the future improvement. The robot was able to complete some of
the tasks like, Homing(initialization) and move to given coordinates. The purpose of this
robot is to move to different coordinates however, we are only able to move it to 1
coordinate at this time.

Figure 7 - S.C.A.R.A. Robot

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
Figure 8 - S.C.A.R.A. Control Box

2. Discussion
2.1. Accuracy and repeatability
The accuracy of the link should be the same as the stepper motor accuracy
which can be calculated by the stepper motor step angle and the microstepping
option. The formula are,

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
The accuracy of the motor is different for both links due to different
microstepping option used on the motor to achieve more torque on the motor.

The repeatability test was tested using counter while doing homing. From
the test we can see that the stepper motor experiencing step loose. The step loose
may be due to no acceleration control used in the program.

Figure 9 - Stepper Motor Step Loss Test.

The step loose may also be caused by the tension on the belt keep
untightening by itself.
On the other hand, the first link stepper motor is showing less step loss.
This is because of the use of bigger stepper motor and less microstepping on the

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
motor.
To further test the repeatability we need to use a dial indicator to see if the link
encounter a backlash.

2.2. Mechanical
The mechanical parts of the scara robot is performing very well. Some
parts of the scara robot parts are 3D printed, the only parts that are not 3d printed
are shaft, bearing and screws. There are some mechanical parts that are not yet
done, one of them are pen holder and linear actuator.
The first problem we encounter is that the bearings are not aligned
perfectly, causing the shaft to be tilted forward. On the second link, the thrust
bearing is not linked perfectly perpendicular to the surface, causing it to slightly
tilted forward.
The second problem is due to the use of flexible coupler on the first link.
Flexible coupler is usually used for misaligned the shafts. Due to the flexibility of
the coupler, the first link can move like a spring when stepper motor is on the
brake.

2.3. Programming
The programming of the scara robot cannot be performed as intended due
to shortage in time. For the programming part, we decided to use laurb9 stepper
driver library, because it is easier to use than accelstepper library. The only
downside of the laurb9 library is that it does not have acceleration control of the
stepper motor, which can cause overshoot and step loss on the motor.
The programming is divided into multiple functions. The first function is
the initialization, which sets the link into the center position. The second function
is the inverse and forward kinematics, to do the calculation required to process

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
given data such as coordinates to number of steps required for motor to move.
The last one is move to function. This function is used to move the first and
second link simultaneously with the given target coordinates that can be set on the
program.

2.4. Electronics
The Scara robot electronics is simple. All of the components are already bought in
modules and only need little soldering. The only soldering work is the pull down
resistor and DB25 connector. Unfortunately the DB25 cable cannot be used for
power connection such as stepper motor. The stepper motors we used require 12
V 3.2A power to run. The cable cannot handle this much power making it hot.

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
CHAPTER 5
CONCLUSION AND FUTURE IMPROVEMENTS

1. Conclusion
The final outcome of this project is working properly, with some improvements
can still be executed to upgrade the final product. There were a lot of obstacles, due to
some events occuring on the working period, causing some time wasted.
Although the mechanical part performs properly, there are still some errors that
should be fixed, simply by adjusting and changing some parts, such as fixed coupler.
On the electrical side, the wiring and the control box needs some tidying up to
improve the aesthetics and to make troubleshooting easier.
The programming of this SCARA robot can be improved by adding more features
and bug fixing. The scara programming is not fully completed yet, but if there is more
time, it can be completed.

2. Future Improvements
There are a lot of new features that can be implemented into the scara robot to
improve its performance, such as:
2.1. The use of TMC2130 stepper motor driver, this driver can be used to do obstacle
detection and even homing by using EMF voltage.
2.2. Changing the flexible coupler to fixed coupler to improve the first link rigidity.
2.3. Changing the second link shaft design to improve the alignment of the link.
2.4. Testing and Calibrating using a dial indicator.
2.5. Improve the cable management on the control box and adding a fan to cool the
stepper motor driver.
2.6. Changing the motor 2 bracket material to steel plate to act as a counterweight and
improve the strength of the bracket.

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
APPENDIX
Arduino Code

#include <DRV8825.h> 
#include <A4988.h> 
#include <math.h> 
 
//pin for the limit switch 
const int LS2_min = 2; 
const int LS2_max = 3; 
const int LS1_min = 6; 
const int LS1_max = 5; 
 
//position 
long int pos2; 
long int pos1; 
 
//minimum and maximum steps for the steppers 
long int L2_min; 
long int L2_max; 
long int L1_min; 
long int L1_max; 
 
//motor specification 
const int StepsPerRev = 200; 
const int microstep2 = 16; 
const int microstep1 = 8; 
 
const int L2_step = StepsPerRev * microstep2; 
const int L1_step = StepsPerRev * microstep1; 
 
//math variables 
double x; //in mm 
double y; //in mm 
double angle1_r; //in rad 
double angle2_r; //in rad 
double angle1_d; //in deg 
double angle2_d; //in deg 
long int step1; 
long int step2; 
const double L1 = 175.0; //length between shaft 1 to shaft 2in mm 
const double L2 = 150.0; //length between shaft 2 to "carriage" in mm 
 
DRV8825 stepper2(L2_step, 13, 12, 11); //N of steps, pul pin ,dir pin 
,ena pin 
A4988 stepper1(L1_step, 10, 9, 8); 
void setup() { 
// put your setup code here, to run once: 

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
stepper1.begin(5); //set the RPM of the motor1 
stepper2.begin(15); 
stepper1.setEnableActiveState(LOW); 
stepper2.setEnableActiveState(LOW); 
 
pinMode(LS2_min, INPUT); 
pinMode(LS2_max, INPUT); 
pinMode(LS1_min, INPUT); 
pinMode(LS1_max, INPUT); 
 
Serial.begin(9600); 

 
 
void initial() { 
stepper2.enable(); 
stepper1.enable(); 
while (digitalRead(LS2_min) == LOW) { 
stepper2.move(1); 
delay(2); 
if (digitalRead(LS2_min) == HIGH) { 
stepper2.stop(); 
pos2 = 0; 
break; 


int count2 = 0; 
while (digitalRead(LS2_max) == LOW) { 
count2 = count2 + 1; 
stepper2.move(-1); 
delay(2); 
if (digitalRead(LS2_max) == HIGH) { 
stepper2.stop(); 
L2_max = count2; 
break; 


stepper2.move(L2_max / 2); 
stepper2.stop(); 
delay(1000); 
 
while (digitalRead(LS1_min) == LOW) { 
stepper1.move(1); 
delay(5); 
if (digitalRead(LS2_min) == HIGH) { 
stepper1.stop(); 
pos1 = 0; 
break; 

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
int count1 = 0; 
while (digitalRead(LS1_max) == LOW) { 
count1 = count1 + 1; 
stepper1.move(-1); 
delay(5); 
if (digitalRead(LS1_max) == HIGH) { 
stepper2.stop(); 
L1_max = count1; 
break; 


stepper1.move(L1_max / 2); 
delay(2000); 
 
Serial.print("\n L1_Max= "); 
Serial.print(L1_max); 
Serial.print("\n L2_Max= "); 
Serial.print(L2_max); 

 
void inv_kinematics() { 
Serial.println("inv_kinematics"); 
 
angle2_r = acos(((pow(x, 2)) + (pow(y, 2)) - (pow(L1, 2)) - (pow(L2, 2))) / 
(2 * L1 * L2)); //arduino trigonometry works in rad 
angle1_r = (atan(y / x)) - (acos((((pow(x, 2))) + (pow(y, 2)) + (pow(L1, 2)) 
- (pow(L2, 2))) / (2 * L1 * (sqrt(pow(x, 2) + pow(y, 2)))))); 
 
angle2_d = (angle2_r / M_PI) * 180; 
//convert rad into deg 
angle1_d = (angle1_r / M_PI) * 180; 
 
step1 = (angle1_d * L1_step) / 360; //convert 
angle into steps 
step2 = (angle2_d * L2_step) / 360; 
Serial.print("\n angle1_r="); 
Serial.print(angle1_r); 
Serial.print("\n angle2_r="); 
Serial.print(angle2_r); 
Serial.print("\n angle1_d="); 
Serial.print(angle1_d); 
Serial.print("\n angle2_d="); 
Serial.print(angle2_d); 
Serial.print("\n step1="); 
Serial.print(step1); 
Serial.print("\n step2="); 
Serial.print(step2); 
Serial.print("\n"); 

 

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
void fwd_kinematics() { 
 
angle1_r = (angle1_d * M_PI) / 180; 
angle2_r = (angle2_d * M_PI) / 180; 
 
x = L1 * cos(angle1_r) + L2 * cos(angle1_r + (angle2_r)); 
y = L1 * sin(angle1_r) + L2 * sin(angle1_r + (angle2_r)); 

 
void linear_move() { 
stepper2.enable(); 
stepper1.enable(); 
inv_kinematics(); 
int mov_stepper1; 
if (step1 > step2) { 
mov_stepper1 = step1 / step2; 

if (step1 < step2) { 
mov_stepper1 = step2 / step1; 

Serial.println("linear_move"); 
Serial.println(mov_stepper1); 
for (int x = 0 ; x < step2 ; x++) { 
if (digitalRead(LS2_max) == HIGH) { 
stepper2.stop(); 

if (digitalRead(LS2_min) == HIGH) { 
stepper2.stop(); 

else { 
stepper2.move(2); 
delayMicroseconds(100); 

 
if (x % mov_stepper1) { 
if (digitalRead(LS1_min) == HIGH) { 
stepper1.stop(); 

if (digitalRead(LS2_max) == HIGH) { 
stepper1.stop(); 

else { 
stepper1.move(1); 
delay(5); 



stepper1.stop(); 
stepper2.stop(); 
Serial.println("linear_mov_Done"); 

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
 
 

 
void loop() { 
// Serial.print("L2_min"); 
// Serial.println(digitalRead(LS2_min)); 
// Serial.print("L2_max"); 
// Serial.println(digitalRead(LS2_max)); 
// Serial.print("L1_min"); 
// Serial.println(digitalRead(LS1_min)); 
// Serial.print("L1_max"); 
// Serial.println(digitalRead(LS1_max)); 
// delay(100); 
x = -150; 
y = 175; 
initial(); 
// linear_move(); 
delay(5000); 

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
REFERENCES

https://www.mcielectronics.cl/website_MCI/static/documents/TB6600_data_sheet.pdf
https://wiki.fysetc.com/TMC2130/
https://www.tomsonelectronics.com/blogs/news/arduino-mega-v3-specification

LM2596 Step down module


https://www.onsemi.com/pub/Collateral/LM2596-D.PDF
h​ttps://www.tokopedia.com/primaterang/lm2596-voltmeter-step-down-dc-dc-adju
stable-modul-penurun-tegangan-dc

Stepper Motor
https://www.aliexpress.com/item/High-torque-42-Stepper-Motor-2-PHASE-4-lea
d-Nema17-motor-42BYGH-59-5MM-2-3A/32798466987.html

DRV8825 Stepper Motor Driver


https://www.pololu.com/product/2133
http://www.ti.com/lit/ds/symlink/drv8825.pdf

Dual Stepper motor shield


https://www.tokopedia.com/3dp/double-output-driver-extension-shield

Arduino Mega 2560


https://store.arduino.cc/usa/mega-2560-r3

Arduino IDE
https://www.theengineeringprojects.com/2018/10/introduction-to-arduino-ide.htm
l

PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java
PO Box 150, BSD CPA 15330 IULI – Eco Campus, The Breeze
Tel. +62 852 12318000 Jl. BSD Grand Boulevard
info@iuli.ac.id BSD City 15345
www.iuli.ac.id Island of Java

You might also like