ECEL12-LAB#4 Angelada
ECEL12-LAB#4 Angelada
Robot control systems regulate and command the functions of the robot in order to achieve the desired
result. The robot itself is an autonomous machine that has 3 main parts which all work together in a
cohesive manner. The three main parts consist of the controller, the actuator, and the sensors. The
controller, which we just discussed, commands all the movements of the robot through a feedback
control system run through a computer program.
The actuators create mechanical movements with motors, pistons, wheels, and other such devices so that
the robot can turn, grab, and lift. Sensors give the robot environmental awareness and are an integral
part of how the robot relates to its surroundings. With sensors, the robot is fed information about the
size of different objects, shapes, and direction.
Control systems help to control the movements and functions of the robot. To understand the control
system first we need to understand some terminologies used in robotics.
Feedback
Control System
• State- output produce by a robotic system is known as a state. Normally we denote it by x, the
state depends on its previous states, stimulus (signals) applied to the actuators, and the physics
of the environment. The state can be anything pose, speed, velocity, angular velocity, force and
etc.
• Estimate- Robots cannot determine the exact state x, but they can estimate it using the sensors
attached to them. These estimations are denoted with i. It is the responsibility of the robotic
engineer to select good enough sensors or to calibrate the sensors well, such that they can
produce y ~ x.
• Control Signal- the stimulus produces/output by the controller is known as the control signal, it is
denoted using u.
• Dynamics- it is also called as the system plant/system model, it denotes how the system will
behave under non-static conditions. Dynamics are affected by the environment that may change
or not always linear. For example, floor type (concrete/wood), the air drag, slope and etc.
It is always the key responsibility of the engineer to build a controller, that reacts and produces control
signal u, such that e~0 & x~r.
Let me give you an example of the above discussed key terms. Assume you are building a self-driving robot.
You should have a cruise controller for your robot. Here,
• The voltage produce by your controller to increase or decrease the speed is your control signal
(u)
• The environmental characteristics like friction & air drag may affect the dynamics of the system.
You should consider them before you design the control system equations
Note: A robot can have one or more controllers for various purposes. For example one controller for cruise
control and another controller for controlling the linear motion of the robot hand, and one for rotation
movement of the hand and etc.
We need the controllers because the dynamics (system plant) vary with the time. Such as when the robot
moves up in a slope and then down in the slope, or first travels on smooth concrete, then on a carpeted floor.
So the best way to design a controller is by understanding the physics of the environment well. It will help to
list out the elements that needed to be considered in controller design.
Before I conclude let us see the desired characteristics of controllers. We have already seen the first
requirement,
1. The controller should reduce the error closer to zero, e~0, It should bring the estimation to the
reference, y~r
2. They need to be robust, they should not depend on things we don’t know. If there are any
changes in the robot’s environment they should be able to adapt to it.
In summary, we give a reference state to a controller. The controller also has sensor feedbacks, using the
reference state and sensor feedback controller generates control signal needed to reach the reference state.
This control signal is fed to the “System”. The system dynamics determine how the system behaves to this
control input. If the controller is good, hopefully, the “System” will reach our desired reference state.
Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino
boards are able to read inputs – light on a sensor, a finger on a button, or a Twitter message – and turn it
into an output – activating a motor, turning on an LED, publishing something online. You can tell your board
what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino
programming language (based on Wiring), and the Arduino Software (IDE), based on Processing.
Scilab Xcos
Xcos is a Scilab toolbox for modeling and simulation of dynamic (continuous and discrete) systems.
Although the main purpose is to simulate dynamic systems, Xcos can be used for signal generation, data
visualization or simple algebraic operations.
When dealing with systems with interconnected continuous-time and discrete-time components,
Xcos is the right tool for modeling and simulation.
Xcos provides a modular approach for complex system modeling, using a block diagram editor. Xcos
models are compiled and simulated in a single run. The resulting mathematical equations are integrated by
a numerical solver with configurable parameters.
II. Objectives
▪ To design a Model diagram for PID control system using the SCILAB XCOS to control the DC
motor via a PWM pin of the Arduino Uno Board.
▪ To know how to interface and establish serial communication between SCILAB XCOS and
Arduino
▪ To simulate the response of the system using SCILAB XCOS Via Arduino Board.
▪ To design a simple Model diagram using the SCILAB XCOS control system in real life
application.
Hardware/Virtual Components
Potentiometer
DC Motor
IV. Diagram
V. Procedure
In this laboratory experiment, we are tasked to design a Model diagram for PID control system using the
SCILAB XCOS to control the DC motor via a PWM pin of the Arduino Uno Board. The control of the DC
motor must be of the following:
a. The DC motor speed will be controlled using a Pulse Width Modulation (PWM) techniques.
b. The DC motor movement will base on the PWM and dependent on the PID controller, the Kp, Ki
and Kd will be set by the potentiometer connected to the analog inputs of the Arduino board.
Before we can start the simulation, we have few steps to do first in order to set-up the serial
communication between the two simulation software that we’re going to use. Since it is for our
own convenience, were going to use Arduino and Scilab. We need to connect the Arduino and
the Picsimlab in the Serial Ports for their virtual connection, just like what were done in the
previous experiments. Just like in the laboratory experiment no.3, we can use the potentiometer
and DC motor connection for this experiment.
The libraries “I2cDev.h” and MPU6050.h” must be included in the Arduino IDE. Next, the
“Toolbar_Arduino_v5.ino” must be opened in the Arduino IDE, we must save it as a hex file and
after that we can use that to simulate in the Picsimlab later on.
After the Arduino and Scilab have been set-up, move on to opening the Scilab Xcos, construct the
block diagram that will correspond to what is required in this experiment. Be sure also to have
the needed toolbox or the atoms in your Scilab is already have the needed components.
If we know that all has been set, we can now simulate to get the response of the system.
VI. Results and Discussions
15% Duty Cycle
25% Duty Cycle
Discussion:
So, as can be seen in the given results above based on the varrying percentage of the duty cycle it shows
that at certain amount of time the DC Motor completes its rotation. It also determines the speed of the
rotaion if it takes longer or shorter amount of time to complete its rotation. For the given figures it displays
graph when the DC motor still not completed its rotation, and the next is the response if the DC motor
already completed its rotation. Therefore, we can say that the time required for a DC Motor to complete
one full spin increases as the duty cycle is reduced. It demonstrates that the duty cycle we applied to the DC
motor has a direct relationship with its speed. Like if the duty cycle applied to the DC motor increases, there
is also an observable increase in the speed.
VII. Observations
The duty cycle raises the speed of the DC motor. The output speed of the DC Motor is higher when SCILAB
XCOS is used to regulate the speed rather than PWM. When the two methods of programming an Arduino
board to regulate motor speed were compared, it was observed that the code on the Arduino board
produced a different result.
VIII. Conclusions
Scilab Xcos can be much easier to use than manually coding in Arduino IDE. In Xcos we can directly obtain a
result by creating block diagram for the system. Although it may encounter lags and even trouble it can be
manageable as compared to consuming much time in creating a code. It can be perplexing though especially
if you don’t know the functions of the blocks or where to locate it, but through constant practice and
familiarization you can get around it in no time.
IX. Recommendations
After conducting this laboratory experiment, I recommend that further understanding of Arduino as well as
Scilab Toolbox and blocks characteristic is very important. With that said it will be much easier to construct
block diagram for any control system that you desire. Serial communication between your simulating
software is also a must, because it is where the successful simulation will base aside from making sure that
your construction is correct for the blocks. Mastering the art of using Arduino, Scilab Xcos and other
simulating software is a sure-fire tool in making successful projects especially in the field of feedback and
control system as well as robotics.
X. Design Applications
In this design application, we are using Arduino and Scilab Xcos with PID to control the motor
velocity.
XI. References
https://www.onlinerobotics.com/news-blog/introduction-robotic-control-systems
https://towardsdatascience.com/introduction-to-robotic-control-systems-9ec17c8ac24f