Voluntary
Project
SyArm Mk1
A simple robotic arm
By
Samuel Nösslböck
Started
April 2022
At this point I want to personally express my
thanks to all people who made this thing possible. Due to a lot of time and
effort having been done in school, I want to thank all teachers who actively
supported me or did not force me to fully participate in their lessons.
Special thanks belong to my machine elements teacher
Mr. Dipl.-Ing. Manuel Leibetseder, Mr. Dipl.-Ing. Gottfried Preuer and Mr.
Dipl.-Ing. Peter Rachinger. First one mentioned even answered calls on the
weekend, even though he had more important things to take care about. He always
had helpful advice for most of my problems.
Furthermore, I want to mention my incredible
friends, as they always listen to my personal problems which arise during such
a project. Some of them even tried to listen to some details and always showed
interest.
Again, I want to point out a few people: First
Tobias Niedermayr, a very talented young man who is way smarter he wants to
admit he is. He always showed a high interest in my projects and gave me the
motivation to continue when mine was more than low.
Second there is my best friend Fabio Muratore.
He just knows how to make me laugh, have a good time and really get my head out
of my projects from time to time, which is a very important thing as I have learned
in the process.
When working on a voluntary project, motivation
is the key for progress. Problem is, such motivation is not always easy to keep
up all the time. Therefore, special thanks belong to Samuel Klancnik, a
brilliant and very creative artist who inspired me in the way he does his
things and who also cared very much about me. He has become a very special
person to this project and me in the process.
Finally, my dear friend Rene Schwarz, my classmate.
He is the one who always cheers me up and who makes school much more bearable. I
have the honour to work on a project with him in the near future, which makes
use of his great abilities with AI.
Many
manufacturing tasks require a series of complex work or transport processes, for
which it can be difficult to build a machine for. Robotic arms are very
flexible types of robots which can perform a lot of those complex tasks and can
be re-programmed for every new application needed.
The SyArm
is a simple and compact version of such a robot, not built for heavy loads or
accuracy. Its materials are cheap, simple and were mainly chosen by the factor
of how easy it is to acquire them.
The whole
project can be seen as a kind of learning process, that is the reason why you
will find version numbers of three and above. Many of the hand-drawn sketches
have very early concepts drawn onto them.
This
project description focuses a lot on the theoretical aspects, especially of the
software, that have been worked out in the process. Therefore, a lot of
formulas and other can be found in the following pages.
Contents
3.1.1. Stepper motor connections
3.1.2. Raspberry PI connection
4.1.2. Incremental measurement
6.2. Articles and other self-made
references
7. Sources, references, and figures
Robots
always fascinated me in many ways: The way they are built, the way the software
is made or simply the enormous tasks they can complete nowadays.
I
personally believe automation and especially robots are one of the most
effective ways to fight poverty. When used right, they can get people out of jobs
with miserable working conditions and accelerate technical development
especially in low-wage countries.
Building
this robot was kind of a first step towards helping people with the field of
research I love.
The goal is
to build a fully functional robotic arm (see section “Construction”) that can
equip multiple different tools for tasks like drawing, lifting things around
and so on. Other things a high value was put on are the stability against oscillations
that will cause an inaccuracy in all movements and paths.
Flexibility
is the overall term this construction was designed for, in terms of hardware
and software as well. The software has been packed into libraries and separated
from this specific robot as much as possible, so it can be used of other types
of robots too.
The naming
and versioning system with “Mk X” makes it easy to differentiate complete
reworks of the same idea from each other with its basic principle being the
same as for other versioning systems.
Version: X.Y.Z => Mk X, Version Y.Z
The GitHub
repository contains all data used for this project. Notice that the software
projects have been included as submodules, for further information, read the
“Appendix” section.
Figure 2.0.0.1 |
The entire
construction is separated into five main parts listed in the following
chapters.
Figure 2.1.0.1 |
The base is
the most important part of the construction when it comes to stability. Small inaccuracies
in the bearings can lead to huge oscillations and imprecisions. To combat this,
the base uses a combination of two bearings to grant stability even when the
arm reaches far out. Between these two bearings, a worm gear transmits the
rotation and torque created by the motor. Though to the high transmission
ratio, a high accuracy in angles can be accessed.
Figure 2.2.0.1 |
The arm
consists of two segments connected by a cylinder, which determine the distance
the robot can reach out together. The first segment is the lower one on the
picture above, the second segment the upper one it is connected to.
The
cylinder connecting these two segments is often referred to as “second
cylinder” as the “first cylinder” connects the base and the arm with the
aluminium segment on the far left, which is attached to the first segment.
Figure 2.2.1.1 |
The first
segment is connected to the Base with a pin and a cylinder, allowing the
controls to adjust the angle. Both segments use the same type of 3D-printed
connector. As the friction is low and the robot produces high torques at the
pins, no additional lube must be used to guarantee correct functionality.
Furthermore,
both segments use the same base frame built up of aluminium segments, called
“Simple Frame”.
Figure 2.2.2.1 |
The second
segment is equipped with the motor in order to control the last axis and mount
for the second cylinder, as shown on the right.
It
consists, just like the first segment, of a “Simple Frame” with four 3D-printed
connectors on the edges. The mount for the last stepper motor is mounted onto
one of them, as shown in the picture above.
Figure 2.2.2.2. |
The tool
joint is the last axis, which theoretically would not be required, yet it
allows the robot to pick up objects from a desired angle. The flange at the end
has multiple threaded holes, where many different tools can be mounted.
Figure 2.3.0.1
Figure 2.5.0.1
Figure 2.6.0.1
The cylinders used for the
robot consist of a few simple parts: A static part, where the stepper motor is
mounted, a moveable part where all the rods are passed through. Two rods and a
spindle, with the latter being mounted to the motor through a jaw coupling, to
compensate assembly inaccuracies.
The two
rods guarantee a consistent and stable extension of the cylinder, while the
spindle is between them, extending or shortening the cylinder.
The simple
frame is made from four aluminium segments, that create a stable base for the
arm segments.
As all
stepper motors used are bipolar ones with two coils, four wires need to be managed
for each motor. The cables are attached to plugs that can be easily
disconnected if required for transportation. Each stepper motor is connected to
its own stepper controller, turning the four wires, which commonly would need
to be supplied with voltage in different cycles to get different directions and
movements, into two, that can both be controlled with simple low voltage logical
signals. With the first one requiring pulses, one for each step to be taken,
and the other being a directional switch.
Figure 3.1.2.1
The Raspberry PI controlling
the robot is also connected to the controls with a few plugs, enabling easy
repairs and reconfiguration. All the GPIO pins are defined as constants that
can be modified in the setup process. Thus, if any other pin layout is desired,
one can change it easily.
The
different types of pins are always grouped together to one single plug, for
example all the directional control pins, the step pulse pins, and the input
switches are each grouped to their own plug.
The
controls use two different power supplies, one capable of producing up to 42
Volts - used for the movements - and high-energy tools the producing 3.3, 5 and
12 Volts - all being used by the controls and again voltage supplies for the
tools.
Ignoring
the power required by the tool, the maximum power consumption is calculated as
following
With
As the
SyArm is a considerably basic prototype of a robotic arm, a simple method of
measurement is used. When measuring, the control drives the motors into the
negative direction until they close a switch connected to the Raspberry PI. The
motors then immediately stop driving and set the minimum endpoint at the
current direction.
As the
robot only uses stepper motors for positioning, no additional measurements are
required, though they would be useful in assuring the correct positioning of
the robot. If any movement of the segments that is not caused by the controls
occurs, then the robot must be remeasured again.
Each input
is connected to the raspberry with a pull-down resistor and equipped with a
status LED that lightens up once closed.
Therefore,
a plug has been designed that can supply many different types of tools and
applications in use. If more complex measurements or other sensor data is required,
the connection must be made manually.
For example,
take a pencil tool for drawing figures onto paper, the tool itself would not
require any additional motors, but rather a kind of switch that can recognise
how far the pencil is above the ground. The easiest approach would be to just
mount a switch parallel onto the same plane as the pencil points to.
The sensor can now be connected to the input pin of the plug, enabling the
input to be read by the controls.
Figure 3.3.0.1
Figure 3.3.0.2
The movements of the robot can
be divided into different layers and kinds:
Figure
4.1.1.1
This flowchart
depicts the general library structure, which features the shown actions and
movements that get more and more complex the farther one goes to the bottom.
Each action will now be described in detail.
A single
step with a single motor, defined by the steptime
The
direction is changed by inverting the directional pin of the control, not by
modifying the step pulse itself.
Figure 4.1.1.2 |
Multiple
steps (with curves)
Moves a
stepper motor multiple steps into the defined direction with proper
acceleration and deceleration considering the inertia of the construction and
motor torque. A full explanation of acceleration curves and different methods
can be found in the appendix[1].
The two
relevant functions are then defining a series, which look like the following:
The motors
accelerate until the certain speed is reached or half the steps are travelled,
after this distance, the control will mirror the curve at half the steps
travelled.
Consistent
drive (Used for cylinders or geared joints)
The
consistent drive mode converts an angle into the right direction and steps that
need to be travelled, using a predefined gear ratio or spindle pitch.
Figure 4.1.1.3
Inconsistent
drive (Used for “cylinder triangles”)
The
inconsistent drive is used to keep a certain omega up when a cylinder is built
in a triangular construction like the one displayed on the right. The law of
cosines gives an angle or the cylinder length if either one of the variables is
given.
Considering
the change in the cylinder extent is non-linear proportional to the angle
When now a
constant angular velocity is desired, the angular acceleration ends up at zero,
which makes the second derivative simpler.
With the
formular displayed above the velocity correction of the cylinder can be
calculated, which leads to a consistent angular velocity.
Moving
to a specific angle (with or without constant speed)
The certain
movements are then made by taking the current position
The robot
should always know it’s exact position, which is why a combination of stepper motors,
and an initial incremental measurement system are used. When running this
measurement operation, the motors move into the defined direction until the
controls recognize a HIGH signal on the defined measurement input pin (one for
each motor). The positional value is then set to another predefined value, the
initial position value.
Additionally,
the controls set a limit in the direction on the initial position value, as it
would overextend and damage the construction.
Moving only
one motor at a time results in an unbearably low efficiency, which quickly
leads to the concept of asynchronous movements.
To perform such
movements, the control must be structured very differently than when normal
synchronous ones are used. To understand the following descriptions in full
detail, it is recommended to first read the part of the language documentations
of rust dealing with their approach on sharing memory safely between threads.
The control
creates a thread for each motor attached to the controls running in the background
and equipped with a channel to transfer data with the main thread. If the
thread receives a message with the data required for the movement, it will wake
up and perform this movement.
Figure 4.1.3.1
If the thread receives a
message without data in it, a Rust “None”-value of an option, it will break the
loop and kill itself without sending a message back to the main thread.
The main
driver class is stored in a so called mutex, a structure that prevents multiple
processes from writing to the same block of data at the same, which could cause
memory safety issues. The mutex forces each process to first put a lock on the
structure, preventing all other instances to write to the locked data until
said process is not in need of the mutable access anymore, dropping the data
and the lock afterwards.
The library
provides a protection against force overloads and movements out of the allowed
range of a component, which can be set at any time. Before the robot executes
any movements, it will check for said cases and inform the user that an invalid
move would be executed.
Every
motor, every gear and every cylinder are categorized as a Component in
the stepper library. Components can consist of a motor and a kind of mechanical
structure that transforms the movement. The only condition is that only one
motor is in use, if multiple motors are required, as it is the case in most
robots, a Component-Group has to be used. It makes coordinating and
storing data of multiple motors easier. The stepper library includes some of
the basic components like a geared bearing, a cylinder and so on. When
requiring more complex components, simply create a new structure and implement
the SyncComp provided by the crate.
The SyBot
Library is the main part of the controls. It manages all the motors using a
vector model of the robot. A clear overview of the mathematical procedures will
be provided and explained in the further sections.
The library
is, just like the stepper library, written in Rust using cargo as package
manager. The libraries, which have been used, can be seen either in the GitHub
repository or at the sources section.
The main
purpose of modelling is calculating loads and inertias to help the motor
calculate the right acceleration curves. If the model results in giving
incorrect values to the controls this could lead to motors moving too slow, not
in the right direction or not at all. On the other hand, it could lead to a low
efficiency due to the motors not using their full potential.
Figure 4.2.1.1
To keep
things simple, every part of the robot can be seen as a rod, represented by a
certain mass
Assuming
the robot is described as a sequence of rod segments, the position vector can
be calculated as following
Which
results in the inertia of that sequence for a coordinate
The inertia
matrix
Reduced
mass
As the
construction includes cylinders with a linear motion, the concept of a reduced
mass is used to calculate inertia for those linear motions.
Where
Load
forces
As the
robot should be able to carry around weights later, the mathematical model
should include forces and how they impact the robot, including its own weight. Every
segment is loaded with a certain force
Each vector
has got a position vector attached to it called
the two reaction forces can be calculated.
As now only
the joint force is left unknown, the second principal can be applied to get the
following equation.
Where the
first sum stands for all action forces onto the segment and the second sum for
all the reaction ones that are already known.
When now a
constant angular velocity is desired, the angular acceleration ends up at being
zero, which makes the second derivative simpler.
With the
formular displayed above the velocity correction of the cylinder can be
calculated, which leads to a consistent angular velocity.
Moving
to a specific X, Y and Z coordinate point
To move to
a specific position in space expressed by a X, Y and Z coordinate, the control must
convert such a point into angles for the motors to move to.
The base
angle
The base
angle is shifted by ninety degrees as the base arm is orientated along the
Y-axis to perform correct rotation operations around the X-axis. This base
angle can now be used to rotate the point onto the Y-Z plane.
Now the
decoration vector can be subtracted without applying the rotation matrix to it.
To finally simplify the point into a triangle that is fully defined, the base
vector must be subtracted from the rotated point
This point
now stands for the distance the first two arm segments must reach. Their exact
angles are calculated as following:
As displayed in the formula,
To retrieve
all the data required for the controls like component mass, allowed angle
ranges and speeds. All this information is packed into a single JSON-file, the JsonConf
(“.conf.json” file extension). The file is structured so that every robot
built into the framework can be defined and parsed by this file.
The file is
parsed into a Machine Configuration during runtime, if any of the syntax
or values are incorrect, the program will inform the user.
The robot
uses the common GCode standard to dynamically describe its movements. For this
robot, a GCode-interpreter binary is provided in the sybot library repository.
This interpreter can also handle files, examples are also provided in the
repository.
For each
command the interpreter returns a JSON-Value informing about the result or
success of the given instruction.
The library
also contains a HTTP Webserver equipped with multiple ways to gather
information or control the robot. The webserver is hosted as a public network
interface and port configured via an environment variable.
The easiest
way to control the robot is via the websocket interpreter interface, where
GCode can be streamed directly to the robot. Of course, there are other options
then the webserver for executing operations. The application has more
executables and commands that can help handle the different application fields
required in automation.
This robot
gives a lot of insight into basic robotics and showed me what concepts to keep
and which ones to improve upon. The versioning with “Mk 1”, has a purpose, as I
am planning to build improved versions with more stability and one or even two
more axes.
It is a
great experiment for testing and improving the control libraries in rust, a
programming language that I was not able to work in at the start of this
project. The language showed me its qualifications for serving high level
communication as hardware programming all in one. Unfortunately, its accuracy
ended up being not good enough for tasks like drawing.
Many of the
work done for this project, especially mentioned libraries, will be reused for
my next project that I am working on right now as I am writing this (diploma
project DrAI).
The whole
project can be found on a public GitHub repository, either search the name
(“SamuelNoesslboeck/SyArm_Mk1”) or the Link:
https://github.com/SamuelNoesslboeck/SyArm_Mk1
-
“A_SyArm_Mk1”,
Main draft
-
“A1_SimpleFrame”,
Frame draft
-
“A2_Cylinder_Mk2”,
Cylinder draft
-
“A4_S1_S2_FirstSegment_SecondSegment”,
Draft about arm segments
-
“Stepper
Motor”, Article about stepper motors, acceleration curves etc.
-
“SyArm
Positioning”, Article about positioning, conversions, and transformations
-
“SyArm
Mechanics”, Article about forces and loads acting upon the robot
-
See
“Sketches” subfolder
-
“SyArm_Mk1” – Main Repo
-
“Stepper Library” – Rust Library for controlling
stepper motors and components
-
“SyBot Library” – Rust Library for controlling
complex component groups and robots, includes many different ways for
communication
-
2.0.0.1:
SyArm-Robot top-down; From main draft
-
2.1.0.1:
Section of Base; From main draft
-
2.2.0.1:
Front view of Arm; From main draft
-
2.2.1.1:
Front view of first segment; From segments draft
-
2.2.2.1: Front view of second segment; From segments
draft
-
2.2.2.2:
Section of cylinder mount on the second segment; From main draft
-
2.3.0.1:
Front view of tool joint; From main draft
-
2.5.0.1:
Section of cylinder; From cylinder draft
-
2.6.0.1:
Top view of simple frame; From simple frame draft
-
3.1.2.1:
Section of JSON configuration file about Raspberry PI connection
-
3.3.0.1:
Section of JSON configuration file about tool data
-
3.3.0.2:
Example GCode; From pickup GCode script
-
4.1.1.1:
Types of movements in the stepper library
-
4.1.1.2:
Step pulse
-
4.1.1.3.
Triangle for cylinders
-
4.1.3.1:
Asynchronous process
-
4.2.1.1:
Example rotation