Controller
A controller serves as the brain of a mechatronics system, connecting various electrical and electronic devices to mechanical components and facilitating system operation. Its primary function is to interpret input instructions from external sources and generate the necessary outputs to activate corresponding actuators. To successfully execute the given instructions, additional elements work in conjunction with the controller, enabling the triggering of actuators and the successful completion of the controller's instructions. Depending on the system and tasks to be performed, controllers can take different forms. In simple mechanisms, the entire system is controlled using basic electrical elements, without a separate dedicated controller device. However, relatively complex mechanisms often employ a separate Microcontroller Unit (MCU) as the controller. This MCU may also be embedded within a small mechatronics device. In more complex mechatronics systems where multiple mechanisms are harmoniously coordinated within a single structure, advanced controllers such as CNC controllers, computers, or programmable logic controllers (PLCs) are utilized.
Simple control system
In
a modest mechatronics system, an uncomplicated control mechanism is assembled
using standard electrical elements such as relays and contactors. This system
operates based on the status of input devices and subsequently activates
actuators. A detailed discussion about this system will be provided later in
(Chapter- ) with an example.
Microcontroller Unit or MCU
A
Microcontroller Unit or MCU is a single integrated circuit utilized for
specific applications, automating device management. Various mechatronics
systems such as automobile engine control, washing machines, toys, cameras,
security systems, etc., frequently employ microcontroller units. Most MCUs are
battery-operated and require minimal power for operation. Inside a
microcontroller, you will find a small central processing unit (CPU), random
access memory (RAM), programmable read-only memory (ROM), and different input-output
ports (parallel and serial). Since a microcontroller unit is designed for a
specific function within a distinct system, its size is typically small, and
all the components are assembled within a single chip. Occasionally, a small
LCD or seven-segment display unit with a keypad is attached to the MCU for
information retrieval and direction input. The following picture displays a
simple microcontroller and its fundamental structure.
Multiple
microcontrollers are used for various applications in mechatronics systems, and
sometimes the same MCU can be used for two separate applications, requiring
different programming. Standard microcontrollers can be classified into the
following basic groups based on their fabrication and utilization:
Bit
size: MCUs are divided into three categories based on
their bit size - 8-bit, 16-bit, and 32-bit. An 8-bit microcontroller has an
8-bit data bus, while 16-bit and 32-bit microcontrollers have 16 and 32 data
lines, respectively.
Memory
capacity: Different memory modules such as RAM, ROM, EPROM,
EEPROM, and Flash Memory are used to store data and programs inside an MCU.
Some of these memory modules are embedded within the microcontroller, while
others are external. The capacity for storing data inside the memory also
varies among different MCUs.
Number
of input/output pins: Microcontrollers are categorized based
on the number of input or output pins connected to them. This refers to the
number of programmable pins or the number of input/output devices that can be
managed by an MCU.
Difference between microcontroller and
microprocessor
A microprocessor is typically used with general-purpose CPUs or computers, whereas a microcontroller itself functions as a mini-computer to control multiple devices. Unlike a microprocessor, a microcontroller includes memory devices, input/output ports, timers, and other components. A microprocessor requires additional digital components to operate, while a microcontroller functions as a standalone unit. Microprocessor-based devices are usually more complex and expensive, whereas devices operated with a microcontroller are simpler and less expensive. It is easier to program most of the pins of a microcontroller, whereas only a few pins of microprocessors can be controlled through programming. Additionally, the access time of a microprocessor is typically higher than that of a microcontroller. In summary, a microcontroller interacts directly with various sensors and attachments, whereas a microprocessor connects input/output devices through an internal bus connection that integrates multiple hardware components such as RAM and serial ports. For example, a desktop computer commonly uses a microprocessor, while a washing machine is controlled by a microcontroller.
Advantages
of microcontrollers include:
·
It
functions as a standalone micro-computer without the need for external digital
devices.
·
Mechatronics
systems coupled with an MCU are relatively easy to manage and maintain.
·
The
versatility of easily programmable MCU pins enables various practical
operations.
·
The
operating response time is relatively low.
·
Additional
memory devices and input/output modules can be easily connected to it.
·
Microcontrollers
are smaller in size and relatively cheaper.
Disadvantages of microcontrollers include:
·
The
structure of an MCU is more complex compared to a microprocessor.
·
Microcontrollers
are limited to specific purposes.
·
They
cannot directly connect to power devices.
· They are only suitable for use with small equipment.
How are microcontrollers programmed?
In earlier days, microcontroller units were programmed using 'Assembly language'. However, nowadays, various 'High-level' languages such as C or C++, Java, Oracle, etc., are also commonly used. One major advantage of using a high-level language is that it doesn't require extensive knowledge about the hardware inside the microcontroller. The program written in a high-level language is converted into a 'Hexadecimal format' using special software called a 'Compiler'. This hexadecimal format is readable by a microcontroller or MCU. Software tools like C Compiler and Code Editor are used to compile high-level language. Once the program is written in the hexadecimal format, it is transferred to the microcontroller and stored in the machine language instructions, which consist of 'Zeros' and 'Ones' inside the MCU's memory. The following picture illustrates the programming process of a microcontroller unit.
Advanced Mechatronics Controller
Advanced mechatronics controllers are used in
various types of robotic systems, CNC machines, and complex material handling
systems. These controllers can perform almost every task of a mechatronics
system and have the ability to store multiple programs in their memory. The
main advantage of using an advanced mechatronics controller over a
microcontroller is that it allows for easy programming of complex movements and
the addition of other devices or elements to the system. Advanced mechatronics
controllers operate primarily through two types of instructions: programming
stored inside the controller's memory and instructions from a control panel
directly connected to the controller. These controllers are typically designed
to work with two separate devices: a Programmable Logic Controller (PLC) and a
Servo Amplifier. The PLC may be embedded inside the controller or operate as a
separate unit externally. Servo drives or amplifiers provide significant
voltage to a Servo Motor for controlling various movements, such as axis
movements in CNC machines. The PLC and Servo drive mechanism together enables
complex movements and tasks in advanced mechatronics systems. Some mechatronics
systems use stepper motors instead of servo motors, and the movements of these
systems are controlled by a stepper motor driver unit. The following picture
presents the architecture of a typical advanced mechatronics system,
highlighting a controller, PLC, Servo amplifier, and servo motor.
Components build an advanced mechatronics
controller
Different companies offer controllers with varying
hardware configurations based on the requirements of the mechatronics system.
However, the basic working principles are similar. In some cases, a dedicated
controller is used specifically for a particular mechatronics system. Popular controller
manufacturers include SIEMENS, FANUC, MITSUBISHI, ABB, YASKAWA, HEIDENHAIN, and
REXROTH, among others. FANUC and SIEMENS are market leaders in the machinery
industry and have the highest sales of controllers. Depending on the design and
type of controller, PLCs, motor driver units, etc., can be integrated in a
common and enclosed arrangement or function as separate devices coordinated
with the controller from outside. The following is a list of accessories
incorporated into an advanced mechatronics system:
2. Servo control unit
3. Operator panel
4. Motor driver unit
5. Programmable logic controller (PLC)
1. Central Processing Unit (CPU)
The
central processing unit (CPU) is the controller's heart and brain. It controls
and supervises the entire mechatronics system and manages crucial program
information stored in the controller's memory. It decodes this information to
obtain signals for specific position and velocity settings, particularly for
axis movements. With complete control over the position and velocity of moving
elements, such as a machine axis, the CPU constantly compares them to the
programmed values. If a discrepancy occurs, the CPU takes immediate corrective
measures. It also performs basic security checks and initiates remedial actions
as necessary. In situations exceeding the CPU's capabilities, it decides to
shut down the machine or system.
2. Servo control unit
The
CPU generates signals for position and velocity control, which serve as input
command signals for the servo control unit. The servo control unit, in turn,
generates suitable signals for each movement command and directly sends them to
the servo drive or amplifier unit. The servo drive produces the voltage
required to rotate the servo motors. Additionally, the servo control unit
receives actual position signals from position feedback devices like encoders
or linear scales, which are integrated with the servo motors. The feedback
signal is then sent back to the CPU for further processing. Essentially, the
servo control unit facilitates dual communication between the moving elements
and the CPU through command and feedback. While the motor driver unit is
responsible for the actual movement of a device, the rate of movement depends
on the feedback system.
3. Operator panel
The operator
panel serves as a two-way communication system between the user and the
machine/system. It typically consists of two main components: a video display
unit and a keyboard. The video display unit provides real-time information and
displays the current status of the machine or system. The keyboard is used to
input different programs into the machine and select separate operating modes.
Occasionally, an operator panel may lack a video display unit. Below are pictures
of two operator panels frequently used with CNC machines in the machining
industry, manufactured by SIEMENS and FANUC.
A
motor driver unit is an essential component in a mechatronics system,
responsible for controlling various mechanisms. For controlled movements, two
types of motors are commonly used: stepper motors and servo motors. Stepper
motor driver units are employed for running stepper motors, while servo motors
are rotated using servo drives or amplifiers. To rotate a stepper motor, the
motor driver unit generates specific voltage pulses, which rotate the motor
shaft by a specific angle and provide the required torque. On the other hand, a
servo amplifier produces pulse-width modulated (PWM) voltage to rotate the servo
motor shaft. For a detailed explanation of the working principles of servo
motors and stepper motors, please refer to the "Actuator" chapter.
Below are pictures illustrating a stepper motor driver unit and a servo
amplifier.
5. Programmable Logic Controller or PLC
PLCs
are widely used in various advanced mechatronics systems, such as the machine
tool industry, elevators, process control, and traffic light control. PLCs are
typically designed by manufacturing companies with standard hardware, customizable
according to specific requirements. PLCs have replaced complex relay logic
circuits, offering greater versatility and easy programmability, making them
compatible with modern mechatronics systems. They also facilitate more flexible
circuit design changes. PLCs are usually embedded within advanced controllers
and cannot be distinguished independently from the outside. However, they can
also function as stand-alone units, coordinating with the controller when
operating as separate devices external to the controller. PLCs supervise and
sequence complex mechanisms based on the program written inside them. Further
details about PLCs are discussed in a separate part of this book. Below is a
picture of a stand-alone PLC coordinating with the controller.
Introduction of Arduino
Nowadays, Arduino boards are commonly used in various electronics projects and mechatronics systems. Arduino is a brand name for an open hardware advanced microcontroller that can be easily programmed externally. This means that the same Arduino board can be utilized in different projects or mechatronics systems. Different models of Arduino boards are available to cater to different system requirements, with Arduino UNO being the most popular. Arduino UNO is easy to program and operate, and it is frequently used in small mechatronics projects. The following picture shows an Arduino UNO board with multiple terminals connected to it.
Advantages of using Arduino: There are several advantages to using Arduino boards. They are cost-effective and can be easily utilized in different electronics projects. The Arduino software, known as Arduino IDE, is versatile and compatible with different operating systems such as Windows, Macintosh, and Linux. Arduino IDE uses a simplified language, making it suitable for beginners as well as advanced users for complex programming. Since Arduino IDE is an open-source tool, experienced programmers can easily extend its functionalities through C++ programming. Arduino boards also offer extensible hardware, allowing experienced circuit designers to modify the board's hardware.
Programming an Arduino:
As
mentioned earlier, Arduino boards are programmed using software called
Arduino IDE, which is an open-source program. The IDE provides a special environment
with syntax highlighting and other features to make coding easier. Arduino
programming is typically based on processing programming and includes different
instructions such as "and" and "if" for programming the
board. Below is a simple example that demonstrates how programming is written
for an Arduino board.
Blinking LED program
The
following picture illustrates a simple circuit for creating a blinking LED
using an Arduino board. In this circuit, the LED's positive terminal is
connected to the digital output port "PIN 10," and the negative terminal
is connected to the ground.
To make the LED blink, we will turn it on and off for a duration of 1 second. By setting the status of PIN 10 to high or low, the LED will blink accordingly. The program instructions for blinking an LED are provided below.
What is Raspberry Pi?
Raspberry Pi is a low-cost, credit card-sized single-board computer. It can be used as a regular computer by connecting it to a monitor, keyboard, mouse, etc. Raspberry Pi is also commonly used in gaming systems, small robotic systems, and as a controller for various mechatronics systems. Unlike other controllers used in mechatronics systems, Raspberry Pi integrates multiple components and ports into a single board, making it highly adaptable. The following picture shows a Raspberry Pi board with different integrated ports.
Before
using Raspberry Pi, it needs to be equipped with special software, including
its operating system. The software can be installed via a Micro SD card or
downloaded from the Internet. Raspberry Pi supports a wide range of software,
including various operating systems. The official operating system of the
Raspberry Pi Foundation, called "Raspbian," is the most popular
choice. Raspberry Pi is not limited to using pre-existing software; it also
provides the capability to create its own programming or coding. It serves as a
powerful and fully functional programming tool for creating games, animations,
operating mechatronics systems, and even complex robotics projects.











No comments:
Post a Comment