**Model-Based Simulation of an Intelligent Microprocessor-Based Standalone Solar Tracking System**

C.S. Chin

250 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

1\_/11

Zhu Y. &Tomsovic K. (2002). Development of models for analyzing the load-following performance of microturbines and fuel cells, Electric Power Systems Research 62 (2002)

Additional information is available at the end of the chapter

http://dx.doi.org/10.5772/46458

## **1. Introduction**

Renewable energy resources will be an increasingly important part of power generation in the new millennium. Besides assisting in the reduction of the emission of greenhouse gases, they add the much- needed flexibility to the energy resource mix by decreasing the dependence on fossil fuels [1]. Among the renewable-energy resources, solar energy is the most essential and prerequisite resource of sustainable energy because of its ubiquity, abundance, and sustainability. Regardless of the intermittency of sunlight, solar energy is widely available and completely free of cost. Recently, photovoltaic (PV) system is well recognized and widely utilized to convert the solar energy for electric power applications. It can generate direct current (DC) electricity without environmental impact and emission by way of solar radiation. The DC power is converted to AC power with an inverter, to power local loads or fed back to the utility [2]. Being a semiconductor device, the PV systems are suitable for most operation at lower maintenance costs.

The PV applications could be grouped according to the scheme of interaction with utility grid: grid connected, stand alone, and hybrid. PV systems consist of a PV generator (cell, module, and array), energy storage devices (such as batteries), AC and DC consumers and elements for power conditioning. The most common method uses the PV cells in the grid network. However, to understand the performance and to maximize the efficiency of the irradiation of the PV cells, the standalone PV cells have spurred some interest, especially, in the area of the solar tracker system.

Over the years, test and researchers had proven that development of smart solar tracker maximizes the energy generation. In this competitive world of advanced scientific discoveries, the introductions of automated systems improve existing power generation

© 2012 Chin, licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. © 2012 Chin, licensee InTech. This is a paper distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

methods. Before the introduction of solar tracking methods, fixed solar panels were positioned within a reasonable tilted direction based on the location. The tilt angle depending on whether a slight winter or summer bias is preferred in the system. The PV systems would face "true north" in the northern hemisphere and "true south" in the southern hemisphere. Solar tracking is best achieved when the tilt angle of the tracking PV systems is synchronized with the seasonal changes of the sun's altitude. Several methods of sun tracking systems have been surveyed and evaluated to keep the PV cells perpendicular to the sun beam. An ideal tracker would allow the PV cells to point towards the sun, compensating for both changes in the altitude angle of the sun (throughout the day), latitudinal offset of the sun (during seasonal changes) and changes in azimuth angle. In the light of this, two main types of sun trackers exist: passive (mechanical) and active (electrical) trackers. The detailed literatures review can be found in [3].

Model-Based Simulation of an Intelligent Microprocessor-Based Standalone Solar Tracking System 253

Whilst in the auxiliary bifacial solar cell [15] systems, the bifacial solar cell senses and drives the tracker system to the desired position. Auxiliary solar cells (panels) connected directly to a permanent magnet DC motor are fixed to a rotary axle of the tracker and can both sense and provide energy for tracking. In this design, unreliable and expensive components like batteries and driving electronics were completely eliminated. Hence, it is a very simple, reliable solar tracker for space and terrestrial applications. On the other hands, the computer-controlled date and time based system calculates the sun positions with respect to date and time with algorithms and creates signals for the system control via motor to the panel. In the solar tracking system that was designed by [16-17], the required position was calculated in advance and was programmed into Programmable Logic Control (PLC) that in term controls the motor to adjust the panel to maintain position perpendicular to the sun.

In another method that uses the combination of microprocessor with sensor and date/time based system [18-19], the sensors such as pyrheliometers (that measure the direct beam of sun irradiance) and/or light sensors send the signal to the microprocessor. Using the realtime clock (RTC), the tracker computes the position of the sun based on the date/time information of its clock. The data gathered during the day are analyzed, and a new improved set of parameters for the installation errors is computed. These data are used in

Hence, the main difference between the active trackers is the ability to reduce the pointing error using external sensors, thereby increasing the daily irradiation the solar cells receive and the electric energy that they produced. A comparative study[3] shows that, the power consumption by the tracking device is only 2-3 % of the increased energy. The annual energy available to the two axis tracker was 72% higher than a fixed surface and 30% for single axis East-to-West tracker. However, the two or more axes trackers are more complex and costly to maintain as compared to the single-axis tracker. Furthermore, as Singapore is near to the equinoxes, the sun rises directly in East and set directly West regardless of the latitude, the single axis solar tracker becomes more favorable in this region. Based on the above-mentioned tracking systems, we have suggested that the active based single-axis tracker system is less complex to design and maintain. Additionally, for the system to work solely based on light-sensor tracking technology is not practical due to Singapore's unexpected changes in weather conditions. We have therefore come about with the idea to integrate a time-based tracking technology with the light-sensor tracking technology in the tracker system. With high numbers of high-rise buildings in Singapore, the ideas of having a

the next day to compute more accurate positions of the sun, and the cycle continues.

wall-mounted design for each household usage become an attractive option.

In the new solar tracking system installed with sensor feedback, and real-time clock control was capable of performing both automatic and preset mode of operation. The system's ability to switch between the modes proves to be an important feature. The position and "status" of the sun is detected by two light-dependent resistor (LDR) sensors that are located at the both ends of the surface of the photovoltaic panel. In the automatic modes, the resultant signals from the sensors are fed into an electronic control system that operates a low- speed DC motor to rotate the panel via a speed-reduction system. In this mode, the Sun

One class of the passive solar trackers is the fixed solar panel. It is placed horizontally on the fixed ground and face upwards to the sky. But most of the passive solar trackers are based on manual adjustment of the panel[4], thermal expansion of a shape memory alloy[5]or two bimetallic strips made of aluminum and steel[6]. Usually this kind of tracker is composed of a couple of actuators working against each other, which are, by equal illumination, balanced. By differential illumination of actuators, unbalanced forces are used for orientation of the apparatus in such direction where equal illumination of actuators and balance of forces is restored. Another passive tracking technology is based on the mass imbalance [6] between both ends of the panel. This kind of trackers does not use any kind of electronic control or motor. Two identical cylindrical tubes are filled with a fluid under partial pressure. The sun heats the fluid causing evaporation and transfer from one cylinder to another, which creates the mass imbalance. Passive solar trackers, compared to active trackers, are less complex but works in low efficiency. Although passive trackers are often less expensive, they have not yet been widely accepted by consumers.

On the other hands, major active trackers can be categorized as a microprocessor based, computer-controlled date and time based, auxiliary bifacial solar cell based and a combination of these three systems. In the microprocessor based solar tracker systems [7-11], a controller is connected to DC motors. Once the location is selected, the azimuth elevation range is determined, and the angular steps are calculated. Usually for monitoring the power generation, they also connected this tracking device to a PC by a code written in Assembly or C++ languages. In this solar tracker design, sensors were often used. For example, a photo-resistor [12-13] was put in a dark box with a small holes on the top to detect the illumination, and a light sensor or photosensor called light-dependent resistor (LDR) [11,14] to indicate the intensity of the radiation (that changes its electrical resistance from several thousand Ohms in the dark to only a few hundred Ohms when light falls upon it). The signals were then captured by the microcontroller that provides a signal to the motors to rotate the panel.

Whilst in the auxiliary bifacial solar cell [15] systems, the bifacial solar cell senses and drives the tracker system to the desired position. Auxiliary solar cells (panels) connected directly to a permanent magnet DC motor are fixed to a rotary axle of the tracker and can both sense and provide energy for tracking. In this design, unreliable and expensive components like batteries and driving electronics were completely eliminated. Hence, it is a very simple, reliable solar tracker for space and terrestrial applications. On the other hands, the computer-controlled date and time based system calculates the sun positions with respect to date and time with algorithms and creates signals for the system control via motor to the panel. In the solar tracking system that was designed by [16-17], the required position was calculated in advance and was programmed into Programmable Logic Control (PLC) that in term controls the motor to adjust the panel to maintain position perpendicular to the sun.

252 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

in [3].

consumers.

rotate the panel.

methods. Before the introduction of solar tracking methods, fixed solar panels were positioned within a reasonable tilted direction based on the location. The tilt angle depending on whether a slight winter or summer bias is preferred in the system. The PV systems would face "true north" in the northern hemisphere and "true south" in the southern hemisphere. Solar tracking is best achieved when the tilt angle of the tracking PV systems is synchronized with the seasonal changes of the sun's altitude. Several methods of sun tracking systems have been surveyed and evaluated to keep the PV cells perpendicular to the sun beam. An ideal tracker would allow the PV cells to point towards the sun, compensating for both changes in the altitude angle of the sun (throughout the day), latitudinal offset of the sun (during seasonal changes) and changes in azimuth angle. In the light of this, two main types of sun trackers exist: passive (mechanical) and active (electrical) trackers. The detailed literatures review can be found

One class of the passive solar trackers is the fixed solar panel. It is placed horizontally on the fixed ground and face upwards to the sky. But most of the passive solar trackers are based on manual adjustment of the panel[4], thermal expansion of a shape memory alloy[5]or two bimetallic strips made of aluminum and steel[6]. Usually this kind of tracker is composed of a couple of actuators working against each other, which are, by equal illumination, balanced. By differential illumination of actuators, unbalanced forces are used for orientation of the apparatus in such direction where equal illumination of actuators and balance of forces is restored. Another passive tracking technology is based on the mass imbalance [6] between both ends of the panel. This kind of trackers does not use any kind of electronic control or motor. Two identical cylindrical tubes are filled with a fluid under partial pressure. The sun heats the fluid causing evaporation and transfer from one cylinder to another, which creates the mass imbalance. Passive solar trackers, compared to active trackers, are less complex but works in low efficiency. Although passive trackers are often less expensive, they have not yet been widely accepted by

On the other hands, major active trackers can be categorized as a microprocessor based, computer-controlled date and time based, auxiliary bifacial solar cell based and a combination of these three systems. In the microprocessor based solar tracker systems [7-11], a controller is connected to DC motors. Once the location is selected, the azimuth elevation range is determined, and the angular steps are calculated. Usually for monitoring the power generation, they also connected this tracking device to a PC by a code written in Assembly or C++ languages. In this solar tracker design, sensors were often used. For example, a photo-resistor [12-13] was put in a dark box with a small holes on the top to detect the illumination, and a light sensor or photosensor called light-dependent resistor (LDR) [11,14] to indicate the intensity of the radiation (that changes its electrical resistance from several thousand Ohms in the dark to only a few hundred Ohms when light falls upon it). The signals were then captured by the microcontroller that provides a signal to the motors to In another method that uses the combination of microprocessor with sensor and date/time based system [18-19], the sensors such as pyrheliometers (that measure the direct beam of sun irradiance) and/or light sensors send the signal to the microprocessor. Using the realtime clock (RTC), the tracker computes the position of the sun based on the date/time information of its clock. The data gathered during the day are analyzed, and a new improved set of parameters for the installation errors is computed. These data are used in the next day to compute more accurate positions of the sun, and the cycle continues.

Hence, the main difference between the active trackers is the ability to reduce the pointing error using external sensors, thereby increasing the daily irradiation the solar cells receive and the electric energy that they produced. A comparative study[3] shows that, the power consumption by the tracking device is only 2-3 % of the increased energy. The annual energy available to the two axis tracker was 72% higher than a fixed surface and 30% for single axis East-to-West tracker. However, the two or more axes trackers are more complex and costly to maintain as compared to the single-axis tracker. Furthermore, as Singapore is near to the equinoxes, the sun rises directly in East and set directly West regardless of the latitude, the single axis solar tracker becomes more favorable in this region. Based on the above-mentioned tracking systems, we have suggested that the active based single-axis tracker system is less complex to design and maintain. Additionally, for the system to work solely based on light-sensor tracking technology is not practical due to Singapore's unexpected changes in weather conditions. We have therefore come about with the idea to integrate a time-based tracking technology with the light-sensor tracking technology in the tracker system. With high numbers of high-rise buildings in Singapore, the ideas of having a wall-mounted design for each household usage become an attractive option.

In the new solar tracking system installed with sensor feedback, and real-time clock control was capable of performing both automatic and preset mode of operation. The system's ability to switch between the modes proves to be an important feature. The position and "status" of the sun is detected by two light-dependent resistor (LDR) sensors that are located at the both ends of the surface of the photovoltaic panel. In the automatic modes, the resultant signals from the sensors are fed into an electronic control system that operates a low- speed DC motor to rotate the panel via a speed-reduction system. In this mode, the Sun is not constantly tracked to prevent energy consumed by the motor, and the system will be in 'sleep' mode when the night falls. In the preset mode, the solar tracker rotates at a predetermined angle from the sunrise to the sunset. The increment of the angle is determined through the data collected on the day and is analyzed and re-programmed for a better tracking ability on the next day. Whilst in the manual mode, the solar tracker is set to a desired angle by manually increasing or decreasing the angle via the input to the PIC microcontroller. In all modes, a night return algorithm repositioned the panel to its initial home position facing the East (at sunrise).

Model-Based Simulation of an Intelligent Microprocessor-Based Standalone Solar Tracking System 255

base plate support. The entire structure was fabricated using the aluminum rods and plates. The pillar holding panel is aligned to the center of the panel for better flexibility during the panel rotation. The tracker is designed to have a single-axis rotation (East to West), and the motor is mounted in such a way that the tracker systems have only a single-axis freedom of rotation. The fixture to hold the sensors are then assembled and aligned at both ends of the

The PV panel frame support (as seen in Fig. 1) has a support rod that runs across the PV panel width. The pulley on the rod supported by two bearings is directly connected to the motor shaft via the pulley transmission system. The two mechanical stoppers at each ends were incorporated to limit the rotation of the panel. As shown in Fig. 1, the components

The overall mechanical and electrical subsystems were integrated into the solar tracker system as shown in Fig. 2. The detailed design of the circuitry could be found in [24]. The block diagram of the solar tracker system consists of mostly electrical components. The solar tracker consists of the PV cells, the charge controller and the lead-acid battery. Other subsystems such as the LDR sensors, the voltage regulator, and the microcontroller-PIC18F4520 target board were also used. The LDR sensors sense the sunlight intensity and send the signal to the microcontroller to rotate the PV panel via the servo motor. The electrical energy is then stored in the lead-acid battery that is later used to power the

were arranged along the vertical pillar mounted on the base plate support.

PV panel to sense the sun irradiance.

**Figure 1.** Actual solar tracker design

**2.2. Electrical system** 

respective components.

Besides, the ability to operate as a solar tracker, computer models of the PV panel and the electro-mechanical systems are modeled using MATLABTM/SimulinkTM environment. In literature [20], a simple visual C++ program was used to provide an excellent graphic user interface (GUI) and control normal DC power supply output using the computer printer port to exactly simulate solar panel characteristics. As seen in [21-23], MATLAB TM/Simulink TM was used to model and analyze the PV model characteristics. However, there are only a few attempts [24] to model the entire PV standalone system, including the electromechanical subsystem such as DC motor, drive transmission, microcontroller output, battery and charging module. Whether like or not, this is essential as they are parts of the PV systems and the influence on the overall performance such as efficiency and power output can be compromise if the electro-mechanical system is poorly design for the active solar tracker and when it is subjected to external disturbances such as wind and raindrops. With that in mind, the PV standalone system model consists of a PV panel, a servo motor, a battery, a charger, two LDR sensors, external disturbances and the microcontroller are modeled using MATLABTM/SimulinkTM. It was chosen due to its easy to program language supported by ready toolboxes and graphic block diagrams can be designed for complicated systems simulation. With the completed system model, it is used to determine the power and its efficiency over the fixed solar panel before actual implementation.

In summary, the book chapter presents the modeling and simulation of the solar tracker system consisting of the photovoltaic system under a constant load using MATLABTM and SimulinkTM. The chapter is organized as follows. The overview of the electro-mechanical design of the single-axis solar tracker is described in Section 2. This is followed by the description of the proposed MATLABTM and SimulinkTM models in Section 3. The experiments and testing are described in Section 4. Lastly, conclusions are drawn in Section 5.

## **2. Solar tracker system descriptions**

## **2.1. Mechanical structure**

After the solar panels and other components were selected, the overall structural design of the solar tracker as seen in Fig.1 was fabricated. The solar tracker weight 3 kg and has an overall dimension of 340mm x 270mm x 500mm. The compactness of the proposed solar tracker enables it to be mounted on the wall. It consists of the PV panel, the pulley-chain transmission system; the motor and electronics boards support and the vertical pillar with base plate support. The entire structure was fabricated using the aluminum rods and plates. The pillar holding panel is aligned to the center of the panel for better flexibility during the panel rotation. The tracker is designed to have a single-axis rotation (East to West), and the motor is mounted in such a way that the tracker systems have only a single-axis freedom of rotation. The fixture to hold the sensors are then assembled and aligned at both ends of the PV panel to sense the sun irradiance.

The PV panel frame support (as seen in Fig. 1) has a support rod that runs across the PV panel width. The pulley on the rod supported by two bearings is directly connected to the motor shaft via the pulley transmission system. The two mechanical stoppers at each ends were incorporated to limit the rotation of the panel. As shown in Fig. 1, the components were arranged along the vertical pillar mounted on the base plate support.

**Figure 1.** Actual solar tracker design

## **2.2. Electrical system**

254 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

and its efficiency over the fixed solar panel before actual implementation.

and testing are described in Section 4. Lastly, conclusions are drawn in Section 5.

**2. Solar tracker system descriptions** 

**2.1. Mechanical structure** 

In summary, the book chapter presents the modeling and simulation of the solar tracker system consisting of the photovoltaic system under a constant load using MATLABTM and SimulinkTM. The chapter is organized as follows. The overview of the electro-mechanical design of the single-axis solar tracker is described in Section 2. This is followed by the description of the proposed MATLABTM and SimulinkTM models in Section 3. The experiments

After the solar panels and other components were selected, the overall structural design of the solar tracker as seen in Fig.1 was fabricated. The solar tracker weight 3 kg and has an overall dimension of 340mm x 270mm x 500mm. The compactness of the proposed solar tracker enables it to be mounted on the wall. It consists of the PV panel, the pulley-chain transmission system; the motor and electronics boards support and the vertical pillar with

home position facing the East (at sunrise).

is not constantly tracked to prevent energy consumed by the motor, and the system will be in 'sleep' mode when the night falls. In the preset mode, the solar tracker rotates at a predetermined angle from the sunrise to the sunset. The increment of the angle is determined through the data collected on the day and is analyzed and re-programmed for a better tracking ability on the next day. Whilst in the manual mode, the solar tracker is set to a desired angle by manually increasing or decreasing the angle via the input to the PIC microcontroller. In all modes, a night return algorithm repositioned the panel to its initial

Besides, the ability to operate as a solar tracker, computer models of the PV panel and the electro-mechanical systems are modeled using MATLABTM/SimulinkTM environment. In literature [20], a simple visual C++ program was used to provide an excellent graphic user interface (GUI) and control normal DC power supply output using the computer printer port to exactly simulate solar panel characteristics. As seen in [21-23], MATLAB TM/Simulink TM was used to model and analyze the PV model characteristics. However, there are only a few attempts [24] to model the entire PV standalone system, including the electromechanical subsystem such as DC motor, drive transmission, microcontroller output, battery and charging module. Whether like or not, this is essential as they are parts of the PV systems and the influence on the overall performance such as efficiency and power output can be compromise if the electro-mechanical system is poorly design for the active solar tracker and when it is subjected to external disturbances such as wind and raindrops. With that in mind, the PV standalone system model consists of a PV panel, a servo motor, a battery, a charger, two LDR sensors, external disturbances and the microcontroller are modeled using MATLABTM/SimulinkTM. It was chosen due to its easy to program language supported by ready toolboxes and graphic block diagrams can be designed for complicated systems simulation. With the completed system model, it is used to determine the power

> The overall mechanical and electrical subsystems were integrated into the solar tracker system as shown in Fig. 2. The detailed design of the circuitry could be found in [24]. The block diagram of the solar tracker system consists of mostly electrical components. The solar tracker consists of the PV cells, the charge controller and the lead-acid battery. Other subsystems such as the LDR sensors, the voltage regulator, and the microcontroller-PIC18F4520 target board were also used. The LDR sensors sense the sunlight intensity and send the signal to the microcontroller to rotate the PV panel via the servo motor. The electrical energy is then stored in the lead-acid battery that is later used to power the respective components.

Model-Based Simulation of an Intelligent Microprocessor-Based Standalone Solar Tracking System 257

voltage regulator circuit was used to bring the supply voltage down to a level suitable for use in the microcontroller, the charge controller and the LDR sensors. The microcontroller target board in the system was used to control the servo motor. It receives the signals from the LDR sensors. The analogue voltage is converted into digital signal (logic 1 or 0) for processing. The processor was a PIC18F4520 from Microchip Inc. The PICKIT2 programmer was then used to interface MPLAB Integrated Development Environment to the target board. To program the microcontroller target board, MPLAB C18 Compiler software that runs on the Microsoft Window as a 32-bit application was used. The C program was then

There are three modes of operation in the solar tracker. They are namely: automatic, preset and manual mode. In the automatic mode, the PIC microcontroller rotates the PV panel to balance the light intensity at both LDR sensors. In the case when both sensors receive a low voltage due to cloudy conditions, the PV panel is programmed to wait for 15minutes and automatically switched to preset mode (using internal real-time clock). In this mode, the PV panel is programmed to rotate 2 towards west in every 15 minutes. If the extreme position towards the west is sensed (at sunset), the night return algorithm repositioned the panel to its initial home position facing the East (at sunrise). In the manual mode, it allows the panel to rotate to the desired angle by manually increasing or decreasing the angle via the input to the PIC microcontroller. Once the PV panel is positioned to the desired angle, it switches

In summary, the operation modes for the control of solar tracker and the features in these

 When the SW1 switch is pressed, it rotates the panel to the home position and waits for the user to select the automatic mode (SW2), the preset mode (SW3) or manual mode

When the SW2 switch is pressed, it starts the tracking in "automatic mode". In this

When the SW3 switch is pressed, it starts the tracking in "preset mode". In this case, it

When the SW4 switch is pressed; the panel is allowed to rotate manually to a desired

In this section, the main aim is to simulate the single axis solar tracking system during the automatic mode using MATLABTM /SimulinkTM (see Fig. 3). To obtain a more realistic model, the solar tracker is subjected to external disturbances such as wind and raindrop. It should be similar to the real prototype made in section 2 such that comparisons could be made fairly. All the data for building the simulation models were obtained from either the

mode, the rotation of the PV panel depends on the LDR sensors.

position. Once it is positioned, it switches back to the automatic mode.

rotates the panel in a pre-determined angle till the sunset.

**3. Standalone solar tracker system modeling** 

compiled into assembly language before downloading into the target board.

**2.3. Modes of operation** 

back to the automatic mode.

user options are shown below.

(SW4).

**Figure 2.** Schematic diagram of the standalone solar tracker system

The PV cells are a device that helps to convert the solar energy into electrical energy. The solar panel selected is capable of generating 10W power. As per the vendor specification, it weighs about 1.3kg with a dimension of 341mm x 269 mm x 28mm. Charge controller was supplied together with the solar panel's unit. It requires 12V supply and is capable of handling a maximum of 5A. The charge controller prevents the over-charging of the battery.

The LDR sensors (NORPS-12) are basically resistors that vary their resistance according to the sunlight intensity when exposed to irradiance. The output of the sensor circuit is an analogue voltage that is used as an input to the PIC microcontroller. To determine the value of resistor R, various values of different resistors were examined to finalize an appropriate resistor. The desired resistor value should provide a voltage that covers the sunny and cloudy conditions. The following resistor values as shown in Table 1 were tested. From the test result, it was found that varying the value of resistors in the voltage divider circuit helps to improve the sensitivity of the output. The resistor of 100Ω was found to be suitable to differentiate between the sunny and cloudy day.


**Table 1.** Recorded Voltage variation at different resistor values

The driving mechanism includes the servo motor and the pulley system. The servo motor was controlled using the microcontroller. The controller uses the PWM (Pulse Width Modulation) signal to drive the servo motor at a controlled speed correspond to a maximum voltage of 6V. The PWM wave is a continuous square wave signal that changes between 0V and 6V. The duration or width of the pulse determines the angle of the shaft's rotation. A voltage regulator circuit was used to bring the supply voltage down to a level suitable for use in the microcontroller, the charge controller and the LDR sensors. The microcontroller target board in the system was used to control the servo motor. It receives the signals from the LDR sensors. The analogue voltage is converted into digital signal (logic 1 or 0) for processing. The processor was a PIC18F4520 from Microchip Inc. The PICKIT2 programmer was then used to interface MPLAB Integrated Development Environment to the target board. To program the microcontroller target board, MPLAB C18 Compiler software that runs on the Microsoft Window as a 32-bit application was used. The C program was then compiled into assembly language before downloading into the target board.

## **2.3. Modes of operation**

256 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

**Figure 2.** Schematic diagram of the standalone solar tracker system

differentiate between the sunny and cloudy day.

**Table 1.** Recorded Voltage variation at different resistor values

The PV cells are a device that helps to convert the solar energy into electrical energy. The solar panel selected is capable of generating 10W power. As per the vendor specification, it weighs about 1.3kg with a dimension of 341mm x 269 mm x 28mm. Charge controller was supplied together with the solar panel's unit. It requires 12V supply and is capable of handling a maximum of 5A. The charge controller prevents the over-charging of the battery. The LDR sensors (NORPS-12) are basically resistors that vary their resistance according to the sunlight intensity when exposed to irradiance. The output of the sensor circuit is an analogue voltage that is used as an input to the PIC microcontroller. To determine the value of resistor R, various values of different resistors were examined to finalize an appropriate resistor. The desired resistor value should provide a voltage that covers the sunny and cloudy conditions. The following resistor values as shown in Table 1 were tested. From the test result, it was found that varying the value of resistors in the voltage divider circuit helps to improve the sensitivity of the output. The resistor of 100Ω was found to be suitable to

Fixed Resistor (Ω) Vout on sunny day Vout on cloudy day ∆Vout 50 2.14 0.82 1.32 *100 3.95 0.90 3.05*  200 4.56 1.35 3.21 500 4.78 1.41 3.37 1000 5.02 1.9 3.12

The driving mechanism includes the servo motor and the pulley system. The servo motor was controlled using the microcontroller. The controller uses the PWM (Pulse Width Modulation) signal to drive the servo motor at a controlled speed correspond to a maximum voltage of 6V. The PWM wave is a continuous square wave signal that changes between 0V and 6V. The duration or width of the pulse determines the angle of the shaft's rotation. A There are three modes of operation in the solar tracker. They are namely: automatic, preset and manual mode. In the automatic mode, the PIC microcontroller rotates the PV panel to balance the light intensity at both LDR sensors. In the case when both sensors receive a low voltage due to cloudy conditions, the PV panel is programmed to wait for 15minutes and automatically switched to preset mode (using internal real-time clock). In this mode, the PV panel is programmed to rotate 2 towards west in every 15 minutes. If the extreme position towards the west is sensed (at sunset), the night return algorithm repositioned the panel to its initial home position facing the East (at sunrise). In the manual mode, it allows the panel to rotate to the desired angle by manually increasing or decreasing the angle via the input to the PIC microcontroller. Once the PV panel is positioned to the desired angle, it switches back to the automatic mode.

In summary, the operation modes for the control of solar tracker and the features in these user options are shown below.


## **3. Standalone solar tracker system modeling**

In this section, the main aim is to simulate the single axis solar tracking system during the automatic mode using MATLABTM /SimulinkTM (see Fig. 3). To obtain a more realistic model, the solar tracker is subjected to external disturbances such as wind and raindrop. It should be similar to the real prototype made in section 2 such that comparisons could be made fairly. All the data for building the simulation models were obtained from either the components' datasheets or the experiments conducted. The simulation run was performed in every second of the entire 10 hours or 36000 seconds of experimental setup. The rapid accelerator mode has been chosen to reduce the simulation time to about 180-seconds real time (one-second second simulation time is equivalent to 180-seconds real time). The rapid accelerator mode gives the best speed improvement compared to normal mode when simulation execution time exceeds the time required for code generation. For this reason, the rapid accelerator mode generally performs better than normal mode when simulation execution times are several minutes or more. The ODE45 solver type of variable step size was used throughout the simulations. Solar tracker model developed in Simulink could detect the sun irradiance to produce the required current. The simulation model is implemented in such a way that when the sun irradiance falls on the sensors, the servo motor moves the PV panel in an incremental way until the sunset.

Model-Based Simulation of an Intelligent Microprocessor-Based Standalone Solar Tracking System 259

The simplest equivalent circuit of a solar cell is a current source in parallel with a diode as shown in Fig. 4. The current source represents the current generated by the PV cell due to the photons received by it, and is constant under constant sun irradiance and temperature. During darkness, the solar cell is not an active device; it works as a diode. It produces neither a current nor a voltage. However, if it is connected to an external supply (large voltage) it generates a saturation current or dark current. The key parameters for a PV cell are short circuit current (*Isc* or the current from the solar cell when the voltage across the cell is zero), open circuit voltage (*Voc*) and sun irradiance value. Usually these values are given

Normally a single PV cell produces a rather small voltage that have less practical use. The real PV panel always uses many cells to generate a large voltage. For example the Kamtex-10W PV module used for our project comprises of 36 cells to generate a large enough voltage to charge a 12 volt battery. The data sheet for Kamtex-10W is given in Table 2.

Temperature coefficient of open-circuit voltage -(10+/-1)mV/degree Celsius Temperature coefficient of short-circuit current (0.065+/-0.015)%/degree

Nominal Operating Cell Temperature (NOCT) 30+/-3degree Celsius

Celsius

**Parameter Value** Maximum Power (Pmax) 10W Voltage at Pmax 17.6V Current at Pmax 0.57A Short-circuit current (Isc) 0.6A Open-circuit voltage (Voc) 21.6V

**Table 2.** Electrical characteristics of PV Module-Kamtex (KMX-10W)

**3.1. PV panel model** 

by the manufacturer in the data sheet.

**Figure 4.** Circuit diagram of a PV cell model

The PV tracking panel with two LDR sensors, namely: V\_LDR\_B and V\_LDR\_T are the bottom and top voltage outputs based on the corresponding sun irradiance data. The irradiance from the sun model was obtained by dividing the power obtained from the tracker by the surface area of the PV cells. The outputs were used as inputs to the microcontroller. The servo motor rotates the panel at an angle based on the microcontroller PWM signal. This process repeats again until the sunset. During the process, the PV panel generates direct current that keeps the 12V battery charged. The battery gets charged or discharged depending on the state of the charger. The external load was modeled by a pure resistor to simulate the loading on the motor shaft. The wind and rain droplet were modeled as additional current load (that is by deducting the actual current generated from the solar cells) on the solar tracker. The efficiency of the proposed solar tracking system over the fixed panel can be compared. With the model, it is used to determine the types of PV systems that could be successfully combined to give a required level of efficiency before actual implementation.

**Figure 3.** Overall tracking system block diagrams in Simulink

## **3.1. PV panel model**

258 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

motor moves the PV panel in an incremental way until the sunset.

**Figure 3.** Overall tracking system block diagrams in Simulink

implementation.

components' datasheets or the experiments conducted. The simulation run was performed in every second of the entire 10 hours or 36000 seconds of experimental setup. The rapid accelerator mode has been chosen to reduce the simulation time to about 180-seconds real time (one-second second simulation time is equivalent to 180-seconds real time). The rapid accelerator mode gives the best speed improvement compared to normal mode when simulation execution time exceeds the time required for code generation. For this reason, the rapid accelerator mode generally performs better than normal mode when simulation execution times are several minutes or more. The ODE45 solver type of variable step size was used throughout the simulations. Solar tracker model developed in Simulink could detect the sun irradiance to produce the required current. The simulation model is implemented in such a way that when the sun irradiance falls on the sensors, the servo

The PV tracking panel with two LDR sensors, namely: V\_LDR\_B and V\_LDR\_T are the bottom and top voltage outputs based on the corresponding sun irradiance data. The irradiance from the sun model was obtained by dividing the power obtained from the tracker by the surface area of the PV cells. The outputs were used as inputs to the microcontroller. The servo motor rotates the panel at an angle based on the microcontroller PWM signal. This process repeats again until the sunset. During the process, the PV panel generates direct current that keeps the 12V battery charged. The battery gets charged or discharged depending on the state of the charger. The external load was modeled by a pure resistor to simulate the loading on the motor shaft. The wind and rain droplet were modeled as additional current load (that is by deducting the actual current generated from the solar cells) on the solar tracker. The efficiency of the proposed solar tracking system over the fixed panel can be compared. With the model, it is used to determine the types of PV systems that could be successfully combined to give a required level of efficiency before actual The simplest equivalent circuit of a solar cell is a current source in parallel with a diode as shown in Fig. 4. The current source represents the current generated by the PV cell due to the photons received by it, and is constant under constant sun irradiance and temperature. During darkness, the solar cell is not an active device; it works as a diode. It produces neither a current nor a voltage. However, if it is connected to an external supply (large voltage) it generates a saturation current or dark current. The key parameters for a PV cell are short circuit current (*Isc* or the current from the solar cell when the voltage across the cell is zero), open circuit voltage (*Voc*) and sun irradiance value. Usually these values are given by the manufacturer in the data sheet.

**Figure 4.** Circuit diagram of a PV cell model

Normally a single PV cell produces a rather small voltage that have less practical use. The real PV panel always uses many cells to generate a large voltage. For example the Kamtex-10W PV module used for our project comprises of 36 cells to generate a large enough voltage to charge a 12 volt battery. The data sheet for Kamtex-10W is given in Table 2.


**Table 2.** Electrical characteristics of PV Module-Kamtex (KMX-10W)

The following parameters were used in the calculation of the net current of a PV cell.


In an ideal cell *Rs* is 0 and *Rsh* is infinite. The net current of the PV cells is the difference between the output current [25-26] from the PV cells and the diode current is given by.

$$I = I\_L - I\_o \left[ e^{\frac{q(V + IR\_s)}{nkT}} - 1 \right] \tag{1}$$

Model-Based Simulation of an Intelligent Microprocessor-Based Standalone Solar Tracking System 261

1 1 ( )

'

*f x*( ) is the derivative of the function *f x*() 0 , *<sup>n</sup> <sup>x</sup>* is a present value, and *<sup>n</sup>* <sup>1</sup> *<sup>x</sup>* is the

( )

( )

12 Va Va G TaC

solar Ia

PV\_Cells\_Array

TaC

*q V IR nkT*

*nkT o s*

*s*

*s*

1

( ) 1 0 *<sup>s</sup> q V IR nkT*

1 ( )

By using MATLABTM, the above function can be computed numerically to obtain the net

The fixed PV panel was modeled as shown in Fig.5 using the equations as seen in (11). The output voltage of the battery is 12V. The temperature (*TaC*) obtained during the experiment and the sun irradiance data (*G*) that represents the intensity (or the power of sunlight falling per unit area) were used. The solar irradiance data were taken hourly, and the averages in each hour were then tabulated. The PV Cells Array block diagram computes the net current from the PV cells using the embedded MATLAB function. The plot for the actual and simulated net output current is shown in Fig. 6. The deviation in the plot may due to the averaging done during each hour and the power consumed before noon was actually higher

Ef f ectiv e Irradiance

Effective Irradiance Using Incident ray model

*Lno n n q V IR*

*I I Ie*

1 .

*I qR e*

*v*

*nkT X* (8)

<sup>1</sup> ( )/ ( ) *nn n n x x fx f x* (9)

(10)

(11)

1 Ia2

0 1

*L o fI I I I e*

*I I*

than expected. This is reasonable as the sunlight is stronger during the day.

Sun\_Angle Irradiance Panel\_Angle

*<sup>q</sup> X IT e*

*v*

1 <sup>1</sup> ( ) *oc qV T nkT*

where '

next value. So,

By Newton's method,

Then using Newton's equation:

output current from the PV cells.

**Figure 5.** Fixed PV panel model

4 Time

3 Panel\_Angle

2 Irradiance

1 Sun\_Angle

where *V* is the voltage across the PV cell, *k* is the Boltzmann's constant (=1.38110-23 J/K), *T* is the junction temperature in Kelvin, *q* is the electron charge (=1.60210-19C), *n* is the diode ideality factor (1.62).

$$I\_L = I\_L(T\_1) + K\_0(T\_{ref} - T\_1) \tag{2}$$

$$I\_L(T\_1) = I\_{sc}(T\_1) . G(T\_{ref}) \tag{3}$$

$$K\_0 = \frac{I\_{sc}(T\_2) - I\_{sc}(T\_1)}{T\_2 - T\_1} \tag{4}$$

Here, *Tref* equals to 298K is the reference temperature of the PV cell, *G* (*Tref*) equals to 1000W/m2, *K0* is the temperature coefficient are used. Then,

$$I\_0 = I\_0(T\_{ref}) \times \left(\frac{T}{T\_{ref}}\right)^{\frac{3}{n}} e^{-\frac{qV\_g}{mk\left(\frac{1}{T\_{ref}} - \frac{1}{T\_1}\right)}}\tag{5}$$

$$I\_0(T\_{ref}) = \frac{I\_{sc}(T\_1)}{\frac{qV\_{oc}(T\_1)}{e}} ; \quad V\_0(T\_1) = \frac{nkT\_1}{q} \ln\left(\frac{I\_L}{I\_0}\right) \tag{6}$$

where *Vg* is the band gap energy (=1.12eV). It is the energy needed to break a bond in the crystal, *Voc* is the open circuit voltage corresponds to the photocurrent *IL*. The resistance within each cell in the connection between cells is the series resistance, *Rs*

$$R\_s = \frac{dV}{dI\_{V\alpha c}} - \frac{1}{X\_v} \tag{7}$$

Model-Based Simulation of an Intelligent Microprocessor-Based Standalone Solar Tracking System 261

$$X\_{\upsilon} = I\_0(T\_1) \frac{q}{nkT\_1} e^{\frac{qV\_{\text{av}}(T\_1)}{nkT\_1}} - \frac{1}{X\_{\upsilon}} \tag{8}$$

By Newton's method,

260 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

Series resistance *Rs*, which is internal resistance of the PV panel;

 Saturation current of the diode, *I0*. Net current from the PV panel *I*.

Diode quality factor, *n*;

ideality factor (1.62).

Light-generated current inside the cell *IL*.

modules are connected in a large system;

2 1

1000W/m2, *K0* is the temperature coefficient are used. Then,

The following parameters were used in the calculation of the net current of a PV cell.

Shunt resistance *Rsh*, in parallel with the diode, *Rsh* is very large unless many PV

In an ideal cell *Rs* is 0 and *Rsh* is infinite. The net current of the PV cells is the difference between the output current [25-26] from the PV cells and the diode current is given by.

where *V* is the voltage across the PV cell, *k* is the Boltzmann's constant (=1.38110-23 J/K), *T* is the junction temperature in Kelvin, *q* is the electron charge (=1.60210-19C), *n* is the diode

*L o II Ie*

0

0 0( )

0 ( ) ( ) () ;

*e*

*I T I T*

*ref*

1 1

*s*

*dV <sup>R</sup>*

*oc sc ref qV T nkT*

within each cell in the connection between cells is the series resistance, *Rs*

1

*<sup>T</sup> I IT e*

( )

*<sup>s</sup> q V IR nkT*

2 1 () () *sc sc IT IT <sup>K</sup> T T*

Here, *Tref* equals to 298K is the reference temperature of the PV cell, *G* (*Tref*) equals to

*ref*

 

*T*

1

where *Vg* is the band gap energy (=1.12eV). It is the energy needed to break a bond in the crystal, *Voc* is the open circuit voltage corresponds to the photocurrent *IL*. The resistance

1

10 1 () ( ) *L L ref I IT KT T* (2)

1 1 ( ) ( ). ( ) *L sc ref I T I T GT* (3)

1

1

*q I* 

0

*dI X* (7)

 

*g*

*qV*

 

*ref*

( ) ln *<sup>L</sup> nkT I V T*

*T T*

<sup>3</sup> 1 1

*n nk*

0 1

1

*Voc v*

(4)

(1)

(5)

(6)

$$\mathfrak{x}\_{n+1} = \mathfrak{x}\_n - f(\mathfrak{x}\_n) / \, f^\circ(\mathfrak{x}\_n) \tag{9}$$

where ' *f x*( ) is the derivative of the function *f x*() 0 , *<sup>n</sup> <sup>x</sup>* is a present value, and *<sup>n</sup>* <sup>1</sup> *<sup>x</sup>* is the next value. So,

$$\mathbb{E}\left\{f(I) = I\_L - I - I\_o \left[e^{\frac{q(V + IR\_s)}{nkT}} - 1\right] \right\} = 0\tag{10}$$

Then using Newton's equation:

$$I\_{n+1} = I\_n - \frac{I\_L - I\_o \left[ e^{\frac{q(V + IR\_s)}{nkT}} - 1 \right]}{-1 - I\_o q R\_s.e^{\frac{q(V + IR\_s)}{nkT}}} \tag{11}$$

By using MATLABTM, the above function can be computed numerically to obtain the net output current from the PV cells.

The fixed PV panel was modeled as shown in Fig.5 using the equations as seen in (11). The output voltage of the battery is 12V. The temperature (*TaC*) obtained during the experiment and the sun irradiance data (*G*) that represents the intensity (or the power of sunlight falling per unit area) were used. The solar irradiance data were taken hourly, and the averages in each hour were then tabulated. The PV Cells Array block diagram computes the net current from the PV cells using the embedded MATLAB function. The plot for the actual and simulated net output current is shown in Fig. 6. The deviation in the plot may due to the averaging done during each hour and the power consumed before noon was actually higher than expected. This is reasonable as the sunlight is stronger during the day.

**Figure 5.** Fixed PV panel model

Model-Based Simulation of an Intelligent Microprocessor-Based Standalone Solar Tracking System 263

(top) 45deg 45deg

45deg 135deg

Sun angle Panel angle

PV panel PV panel

Ground

At each time instant, the actual sun irradiance data obtained from the experiment was used. In the sun model, the sun is assumed to travel from the 0 degree (sunrise) to 180 degrees (sunset) from 7am to 5pm. During these 10 hours, the PV panel rotates 180 degrees. As shown in Fig. 10, the initial sun's angle is at 30 degrees and with the angle changes at 15 degrees per hour or 0.004147 per simulated time in second; the corresponding sun angle

Sensor\_T

Sensor\_B (bottom)

**Figure 8.** PV panel and LDR sensor angle position

**Figure 9.** Smart tracker PV panel Model

(with respect to the base) is obtained.

**3.2. Sun model** 

**Figure 6.** Actual and simulated net output current value of fixed panel

To simulate the sun irradiance at different PV panel's angle, the effective irradiance was used. Details of the effective irradiance block diagram can be seen in Fig. 7. The block diagram defined the angle between sun's incident ray and PV panel. For a static panel, it is always parallel to the ground that is at 90 degrees (0 degree for sunrise and 180 degrees for sun set). A simple program was written to obtain the relationship of the effective sun irradiance when the difference between the sun angle and panel angle is more than +/-90 degrees. To limit the angle to 90 degrees, the cosine trigonometric function was introduced in the model to create the zero sun irradiance when such a situation occurs.

**Figure 7.** Effective sun irradiance model

#### *3.1.1. Smart tracker PV panel*

The smart tracker panel was installed with two LDR sensors. Assuming both sensors are placed in parallel with the PV panel, the effective irradiance is similar. As the results, the smart tracker is unable to perform the proposed sun tracking algorithm. To circumvent this, the top and bottom sensors were positioned at 45 degrees and 135 degrees respectively as seen in Fig. 8. When the sunlight falls onto the PV panel, the LDR sensors generate different voltages (that is V\_LDR\_B and V\_LDR\_T according to the changes in the sun irradiance) to move the PV panel.

Ground

**Figure 8.** PV panel and LDR sensor angle position

**Figure 9.** Smart tracker PV panel Model

#### **3.2. Sun model**

262 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

**Figure 6.** Actual and simulated net output current value of fixed panel

**Figure 7.** Effective sun irradiance model

Subtract

*3.1.1. Smart tracker PV panel* 

move the PV panel.

3 Panel\_Angle

1 Sun\_Angle

2 Irradiance

10

20

30

40

PowerEfficiency (%)

50

60

70

in the model to create the zero sun irradiance when such a situation occurs.

u y fcn clip\_angle\_bw\_90\_to\_-90

To simulate the sun irradiance at different PV panel's angle, the effective irradiance was used. Details of the effective irradiance block diagram can be seen in Fig. 7. The block diagram defined the angle between sun's incident ray and PV panel. For a static panel, it is always parallel to the ground that is at 90 degrees (0 degree for sunrise and 180 degrees for sun set). A simple program was written to obtain the relationship of the effective sun irradiance when the difference between the sun angle and panel angle is more than +/-90 degrees. To limit the angle to 90 degrees, the cosine trigonometric function was introduced

<sup>8</sup> <sup>9</sup> <sup>10</sup> <sup>11</sup> <sup>12</sup> <sup>13</sup> <sup>14</sup> <sup>15</sup> <sup>16</sup> <sup>17</sup> <sup>18</sup> <sup>0</sup>

PowerEfficiency (Prototype) PowerEfficiency (Simulation)

> 1 Effective Irradiance

Time (24 Hr Format)

The smart tracker panel was installed with two LDR sensors. Assuming both sensors are placed in parallel with the PV panel, the effective irradiance is similar. As the results, the smart tracker is unable to perform the proposed sun tracking algorithm. To circumvent this, the top and bottom sensors were positioned at 45 degrees and 135 degrees respectively as seen in Fig. 8. When the sunlight falls onto the PV panel, the LDR sensors generate different voltages (that is V\_LDR\_B and V\_LDR\_T according to the changes in the sun irradiance) to

cos Trigonometric Function

D2R Degrees to Radians

Product

At each time instant, the actual sun irradiance data obtained from the experiment was used. In the sun model, the sun is assumed to travel from the 0 degree (sunrise) to 180 degrees (sunset) from 7am to 5pm. During these 10 hours, the PV panel rotates 180 degrees. As shown in Fig. 10, the initial sun's angle is at 30 degrees and with the angle changes at 15 degrees per hour or 0.004147 per simulated time in second; the corresponding sun angle (with respect to the base) is obtained.

Model-Based Simulation of an Intelligent Microprocessor-Based Standalone Solar Tracking System 265

As shown in Fig. 12, the microcontroller model is modeled using the embedded MATLABTM function. The inputs to this function are LDR\_B and LDR\_T, a real-time clock and initial buffer value of 1.5. One of the inputs (named Extime) is used to compare the current time with the previous time when the PWM value changes. The microcontroller generates output duration of 1.5ms to rotate the PV panel if the voltage difference of the LDR sensors is less than 0.07V and are both less than 0.75V (very low irradiance). If LDR sensor's voltages are both greater than 0.75V but the voltage difference is less than 0.07V, the PV panel remains in the current position. When the LDR sensor values is greater than 0.07V, the motor turns the PV panel by adjusting its PWM value until the sensors' voltages are equal. The delay time of 0.7 seconds and increment steps were found using the trial-and-error method during the

A charger is essential to protect the battery from over-charged and fully drained. In an ideal case, the battery charge remains between 20% and 100% based on a PSpice photovoltaic model [27]. This charger model (see Fig. 13) includes two switches namely: Switch A and B to control the battery voltage flow. Switch A remains deactivated for any value of battery charge above 12.95V (100% charged). Switch B deactivates once the battery charge drops to

11.6V (20% charge left). The truth table for the charge control is given in Table 3.

**3.4. Microcontroller model** 

**Figure 12.** Microcontroller model

**Figure 13.** Block diagram of charge control

**3.5. Charger model** 

simulation.

#### **3.3. LDR sensor model**

The LDR sensor is a variable resistor that changes the resistance according to the intensity of incident ray illuminated onto it. As the intensity of sunlight changes, the resistance and the voltage of LDR sensors change. The output voltage across the resistor (resistance value of 100Ω) is converted into digital signal at the input of the microcontroller. Based on the TTL input, the servo motor rotates clockwise (CW) or anticlockwise (CCW). In the LDR sensor model as shown in Fig. 11, the difference between the panel angle and the assumed sun position was calculated. The angles were limited to +/- 90 degrees. When 90 degrees is reached, the LDR sensor output a zero irradiance that corresponds to a certain voltage as shown in Table 1. Recalled, V\_LDR\_B and V\_LDR\_T are the voltage output from the bottom and top sensors.

**Figure 11.** LDR sensor model

## **3.4. Microcontroller model**

264 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

30 start angle (7am)

.004167 15\_deg/hr Product

Actual irradiance data

Irradiance

Add

3 Time

2 Angle

1 Irradiance\_out

The LDR sensor is a variable resistor that changes the resistance according to the intensity of incident ray illuminated onto it. As the intensity of sunlight changes, the resistance and the voltage of LDR sensors change. The output voltage across the resistor (resistance value of 100Ω) is converted into digital signal at the input of the microcontroller. Based on the TTL input, the servo motor rotates clockwise (CW) or anticlockwise (CCW). In the LDR sensor model as shown in Fig. 11, the difference between the panel angle and the assumed sun position was calculated. The angles were limited to +/- 90 degrees. When 90 degrees is reached, the LDR sensor output a zero irradiance that corresponds to a certain voltage as shown in Table 1. Recalled, V\_LDR\_B and V\_LDR\_T are the voltage output from the bottom and top sensors.

**Figure 10.** Sun's model

**3.3. LDR sensor model** 

Simualation time(sec)

12:34 Digital Clock

**Figure 11.** LDR sensor model

As shown in Fig. 12, the microcontroller model is modeled using the embedded MATLABTM function. The inputs to this function are LDR\_B and LDR\_T, a real-time clock and initial buffer value of 1.5. One of the inputs (named Extime) is used to compare the current time with the previous time when the PWM value changes. The microcontroller generates output duration of 1.5ms to rotate the PV panel if the voltage difference of the LDR sensors is less than 0.07V and are both less than 0.75V (very low irradiance). If LDR sensor's voltages are both greater than 0.75V but the voltage difference is less than 0.07V, the PV panel remains in the current position. When the LDR sensor values is greater than 0.07V, the motor turns the PV panel by adjusting its PWM value until the sensors' voltages are equal. The delay time of 0.7 seconds and increment steps were found using the trial-and-error method during the simulation.

**Figure 12.** Microcontroller model

## **3.5. Charger model**

A charger is essential to protect the battery from over-charged and fully drained. In an ideal case, the battery charge remains between 20% and 100% based on a PSpice photovoltaic model [27]. This charger model (see Fig. 13) includes two switches namely: Switch A and B to control the battery voltage flow. Switch A remains deactivated for any value of battery charge above 12.95V (100% charged). Switch B deactivates once the battery charge drops to 11.6V (20% charge left). The truth table for the charge control is given in Table 3.

**Figure 13.** Block diagram of charge control

The Switch A is connected to the PV module on one side and the battery on the other side. When the net output current from the PV panel is positive, it begins to charge the battery until the maximum charge of 12.95V is reached. When there is no current from PV panel, the switch remains activated, the current required is obtained from the battery. After the battery is fully charged, the switch disconnects. The switch is activated again if the battery voltage drops below to 12.2 V.

The Switch B is connected when the battery is in charging mode (greater than 12.25V). When the battery voltage drops below 11.6 V, the battery is draining, and hence it is important to cut off the loads in order not to damage the motor. The conditions for the switching are given in Table 3 and the corresponding values of Switch A and Switch B (previous states and current states) are given by X, Y, M and N respectively. The value '1' represents the closed switch and '0' represents the open switch.



Model-Based Simulation of an Intelligent Microprocessor-Based Standalone Solar Tracking System 267

The lead-acid battery model was implemented based on a PSpice model [27] for a lead acid battery. It has two modes of operation – charging and discharging modes. When the current to the battery is positive (negative), the battery is in the charging (discharging) mode. The

As *SOC* varies linearly with *Vocb* (open circuit voltage of the battery), the relationship between

open circuit battery voltage and state of charge can be determined using the Table 4.

following parameters were used for modeling the battery.

*Kb* (no unit) is the charging and discharging battery efficiency.

Voltage State of Charge (%)

11.76 Completely discharged

12.63 100

12.54 90

12.45 80

12.39 75

12.27 60

12.18 50

11.97 25

**Table 4.** State of charge with respect to Voc

 *SOC1* is the initial state of charge, *SOC* (%) is the available charge. *SOCm* is the maximum state of charge. *ns* is the number of 2V cells in series. *D* (h-1) is the self-discharge rate of battery.

**3.6. Battery model** 

**Table 3.** Truth table used for discharging (left) and charging (right) condition

The Simulink model of the charger can be seen in Fig. 14. The Compare block diagrams were used to compare the various conditions as shown in Table 3. The logic gate after the comparisons serves as the truth table for operating the Switch A and B.

**Figure 14.** Charger model in Simulink

## **3.6. Battery model**

266 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

drops below to 12.2 V.

closed switch and '0' represents the open switch.

**Figure 14.** Charger model in Simulink

**Table 3.** Truth table used for discharging (left) and charging (right) condition

comparisons serves as the truth table for operating the Switch A and B.

The Switch A is connected to the PV module on one side and the battery on the other side. When the net output current from the PV panel is positive, it begins to charge the battery until the maximum charge of 12.95V is reached. When there is no current from PV panel, the switch remains activated, the current required is obtained from the battery. After the battery is fully charged, the switch disconnects. The switch is activated again if the battery voltage

The Switch B is connected when the battery is in charging mode (greater than 12.25V). When the battery voltage drops below 11.6 V, the battery is draining, and hence it is important to cut off the loads in order not to damage the motor. The conditions for the switching are given in Table 3 and the corresponding values of Switch A and Switch B (previous states and current states) are given by X, Y, M and N respectively. The value '1' represents the

The Simulink model of the charger can be seen in Fig. 14. The Compare block diagrams were used to compare the various conditions as shown in Table 3. The logic gate after the The lead-acid battery model was implemented based on a PSpice model [27] for a lead acid battery. It has two modes of operation – charging and discharging modes. When the current to the battery is positive (negative), the battery is in the charging (discharging) mode. The following parameters were used for modeling the battery.


As *SOC* varies linearly with *Vocb* (open circuit voltage of the battery), the relationship between open circuit battery voltage and state of charge can be determined using the Table 4.


**Table 4.** State of charge with respect to Voc

The terminal voltage for the battery is given by:

$$V\_{bat} = V\_1 + I\_{bat}R\_1 \tag{12}$$

Model-Based Simulation of an Intelligent Microprocessor-Based Standalone Solar Tracking System 269

Subtract1

0.8 Constant1

3600 Constant4

> 1e-5 Constant3

84 Constant2

Product5

Product

Product3

Add1

Add2

The solar panel is designed to drive the PV panel in a small angle, between 0 to 180 degrees at a low speed. PWM is used to control the motor. The PWM is a continuous square wave with a period of 20ms. With the PWM signal, the output shaft of the servo motor changes the angular position of the PV panel. The following parameters are used for the servo motor.

2 Vbat

Scope

Divide3

Divide1

Subtract

Display7

1 SOC

1 xos Integrator

Divide

For the PWM servo motor, the transfer function between the output rotational angle and the

**Figure 15.** Battery model in Simulink

f(u) Vdch

> f(u) Rch

f(u) Rdch

2 Initial SOC

f(u) Vch

> 0 Compare To Constant

<= 0 Compare To Constant1

Memory

1 In1

**3.7. PWM servo motor model** 

Moment of inertia (*J*) = 0.01 kg.m2/s2;

Product4

Product1

Product2

Add

 Electromotive force constant (*Kt*) = 0.01Nm/Amp; Back electromotive force constant (*Ke*) = 0.01s.s/rad;

Damping ratio (*b*) = 0.1 Nms;

 Electric resistance (*Rm*) = 1 ohm; Electric inductance (*Lm*) = 0.5H;

 Input Voltage (*Vm*); Output angle (*θ*);

input voltage is written as follows.

Here *V1* and *R1* both depend on the mode of battery operation and have different equations. Battery current; *Ibat* is positive when battery is in charge (ch) mode and negative when in discharge (dch) mode.

In charging mode, we can write the resistance and voltage as follows:

$$R\_1 = R\_{ch} = \left( 0.758 + \frac{0.139}{[1.06 - SOC(t)]n\_s} \right) \frac{1}{SOC\_m} \tag{13}$$

$$V\_1 = V\_{ch} = [2 + 0.148 \, \text{SOC(t)}] \eta\_s \tag{14}$$

where *SOC* (*t*) represents the current state of charge (%), *SOC* (*t*) is defined by a set of equations later. In discharging mode, the resistance and voltage are written as follows:

$$R\_1 = R\_{dch} = \left( 0.19 + \frac{0.1037}{\left[ \text{SOC} \{ t \} - 0.14 \} \mathbb{I}\_s \right] \frac{1}{\text{SOC}\_m} \right) \tag{15}$$

$$V\_1 = V\_{dch} = [1.926 + 0.124 \, \text{SOC(t)}] \eta\_s \tag{16}$$

To estimate the value of *SOC* (*t*), the following equations have been used to describe them in the PSpice model[27].

$$\text{SOC(}t+dt\text{)} = \text{SOC(t)} \left(1 - \frac{D \text{ } dt}{3600}\right) + \frac{K\_b \left(V\_{bat}I\_{bat} - \text{R}\_1 I\_{bat}\right)^2}{3600} \tag{17}$$

In equation (17), the time is assumed in seconds, so some terms must be divided by 3600 such that *SOC* is in Wh. By substituting *Vba*t as a function of *V1*, the value of *SOC* (*t*) can be determined as shown.

$$\text{SOC(t)} = \text{SOC(t-1)} + \frac{1}{3600} \int\_{t-1}^{t} \left[ \frac{K\_b V\_1 I\_{\text{but}}}{\text{SOC}\_m} - \text{SOC(t-1)D} \right] dt \tag{18}$$

The Simulink model in Fig. 15 is used to model the charging and discharging conditions during the process. The left-hand side of the Fig. 15 shows the respective functions used. There are namely: *Vch*, *Vdch*, *Rch* and *Rdch*. The input to the battery is the net current output from the PV panel and the output is the battery voltage, *Vbat*. In order to obtain 12V, six 2V cells denoted by ns were used. The maximum state of charge, *SOCm* was set to 84. The discharge rate, *D* and the efficiency, *Kb* are set as 1.5×10-5 and 0.8 respectively. As the battery is in charging or discharging mode, it allows only one value for *R*1 and *V1* to the equations.

**Figure 15.** Battery model in Simulink

In charging mode, we can write the resistance and voltage as follows:

Here *V1* and *R1* both depend on the mode of battery operation and have different equations. Battery current; *Ibat* is positive when battery is in charge (ch) mode and negative when in

[1.06 ( )] *ch*

0.139 1 0.758

.

0.1037 1 0.19

*SOC t n SOC*

.

 

where *SOC* (*t*) represents the current state of charge (%), *SOC* (*t*) is defined by a set of equations later. In discharging mode, the resistance and voltage are written as follows:

[ ( ) 0.14] *dch*

To estimate the value of *SOC* (*t*), the following equations have been used to describe them in

<sup>1</sup> ( ) () 1 <sup>3600</sup> <sup>3600</sup> *D dt K V I R I dt b bat bat bat SOC t dt SOC t* 

In equation (17), the time is assumed in seconds, so some terms must be divided by 3600 such that *SOC* is in Wh. By substituting *Vba*t as a function of *V1*, the value of *SOC* (*t*) can be

> 1 <sup>1</sup> ( ) ( 1) ( 1) <sup>3600</sup> *t*

The Simulink model in Fig. 15 is used to model the charging and discharging conditions during the process. The left-hand side of the Fig. 15 shows the respective functions used. There are namely: *Vch*, *Vdch*, *Rch* and *Rdch*. The input to the battery is the net current output from the PV panel and the output is the battery voltage, *Vbat*. In order to obtain 12V, six 2V cells denoted by ns were used. The maximum state of charge, *SOCm* was set to 84. The discharge rate, *D* and the efficiency, *Kb* are set as 1.5×10-5 and 0.8 respectively. As the battery is in charging or discharging mode, it allows only one value for *R*1 and *V1* to the

*KVI SOC t SOC t SOC t D dt SOC*

*b bat t m*

 (18)

<sup>2</sup>

*V V IR bat* 1 1 *bat* (12)

*s m*

<sup>1</sup> [2 0.148 ( )] *V Vch <sup>s</sup> SOC t n* (14)

*s m*

<sup>1</sup> [1.926 0.124 ( )] *V Vdch <sup>s</sup> SOC t n* (16)

(13)

(15)

(17)

*SOC t n SOC*

The terminal voltage for the battery is given by:

1

1

<sup>1</sup>

*R R*

*R R*

discharge (dch) mode.

the PSpice model[27].

determined as shown.

equations.

## **3.7. PWM servo motor model**

The solar panel is designed to drive the PV panel in a small angle, between 0 to 180 degrees at a low speed. PWM is used to control the motor. The PWM is a continuous square wave with a period of 20ms. With the PWM signal, the output shaft of the servo motor changes the angular position of the PV panel. The following parameters are used for the servo motor.


For the PWM servo motor, the transfer function between the output rotational angle and the input voltage is written as follows.

$$\frac{\theta(s)}{V\_m(s)} = \frac{15}{(s+1)(s+1)+14} = \frac{15}{s^2+2s+15} \tag{19}$$

Model-Based Simulation of an Intelligent Microprocessor-Based Standalone Solar Tracking System 271

1/7

 1 2 2 3

*h h*

*h h*

1/7 2 2

where *h1* and *h3* are heights of each side of the solar tracker; *h2* is height of centre axis of rotation as shown in Fig. 17. This moment differential about the central axis, due to the wind force, can be modeled using MATLAB/Simulink as a continual force that consumes the

The Simulink model is shown in Fig.18. Equation (23) was modeled in Simulink. The integral terms in (23) are modeled as a summation in the difference between the lower vertical height (*y*-*h2*) acting in counter-clockwise direction and its upper vertical height (*h2*-*y*) acting in the clockwise direction. The values for the parameters as shown in Fig. 18 are as

<sup>2</sup> 1/7 1/7 <sup>2</sup> 7/2 7/2

(21)

(23)

(22)

*<sup>a</sup>* = 1.165 kg/m3 (at outdoor temperature

1/7 ( ) *Uo du dy <sup>d</sup>*

For a certain velocity at any height above the ground, the drag force acting on a tilted plate

Using (21) and (22), the wind drag force must be integrated over the area of the tilted solar tracker facing the wind. The resulting moment or torque about the central axis becomes:

cos ( ) <sup>2</sup>

*<sup>U</sup> dM C A y h dy h y dy <sup>d</sup>*

*o*

of 30oC), *A* = 0.092m2, *Uo*=0.8m/s (around 1.56 knots) , *Cd* =1.0 and *d*=1m.

 

follows: *h1*=0.415m, *h2*=0.500m, *h3*=0.585m, *L*= 0.34m,

1 <sup>2</sup> <sup>2</sup> *D da a F C AU* 

**Figure 17.** Schematic diagram of disturbances acting on solar tracker

Taking small changes on both sides,

1

current obtained from the irradiance.

*da a*

is written as:

Based on this transfer function, the servo motor model can be modeled in Simulink (as seen in Fig. 16) using the look-up tables. The look-up table uses the PWM as an input to rotate the motor to a pre-determined angle. When pulse width changes from 1.25ms to 1.75ms, the panel angle changes from the 0 degree to 180 degrees in a linear manner. The second lookup table on the feedback path provides the actual pulse width results. The actual and the desired pulse-width are then compared to obtain the error signal for the Proportional-Integral-Derivative (PID) controller (using the controller gains: 60, 30, 3 *KKK pID* ) to drive the motor to the desired angle. The embedded MATLABTM function block is used to deactivate the motor load when it is not turning. An external load was added to show whether the motor is able to drive the PV panel. The weight could vary due to the modeling error. In this case, the external load is modeled as a pure resistance value (40).

**Figure 16.** PWM Servo motor model in Simulink

#### **3.8. Wind model**

Tracking the sun irradiance in an ideal condition would involve no disturbances on the system. But in practice, factors such as external force like wind and rain (as seen in Fig. 17) moves the tracker away from its position. It is therefore vital for the solar tracker to be able to track the sun throughout the daytime. Two types of disturbances are considered: wind and raindrop as depicted in Fig. 17 schematically.

The drag force due to the wind comprises of two main forms: (a) friction drag is present when the panels are near to horizontal position; (b) Pressure drag is prominent when the tracker is positioned near to vertical position. As a preliminary model, the drag coefficient is modeled as a flat plate and the area of the solar tracker varies with angle,. The seventh power law [28], as shown below can estimate the air velocity over the tracker.

$$\frac{\mu}{dL\_o} = \left(\frac{y}{d}\right)^{1/7} \tag{20}$$

where *u* is air velocity at height *y*; *U0* is air velocity at boundary layer; *y* is height above surface; *d* is height of boundary layer (taken from ground).

**Figure 17.** Schematic diagram of disturbances acting on solar tracker

Taking small changes on both sides,

270 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

*s*

**Figure 16.** PWM Servo motor model in Simulink

and raindrop as depicted in Fig. 17 schematically.

surface; *d* is height of boundary layer (taken from ground).

**3.8. Wind model** 

( ) 15 15 *<sup>m</sup>*( ) ( 1)( 1) 14 2 15

Based on this transfer function, the servo motor model can be modeled in Simulink (as seen in Fig. 16) using the look-up tables. The look-up table uses the PWM as an input to rotate the motor to a pre-determined angle. When pulse width changes from 1.25ms to 1.75ms, the panel angle changes from the 0 degree to 180 degrees in a linear manner. The second lookup table on the feedback path provides the actual pulse width results. The actual and the desired pulse-width are then compared to obtain the error signal for the Proportional-Integral-Derivative (PID) controller (using the controller gains: 60, 30, 3 *KKK pID* ) to drive the motor to the desired angle. The embedded MATLABTM function block is used to deactivate the motor load when it is not turning. An external load was added to show whether the motor is able to drive the PV panel. The weight could vary due to the modeling

*Vs s s s s*

error. In this case, the external load is modeled as a pure resistance value (40).

Tracking the sun irradiance in an ideal condition would involve no disturbances on the system. But in practice, factors such as external force like wind and rain (as seen in Fig. 17) moves the tracker away from its position. It is therefore vital for the solar tracker to be able to track the sun throughout the daytime. Two types of disturbances are considered: wind

The drag force due to the wind comprises of two main forms: (a) friction drag is present when the panels are near to horizontal position; (b) Pressure drag is prominent when the tracker is positioned near to vertical position. As a preliminary model, the drag coefficient is

1/7

modeled as a flat plate and the area of the solar tracker varies with angle,

power law [28], as shown below can estimate the air velocity over the tracker.

*o*

*u y U d* 

where *u* is air velocity at height *y*; *U0* is air velocity at boundary layer; *y* is height above

2

(19)

(20)

. The seventh

$$d\mu = \frac{\mathcal{U}\_o}{d^{1/7}} (dy)^{1/7} \tag{21}$$

For a certain velocity at any height above the ground, the drag force acting on a tilted plate is written as:

$$F\_D = \frac{1}{2} C\_d \rho\_a A\_a U^2 \tag{22}$$

Using (21) and (22), the wind drag force must be integrated over the area of the tilted solar tracker facing the wind. The resulting moment or torque about the central axis becomes:

$$dM = \frac{1}{2} \mathbb{C}\_d \rho\_d A\_d \cos\theta \left(\frac{\mathcal{U}\_o}{d^{1/7}}\right)^2 \left[ \left(\int\_{h\_2}^{h\_1} \left(y - h\_2\right)^{7/2} dy\right)^{1/7} - \left(\int\_{h\_3}^{h\_2} \left(h\_2 - y\right)^{7/2} dy\right)^{1/7} \right]^2 \tag{23}$$

where *h1* and *h3* are heights of each side of the solar tracker; *h2* is height of centre axis of rotation as shown in Fig. 17. This moment differential about the central axis, due to the wind force, can be modeled using MATLAB/Simulink as a continual force that consumes the current obtained from the irradiance.

The Simulink model is shown in Fig.18. Equation (23) was modeled in Simulink. The integral terms in (23) are modeled as a summation in the difference between the lower vertical height (*y*-*h2*) acting in counter-clockwise direction and its upper vertical height (*h2*-*y*) acting in the clockwise direction. The values for the parameters as shown in Fig. 18 are as follows: *h1*=0.415m, *h2*=0.500m, *h3*=0.585m, *L*= 0.34m, *<sup>a</sup>* = 1.165 kg/m3 (at outdoor temperature of 30oC), *A* = 0.092m2, *Uo*=0.8m/s (around 1.56 knots) , *Cd* =1.0 and *d*=1m.

Model-Based Simulation of an Intelligent Microprocessor-Based Standalone Solar Tracking System 273

(24)

Raindrop is driven along by the gravitational force. The movements can be evaluated by considering the equation of motion of the particles in horizontal along-wind, cross-wind and vertical directions. In this paper, we considered the raindrop that is not driven by the wind. Instead, we consider the mass of rain droplet (*m*) acting on the surface of the solar tracker. As the volume of the rain droplet is spherical in shape, the mass can be computed by multiplying it by the water density. The total force acting on the surface of the solar tracker

> 4 <sup>3</sup> <sup>3</sup> *R rw F rg*

In the simulation, the total force, *Fr* acting on the surface of the solar tracker could be easily modeled. The point force acting on the surface is translated into the torque acting about the central axis by multiplying the value by *L*/2 (that is half of the width of the solar panel). The radius of the rain droplet *rr* is assumed to be small, that is 0.25mm instead of large raindrop.

In order to validate the proposed modeling, it was necessary to compare the experiment results for the fixed panel with the smart solar tracker system. To obtain this data, simple experiments were performed. The experiment setup for both fixed, and tracker system can be seen in Fig. 21. The setups were installed on building roof top that was 40m above the ground. The temperatures during the experiment were recorded using the Type-K thermocouple sensor. The open-circuit voltage and the current readings were recorded using a multi-meter connected to the solar cells. The climatic condition considered for

The current consumed as a result of the rain droplet is around 0.011 mA.

**Figure 20.** Rain droplet model on surface of solar tracker

**4. Experimental and simulation results** 

*<sup>w</sup>* is the water density, *rr* is the radius of the raindrop and *g* is the gravitational

**3.9. Raindrop** 

can be computed as:

where 

constant.

**Figure 18.** Simulink model for wind force

As shown in Fig. 19, the increases in the wind speed causes the current consumption (or moment) acting on the tilted solar tracker to increases. It could be observed that the wind loading is cyclic in nature as the moment acting on the solar tracker changes as time increases. As an increase in the torque required implies an increase in the current (as shown in the relationship *Kt*=0.01Nm/A) needed to drive the tilted solar tracker, this causes an increase in the current drawn from the battery. For a wind speed of 0.8m/s (or 1.56 knots), the estimated moment acting on the tilted solar tracker is estimated to be around 0.0022Nm and the corresponding current consumed is computed to be approximately 0.22A.

**Figure 19.** Current consumed due to wind force over time

#### **3.9. Raindrop**

272 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

h2-h3 limit

y

h1-h2 limit

y

h2 0.5

Memory <sup>u</sup><sup>v</sup>

As shown in Fig. 19, the increases in the wind speed causes the current consumption (or moment) acting on the tilted solar tracker to increases. It could be observed that the wind loading is cyclic in nature as the moment acting on the solar tracker changes as time increases. As an increase in the torque required implies an increase in the current (as shown in the relationship *Kt*=0.01Nm/A) needed to drive the tilted solar tracker, this causes an increase in the current drawn from the battery. For a wind speed of 0.8m/s (or 1.56 knots), the estimated moment acting on the tilted solar tracker is estimated to be around 0.0022Nm

0 50 100 150 200 250 300

Time (sec)

sum MATLAB Function

1/7

0.8 m/s(~1.6 Knots) 3.2 m/s(~6.2 Knots) 4.8 m/s(~9.3 Knots) 6.4 m/s(~12.4 Knots) 8 m/s (~15.6 Knots)

<sup>u</sup><sup>v</sup> <sup>u</sup><sup>v</sup>

To Workspace h2\_y

1/7

sum MATLAB Function

To Workspace y\_h2

integral y-h2

1/Kt 1/0.01

u2

Product

uv

dM

To Workspace2 dm

current

To Workspace1 iw

integral h 2-y

and the corresponding current consumed is computed to be approximately 0.22A.

Memory

7/2

7/2

uv

**Figure 18.** Simulink model for wind force

u2

L/2 0.34/2

uo (velocity) uo(j)

Ramp

d (dist above surface ) 1

1/7

pA 1.1644\*0.34\*0.27

D2R

Constant 1/2

> Cd 1

> > cos

**Figure 19.** Current consumed due to wind force over time


X: 4 Y: 0.2256

Current Consumed (A)

Raindrop is driven along by the gravitational force. The movements can be evaluated by considering the equation of motion of the particles in horizontal along-wind, cross-wind and vertical directions. In this paper, we considered the raindrop that is not driven by the wind. Instead, we consider the mass of rain droplet (*m*) acting on the surface of the solar tracker. As the volume of the rain droplet is spherical in shape, the mass can be computed by multiplying it by the water density. The total force acting on the surface of the solar tracker can be computed as:

$$F\_R = \frac{4}{3}\pi r\_r^3 \rho\_w g$$

where *<sup>w</sup>* is the water density, *rr* is the radius of the raindrop and *g* is the gravitational constant.

In the simulation, the total force, *Fr* acting on the surface of the solar tracker could be easily modeled. The point force acting on the surface is translated into the torque acting about the central axis by multiplying the value by *L*/2 (that is half of the width of the solar panel). The radius of the rain droplet *rr* is assumed to be small, that is 0.25mm instead of large raindrop. The current consumed as a result of the rain droplet is around 0.011 mA.

**Figure 20.** Rain droplet model on surface of solar tracker

### **4. Experimental and simulation results**

In order to validate the proposed modeling, it was necessary to compare the experiment results for the fixed panel with the smart solar tracker system. To obtain this data, simple experiments were performed. The experiment setup for both fixed, and tracker system can be seen in Fig. 21. The setups were installed on building roof top that was 40m above the ground. The temperatures during the experiment were recorded using the Type-K thermocouple sensor. The open-circuit voltage and the current readings were recorded using a multi-meter connected to the solar cells. The climatic condition considered for

experimental was sunny during the entire test period. The average temperature recorded was around 30C and the local wind speed was broadcasted to be around 0.8m/s (or 1.6knots) during the tests.

Model-Based Simulation of an Intelligent Microprocessor-Based Standalone Solar Tracking System 275

In Fig. 23, the simulated power output (or current) over the day was quite close to the actual results obtained. There was some slight deviation during the noon and evening period due to the modeling of the actual irradiance obtained from the experiment. Furthermore, the current consumed during the actual test was different as the wind loading and other

The output power of the smart tracker was compared with the fixed panel design in order to determine the efficiency of the solar tracker system. As expected the overall power (or the efficiency) generated by the tracking panel is higher than that of the static panel. However, with the disturbances acting on the simulated models (see Fig. 23), the simulated curve exhibits closer behavior to the actual response obtained from experiment. Here, the efficiency refers to the ratio of difference between the sum of smart tracker and the fixed panel power to the sum of fixed panel power over the period of interest. The efficiency (obtain from experiment results) is around 20%. As compared to various the solar trackers as seen in [3], the average efficiency is around 12-15% and hence, the proposed design is slightly higher and comparable to the existing design. The solar tracker was efficient during most of the day except during the noon time where the sun irradiance was found to be the highest. The fixed panel that lies horizontally on the ground is therefore, quite comparable to the solar tracker system and hence zero efficiency was obtained. This explained why it is common to use a fixed panel in a sunny day where it experienced the maximum sun

For the cost and benefit of the proposed solar tracker system, it has some special features such as the initial expenditure on the equipment is usually high but there is no fuel cost involved, and the maintenance cost is low. The accumulated data [29] show that at present a PV system is competitive where small amounts of energy are required at a place that is far away from an electric grid or any other source of energy. For the economic evaluation of a system, the parameters that are usually considered are the life-cycle cost (LCC), payback

disturbances were not modeled in the simulation.

**Figure 23.** Simulated and actual power generated by smart solar tracker

irradiance during the noon time.

**Figure 21.** Experiment Setup for fixed (left) and smart tracker (right) system

The simulation results of the solar tracker using the Simulink are shown in Fig. 22. As observed from the plots, the solar tracker is able to follow the sun angle. In the plot, the smart solar tracker produces a higher current output as compared to the static PV panel. The other part of the graph shows the state of the charge during the simulation. As seen in the battery voltage, the Switch A was deactivated when the maximum allowable voltage of 12.95V reached. The switch B was always connected during the entire duration (in charging mode).

**Figure 22.** Simulation results of the standalone smart solar tracker

In Fig. 23, the simulated power output (or current) over the day was quite close to the actual results obtained. There was some slight deviation during the noon and evening period due to the modeling of the actual irradiance obtained from the experiment. Furthermore, the current consumed during the actual test was different as the wind loading and other disturbances were not modeled in the simulation.

**Figure 23.** Simulated and actual power generated by smart solar tracker

274 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

**Figure 21.** Experiment Setup for fixed (left) and smart tracker (right) system

**Figure 22.** Simulation results of the standalone smart solar tracker

0 0.5 1 1.5 2 2.5 3 3.5

Time (S)

0 0.5 1 1.5 2 2.5 3 3.5

Time (S)

0 0.5 1 1.5 2 2.5 3 3.5

Time (S)

0 0.5 1 1.5 2 2.5 3 3.5

Switch B

Time (S)

0 100 200

12 12.5 13

> 0 0.5 1

Degree

% Efficiency

Battery Voltage V

Switch B State

1.6knots) during the tests.

experimental was sunny during the entire test period. The average temperature recorded was around 30C and the local wind speed was broadcasted to be around 0.8m/s (or

The simulation results of the solar tracker using the Simulink are shown in Fig. 22. As observed from the plots, the solar tracker is able to follow the sun angle. In the plot, the smart solar tracker produces a higher current output as compared to the static PV panel. The other part of the graph shows the state of the charge during the simulation. As seen in the battery voltage, the Switch A was deactivated when the maximum allowable voltage of 12.95V reached. The switch B was always connected during the entire duration (in charging mode).

x 104

x 104

x 104

x 104

0 0.5 1 1.5

60 80 100

> 0 0.5 1

Switch A

Current (A)

Battery Charge %

Switch A State

Sun Angle Panel Angle x 104

x 104

x 104

0 0.5 1 1.5 2 2.5 3 3.5

Smart Panel current Static Panel current

Time (S)

0 0.5 1 1.5 2 2.5 3 3.5

State of Charge

Time (S)

0 0.5 1 1.5 2 2.5 3 3.5

Time (S)

The output power of the smart tracker was compared with the fixed panel design in order to determine the efficiency of the solar tracker system. As expected the overall power (or the efficiency) generated by the tracking panel is higher than that of the static panel. However, with the disturbances acting on the simulated models (see Fig. 23), the simulated curve exhibits closer behavior to the actual response obtained from experiment. Here, the efficiency refers to the ratio of difference between the sum of smart tracker and the fixed panel power to the sum of fixed panel power over the period of interest. The efficiency (obtain from experiment results) is around 20%. As compared to various the solar trackers as seen in [3], the average efficiency is around 12-15% and hence, the proposed design is slightly higher and comparable to the existing design. The solar tracker was efficient during most of the day except during the noon time where the sun irradiance was found to be the highest. The fixed panel that lies horizontally on the ground is therefore, quite comparable to the solar tracker system and hence zero efficiency was obtained. This explained why it is common to use a fixed panel in a sunny day where it experienced the maximum sun irradiance during the noon time.

For the cost and benefit of the proposed solar tracker system, it has some special features such as the initial expenditure on the equipment is usually high but there is no fuel cost involved, and the maintenance cost is low. The accumulated data [29] show that at present a PV system is competitive where small amounts of energy are required at a place that is far away from an electric grid or any other source of energy. For the economic evaluation of a system, the parameters that are usually considered are the life-cycle cost (LCC), payback period (PP) and rate of return (RR). LCC is the sum of all the costs of a system over its lifetime, expressed in today's money. In case of the analysis of a PV system, the lifetime of the modules is usually taken as 20 years. The calculations were made on the basis of the approach described in [29-30]. Our estimates of the electricity cost matched with those reported in [29] for the PV, diesel generator and grid-extension systems. Our analysis shows that the cost of electricity from a PV system is approximately equal to that from a diesel generator and cheaper than a grid extension. This PV system may be used for domestic applications, especially in remote areas. Keeping in view the environmental impact and economic assessments of the designed PV system it is evident to the listed data that the PV system even at present is a competitive choice for small power requirements. With the expectation that the cost of a solar module will reduce from around \$ 3/Wp to somewhere below \$2/Wp in the near future (see one of the quarterly report from Solarbuzz.com), a PV system may as well become an economic and more attractive option for higher loads.

Model-Based Simulation of an Intelligent Microprocessor-Based Standalone Solar Tracking System 277

[3] Mousazadeh H, Keyhani A, Javadi A, Mobli H, Abrinia K, Sharifi A (2009) A Review of Principle and Sun-Tracking Methods for Maximizing Solar Systems Output. Renewable

[4] Mwithiga G, Kigo S N (2006) Performance of a Solar Dryer with Limited Sun Tracking

[5] Poulek V (1994) Testing the New Solar Tracker with Shape Memory Alloy Actors. IEEE

[6] Clifford M J, Eastwood D (2004) Design of a Novel Passive Solar Tracker. Solar Energy

[7] Bingol O, Altintas A O (2006) Microcontroller Based Solar-Tracking System and Its

[8] Koyuncu B, Balasubramanian K (1991) A Microprocessor Controlled Automatic Sun

[9] Zeroual A, Raoufi M, Ankrim M, Wilkinson A J (1998) Design and Construction of a Closed Loop Sun-Tracker with Microprocessor Management. Solar Energy 19: 263-274. [10] Jinayim T, Arunrungrasmi S, Tanitteerapan T, Mungkung N (2007) Highly Efficient Low Power Consumption Tracking Solar Cells for White LED-Based Lighting System. International Journal of Electrical Computer and Systems Engineering 1: 1307-5179. [11] Hatfield P (2006) Low Cost Solar Tracker, Bachelor of Electrical Engineering Thesis, Department of Electrical and Computer Engineering, Curtin University of Technology. [12] Rumala S (1986) A Shadow Method for Automatic Tracking. Solar Energy 37: 245-247. [13] Palavras I, Bakos G C (2006) Development of a Low-Cost Dish Solar Concentrator and

[14] Kalogirou S A (1996) Design and Construction of a One-Axis Sun-Tracking. Solar

[15] Poulek V, Libra M (2000) A Very Simple Solar Tracker for Space and Terrestrial

[16] Mohamad A (2004) Efficiency Improvements of Photo-Voltaic Panels using a Sun

[17] Khader M, Badran O, Abdallah S (2008) Evaluating Multi-Axes Sun-Tracking System at Different Modes of Operation in Jordan. Renewable and Sustainable Energy Reviews

[18] Roth P, Georgiev A, Boudinov H (2004) Design and Construction of a System for Sun

[19] Hession P J, Bonwick W J (1984) Experience with a Sun Tracker. Solar Energy 32: 3-11. [20] Kulkarni S S, Thean C Y, Kong A W (2003) A Novel PC Based Solar Electric Panel Simulator. The Fifth International Conference on Power Electronics and Drive Systems:

[21] Yu T C, Chien T S (2009) Analysis and Simulation of Characteristics and Maximum Power Point Tracking for Photovoltaic Systems. International Conference on Power

[22] Tsai H L (2010) Insolation-Oriented Model of Photovoltaic Module using

and Sustainable Energy Reviews 13:1800-1818.

Capability. Journal of Food Engineering 74: 247-252.

Implementation. Journal of Engineering Sciences 12:243-248.

Tracker. IEEE Transactions on Consumer Electronics 37: 913-917.

its Application in Zeolite Desorption. Renewable Energy 3: 2422-2431.

Applications. Solar Energy Materials and Solar Cells 60: 99-103.

Tracking System. Applied Energy 79: 345-354.

Tracking. Renewable Energy 29: 393-402.

Electronics and Drive Systems: 1339-1344.

Matlab/Simulink. Solar Energy 84: 1318-1326.

Photovoltaic Specialists Conference 1: 1131–1133.

77: 269-280.

Energy 57: 465-469.

12: 864-873.

848 – 852.

## **5. Conclusions**

The design, modeling and testing of an active single axis solar tracker were presented. In the proposed design and operation of the solar tracker system, the sun was not constantly tracked based on the simulated irradiation. This helps to prevent unnecessary energy to be consumed by the devices and the system stops moving when the night falls. Hence, the proposed control structure provides the flexibility to accommodate different weather conditions, and also different user preference. The completed MATLABTM/SimulinkTM model of the solar tracker with external disturbances is first used to provide a computeraided design tool to determine the efficiency over the fixed solar panel, net current output, power generated and the types of PV systems that can be combined to give a required level of efficiency before actual implementation. The experimental results show a similar behavior in the power, the efficiency and the current output over the fixed solar panel when compared them with the simulation results. The external disturbances such as wind loading and raindrop model provide an insight to the impact of the current consumption on the model of the solar tracker before actual implementation.

## **Author details**

C.S. Chin *Faculty of Science Agriculture and Engineerin,Newcastle University, Newcastle upon Tyne , United Kingdom* 

## **6. References**


[3] Mousazadeh H, Keyhani A, Javadi A, Mobli H, Abrinia K, Sharifi A (2009) A Review of Principle and Sun-Tracking Methods for Maximizing Solar Systems Output. Renewable and Sustainable Energy Reviews 13:1800-1818.

276 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

period (PP) and rate of return (RR). LCC is the sum of all the costs of a system over its lifetime, expressed in today's money. In case of the analysis of a PV system, the lifetime of the modules is usually taken as 20 years. The calculations were made on the basis of the approach described in [29-30]. Our estimates of the electricity cost matched with those reported in [29] for the PV, diesel generator and grid-extension systems. Our analysis shows that the cost of electricity from a PV system is approximately equal to that from a diesel generator and cheaper than a grid extension. This PV system may be used for domestic applications, especially in remote areas. Keeping in view the environmental impact and economic assessments of the designed PV system it is evident to the listed data that the PV system even at present is a competitive choice for small power requirements. With the expectation that the cost of a solar module will reduce from around \$ 3/Wp to somewhere below \$2/Wp in the near future (see one of the quarterly report from Solarbuzz.com), a PV

system may as well become an economic and more attractive option for higher loads.

model of the solar tracker before actual implementation.

*Faculty of Science Agriculture and Engineerin,Newcastle University,* 

The design, modeling and testing of an active single axis solar tracker were presented. In the proposed design and operation of the solar tracker system, the sun was not constantly tracked based on the simulated irradiation. This helps to prevent unnecessary energy to be consumed by the devices and the system stops moving when the night falls. Hence, the proposed control structure provides the flexibility to accommodate different weather conditions, and also different user preference. The completed MATLABTM/SimulinkTM model of the solar tracker with external disturbances is first used to provide a computeraided design tool to determine the efficiency over the fixed solar panel, net current output, power generated and the types of PV systems that can be combined to give a required level of efficiency before actual implementation. The experimental results show a similar behavior in the power, the efficiency and the current output over the fixed solar panel when compared them with the simulation results. The external disturbances such as wind loading and raindrop model provide an insight to the impact of the current consumption on the

[1] Lopes L A C, Lienhardt A M, (2003) A Simplified Nonlinear Power Source for Simulating PV Panels. IEEE 34th Annual Conference on Power Electronics Specialist: 1729- 1734. [2] Kroposki B, DeBlasio R (2000) Technologies for the New Millennium: Photovoltaics as a Distributed Resource. IEEE Power Engineering Society Summer Meeting: 1798 – 1801.

**5. Conclusions** 

**Author details** 

**6. References** 

*Newcastle upon Tyne , United Kingdom* 

C.S. Chin

	- [23] Tsai H L, Tu C S, Su Y J (2008) Development of Generalized Photovoltaic Model Using MATLAB/Simulink, Proceedings of the World Congress on Engineering and Computer Science, San Francisco, USA:1-6.

**Chapter 12** 

© 2012 Al-Tabey, licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

© 2012 Al-Tabey, licensee InTech. This is a paper distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

**Micro-Robot Management** 

Additional information is available at the end of the chapter

Micro-Robots have been and continue to be essential components of medical field. Micro-Robots are used in medical field to surgical applications. Knowledge of the kinematics, dynamics and trajectory planning of these Micro-Robots is most important for their design and control. MATLAB is a modern tool that has transformed the mathematical calculations methods because MATLAB not only provides numerical calculations but also facilitates analytical calculations using the computer. The present textbook uses MATLAB as a tool to solve problems from micro-robots. The intent is to show the convenience of MATLAB for micro-robots analysis. Using example problems the MATLAB syntax will be demonstrated. MATLAB is very useful in the process of deriving solutions for any problem in microrobots. The chapter includes a most problem of micro-robots for surgical applications that are being solved using MATLAB. The programs are available at the end of this chapter.

Robots are widely used in medical field for getting minimally invasive surgery efficiently and accurately. Minimally invasive surgery is an innovative approach that allows reducing patient trauma, postoperative pain and recovery time [1]. The kinematic and dynamic analysis of the robot, for any applications whether in medical field or another, are very important. The direct aim is to properly select the workspace and the actuator size. Frumento [1] designed a minimally invasive robot for heart surgery. They concentrated mainly on the kinematic analysis and the workspace of the robot. Tsai and Hsu [3] investigated a parallel surgical robot having six degrees of freedom. They studied the kinematics only, to obtain the workspace of surgical robot and control it using Fuzzy Logic control. Miller and Christensen [4] analyzed the dynamics of the Multi-rigid-body robot using Newton's second law of motion and used the results to design the controller. Featherstone and Orin [5] investigated the robot dynamics and used Newton-Euler technique to obtain the equation and algorithms of robot motion. Wang, et al [6] designed the dimensional synthesis of 6-DOF Micro-surgery manipulator (Micro Hand) .They studied the kinematics and the workspace of the manipulator they considered by an Optimal design

Wael A. Al-Tabey

**1. Introduction** 

http://dx.doi.org/10.5772/39240


**Chapter 12** 

## **Micro-Robot Management**

Wael A. Al-Tabey

278 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

Science, San Francisco, USA:1-6.

3075-3090.

1208.

Energy 81: 31–38.

Sons, Chichester.

[23] Tsai H L, Tu C S, Su Y J (2008) Development of Generalized Photovoltaic Model Using MATLAB/Simulink, Proceedings of the World Congress on Engineering and Computer

[24] Chin C S, Babu A, McBride W (2011). Design, Modeling and Testing of a Standalone Single-Axis Active Solar Tracker using MATLAB/Simulink. Renewable Energy 36(11):

[25] Enrique J M, Duran E, Sidrach-de-Cardona M, Andu J M (2007) Theoretical Assessment of the Maximum Power Point Tracking Efficiency of Photovoltaic Facilities. Solar

[26] Villalva M G, Gazoli J R, Filho E R (2009) Comprehensive Approach to Modeling and Simulation of Photovoltaic Arrays. IEEE Transactions on Power Electronics 5: 1198–

[27] Luis C, Silvestre S (2002) Modelling Photovoltaic Systems Using PSpice, John Wiley and

[29] Karimov K S, Saqib M A, Akhter P, Ahmed M M, Chattha J A, Yousafzai S A (2005) A Simple Photo-Voltaic Tracking System. Solar Energy Materials and Solar Cells 87: 49-59.

[28] White F M (1999) Fluid Mechanics, fourth ed. McGraw-Hill.

[30] Markvart T (2000) Solar Electricity, Wiley, New York.

Additional information is available at the end of the chapter

http://dx.doi.org/10.5772/39240

## **1. Introduction**

Micro-Robots have been and continue to be essential components of medical field. Micro-Robots are used in medical field to surgical applications. Knowledge of the kinematics, dynamics and trajectory planning of these Micro-Robots is most important for their design and control. MATLAB is a modern tool that has transformed the mathematical calculations methods because MATLAB not only provides numerical calculations but also facilitates analytical calculations using the computer. The present textbook uses MATLAB as a tool to solve problems from micro-robots. The intent is to show the convenience of MATLAB for micro-robots analysis. Using example problems the MATLAB syntax will be demonstrated. MATLAB is very useful in the process of deriving solutions for any problem in microrobots. The chapter includes a most problem of micro-robots for surgical applications that are being solved using MATLAB. The programs are available at the end of this chapter.

Robots are widely used in medical field for getting minimally invasive surgery efficiently and accurately. Minimally invasive surgery is an innovative approach that allows reducing patient trauma, postoperative pain and recovery time [1]. The kinematic and dynamic analysis of the robot, for any applications whether in medical field or another, are very important. The direct aim is to properly select the workspace and the actuator size. Frumento [1] designed a minimally invasive robot for heart surgery. They concentrated mainly on the kinematic analysis and the workspace of the robot. Tsai and Hsu [3] investigated a parallel surgical robot having six degrees of freedom. They studied the kinematics only, to obtain the workspace of surgical robot and control it using Fuzzy Logic control. Miller and Christensen [4] analyzed the dynamics of the Multi-rigid-body robot using Newton's second law of motion and used the results to design the controller. Featherstone and Orin [5] investigated the robot dynamics and used Newton-Euler technique to obtain the equation and algorithms of robot motion. Wang, et al [6] designed the dimensional synthesis of 6-DOF Micro-surgery manipulator (Micro Hand) .They studied the kinematics and the workspace of the manipulator they considered by an Optimal design

© 2012 Al-Tabey, licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. © 2012 Al-Tabey, licensee InTech. This is a paper distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Micro-Robot Management 281

the adaptive controller using Lyapunov theory. The kinematic equations of mobile robot were found by inverse kinematics method to obtain the desired values of the linear and angular velocities, which represented the input to adaptive controller. Valero et al [15] investigated a trajectory planner for 3-DOF industrial robots that have to operate in workspaces with obstacles. They found the workspace modeling analytically using the differential equations of all joints angle and solved them in Cartesian coordinates system. The trajectory planner for 3-DOF industrial robots they found by workspace model using the finite element method for joints and end effector. Integrating all elements, the function of the trajectory planner for 3-DOF industrial robots was obtained. Finally they minimized the objective function of the trajectory planner to attain the minimum time. Geng [16] investigated the dynamics and trajectory planning of a planar flipping robot with two feet and one-leg robot. Geng made a dynamic analysis to obtain the trajectory planning using Lagrange's formulation. Geng presented the simulation results for joints kinetic variables with time. Alessandro and Vanni [17] investigated a technique for optimal trajectory planning of robot manipulators to minimize the jerk. They concentrated on the trajectory planning of robot manipulators. In order to get the optimal trajectory, an objective function composed of two terms was minimized. The first term was proportional to the total execution time, and the second was proportional to the integral of the squared jerk. Finally, they minimized the time of trajectory planning to minimize energy (or actuator effort) and jerk of manipulator joints. They represented the Simulation results for joints kinetic variables and jerk against the minimized time. Pires et al [18] tested a manipulator trajectory planning with multiple objectives and obstacle avoidance (MOEA).It is a non-trivial optimization problem. They concentrated on the trajectory planning of 2-DOF robot manipulators using MOEA method and simulated for several ranges of joint angle. Finally they gave the simulation results for joints kinetic variables with minimized time. Chettibi et al [19] studied the problem of minimum cost trajectory planning for 2-DOF industrial manipulators. They studied the optimal control via direct parameter optimization of joint positions then they concentrated on the trajectory planning of 2-DOF industrial manipulators for six ranges of joint angle. Finally, they represented the simulation results for joints kinetic variables, jerk and torque with minimized time, to obtain the optimum parameters of joint positions and minimum cost trajectory planning. Alessandro and Vanni [20] investigated a method for smooth trajectory planning of robot manipulators. In order to ensure that the resulting trajectory is smooth enough they used the same method used by them in reference. They also presented in their work a new method to obtain the smooth jerk by composing the overall trajectory with respect to other trajectory optimization

**1.1. Introductory remarks on robots for medical field applications** 

Robots in medicine are recent entry, beginning as generic instrumental aides and aiming at specialized duties once technology sophistication enables effective settings. Several classifications are used, mainly, dressing taxonomy by means of the expected

techniques.

accomplishments [1]:

method. Alici and Shirinzadeh [7] obtained the singularity loci of parallel manipulators exemplified by a 3-DOF spherical parallel manipulator. They utilized the inverse kinematics, and Jacobian matrices to obtain the velocity equation of the actuator and the end effector. The determinants of the manipulator Jacobian matrices were evaluated for a specified set of geometric parameters. Finally, the singularity loci of the manipulator in Cartesian space were generated. Ben-Horin, et al [8] analyzed the kinematics and dynamics of parallel robot consisting of three plenary actuated links [6-DOF parallel manipulator]. They investigated by direct kinematic analysis and obtained the dynamics equations and algorithms using Newton's second law and presented the system performance. Bonnifait and Garcia [9] studied the 6-DOF dynamic localization of an outdoor mobile robot. They obtained the robot dynamics equations and algorithms using the numerical method (Taylor method) and used the azimuth and elevation angles of known landmarks, collected by a rotating linear camera to obtain the simulation results of the robot. They finally presented and analyzed the results of real experiments, performed with an outdoor mobile robot. Abdellatif and Heimann [10] investigated the inverse dynamics equations of 6-DOF fully parallel manipulators using the Lagrangian formalism. With respect to a proposed set of generalized coordinates and velocities they obtained the final form with respect to the robot's active coordinates. Attention was paid to the transformation of the sub chains dynamics. Finally, a systematic study of the resulting computational effort was presented and discussed with respect to results of other methods and approaches of other researches. Zhu, et al [11] investigated the kinematic and dynamic modeling for a newly developed parallel robot with the proposed Tau configuration and used the inverse kinematics method to obtain the kinematic equations of end effector of 3-DOF parallel robot. The dynamic modeling of 3- DOF parallel robot was derived by analytical solutions, which were verified by both numerical simulation and actual experiments. This analytical approach enabled the realtime control of this parallel robot with high positioning accuracy. Gouliaev and Zavrazhina [12] investigated the dynamic and kinematic control of the spatial movements of a flexible multi-link manipulator. They focused on the dynamics of a flexible multi-link manipulator by Euler-Bernoulli method, so that each element was in a compound motion. A technique for the numerical construction of solutions for an essentially non-linear hybrid-type system of constituent equations was proposed. They used the linear control method. Eliodoro and Serna [13] investigated the inverse dynamics of flexible robots. They focused on the new and general technique for solving the inverse dynamics of flexible robots. The proposed method finds the joint torques that must be applied by the actuators to obtain a specified end-effector trajectory. The inverse dynamics of flexible robots are derived by using the Euler-Bernoulli beam theory and Lagrange's equations. The finite element method was utilized to discretize space variables. They finally established the global dynamic equations of the robot. Kinematic constraints were introduced in the dynamic equations by means of a penalty formulation. The system performance was drawn for different tip trajectories.

Martins et al [14] examined an adaptive controller to guide a unicycle-like mobile robot during trajectory tracking. They concentrated, mainly on the kinematic analysis to design the adaptive controller using Lyapunov theory. The kinematic equations of mobile robot were found by inverse kinematics method to obtain the desired values of the linear and angular velocities, which represented the input to adaptive controller. Valero et al [15] investigated a trajectory planner for 3-DOF industrial robots that have to operate in workspaces with obstacles. They found the workspace modeling analytically using the differential equations of all joints angle and solved them in Cartesian coordinates system. The trajectory planner for 3-DOF industrial robots they found by workspace model using the finite element method for joints and end effector. Integrating all elements, the function of the trajectory planner for 3-DOF industrial robots was obtained. Finally they minimized the objective function of the trajectory planner to attain the minimum time. Geng [16] investigated the dynamics and trajectory planning of a planar flipping robot with two feet and one-leg robot. Geng made a dynamic analysis to obtain the trajectory planning using Lagrange's formulation. Geng presented the simulation results for joints kinetic variables with time. Alessandro and Vanni [17] investigated a technique for optimal trajectory planning of robot manipulators to minimize the jerk. They concentrated on the trajectory planning of robot manipulators. In order to get the optimal trajectory, an objective function composed of two terms was minimized. The first term was proportional to the total execution time, and the second was proportional to the integral of the squared jerk. Finally, they minimized the time of trajectory planning to minimize energy (or actuator effort) and jerk of manipulator joints. They represented the Simulation results for joints kinetic variables and jerk against the minimized time. Pires et al [18] tested a manipulator trajectory planning with multiple objectives and obstacle avoidance (MOEA).It is a non-trivial optimization problem. They concentrated on the trajectory planning of 2-DOF robot manipulators using MOEA method and simulated for several ranges of joint angle. Finally they gave the simulation results for joints kinetic variables with minimized time. Chettibi et al [19] studied the problem of minimum cost trajectory planning for 2-DOF industrial manipulators. They studied the optimal control via direct parameter optimization of joint positions then they concentrated on the trajectory planning of 2-DOF industrial manipulators for six ranges of joint angle. Finally, they represented the simulation results for joints kinetic variables, jerk and torque with minimized time, to obtain the optimum parameters of joint positions and minimum cost trajectory planning. Alessandro and Vanni [20] investigated a method for smooth trajectory planning of robot manipulators. In order to ensure that the resulting trajectory is smooth enough they used the same method used by them in reference. They also presented in their work a new method to obtain the smooth jerk by composing the overall trajectory with respect to other trajectory optimization techniques.

280 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

performance was drawn for different tip trajectories.

Martins et al [14] examined an adaptive controller to guide a unicycle-like mobile robot during trajectory tracking. They concentrated, mainly on the kinematic analysis to design

method. Alici and Shirinzadeh [7] obtained the singularity loci of parallel manipulators exemplified by a 3-DOF spherical parallel manipulator. They utilized the inverse kinematics, and Jacobian matrices to obtain the velocity equation of the actuator and the end effector. The determinants of the manipulator Jacobian matrices were evaluated for a specified set of geometric parameters. Finally, the singularity loci of the manipulator in Cartesian space were generated. Ben-Horin, et al [8] analyzed the kinematics and dynamics of parallel robot consisting of three plenary actuated links [6-DOF parallel manipulator]. They investigated by direct kinematic analysis and obtained the dynamics equations and algorithms using Newton's second law and presented the system performance. Bonnifait and Garcia [9] studied the 6-DOF dynamic localization of an outdoor mobile robot. They obtained the robot dynamics equations and algorithms using the numerical method (Taylor method) and used the azimuth and elevation angles of known landmarks, collected by a rotating linear camera to obtain the simulation results of the robot. They finally presented and analyzed the results of real experiments, performed with an outdoor mobile robot. Abdellatif and Heimann [10] investigated the inverse dynamics equations of 6-DOF fully parallel manipulators using the Lagrangian formalism. With respect to a proposed set of generalized coordinates and velocities they obtained the final form with respect to the robot's active coordinates. Attention was paid to the transformation of the sub chains dynamics. Finally, a systematic study of the resulting computational effort was presented and discussed with respect to results of other methods and approaches of other researches. Zhu, et al [11] investigated the kinematic and dynamic modeling for a newly developed parallel robot with the proposed Tau configuration and used the inverse kinematics method to obtain the kinematic equations of end effector of 3-DOF parallel robot. The dynamic modeling of 3- DOF parallel robot was derived by analytical solutions, which were verified by both numerical simulation and actual experiments. This analytical approach enabled the realtime control of this parallel robot with high positioning accuracy. Gouliaev and Zavrazhina [12] investigated the dynamic and kinematic control of the spatial movements of a flexible multi-link manipulator. They focused on the dynamics of a flexible multi-link manipulator by Euler-Bernoulli method, so that each element was in a compound motion. A technique for the numerical construction of solutions for an essentially non-linear hybrid-type system of constituent equations was proposed. They used the linear control method. Eliodoro and Serna [13] investigated the inverse dynamics of flexible robots. They focused on the new and general technique for solving the inverse dynamics of flexible robots. The proposed method finds the joint torques that must be applied by the actuators to obtain a specified end-effector trajectory. The inverse dynamics of flexible robots are derived by using the Euler-Bernoulli beam theory and Lagrange's equations. The finite element method was utilized to discretize space variables. They finally established the global dynamic equations of the robot. Kinematic constraints were introduced in the dynamic equations by means of a penalty formulation. The system

#### **1.1. Introductory remarks on robots for medical field applications**

Robots in medicine are recent entry, beginning as generic instrumental aides and aiming at specialized duties once technology sophistication enables effective settings. Several classifications are used, mainly, dressing taxonomy by means of the expected accomplishments [1]:

1. Patients and disabled aid: bed automation, walking assistants, delivery servants, etc.

Micro-Robot Management 283

The systems in study at this present work are Zeus and Da Vinci robotic arms which are usually attached to a patient-side tower structure and consists of two to three arms that control the operative instruments and a separate arm that controls the video endoscope as

Both the Zeus and Da Vinci systems enhance dexterity in several ways. Internal software filters out the natural tremor of a surgeon's hand, which becomes particularly evident under high magnification and problematic when attempting fine maneuvers in very small fields. In addition, the system can scale movements such that large movements of the control grips can be transformed into smaller movements inside the patient. Finally the system group has 7-DOF. The Surgery arm has 6-DOF plus 1-DOF for the tool actuation. Arrangement, the DOF ''a'' and ''b'' are respectively the last DOF at the carrier and the 6-DOF robot joints has

shown in the Figure 1.

**Figure 1.** Zeus and Da Vinci robotic arms

**Figure 2.** The ZEUS® surgery tools

Roll-Yaw-Pitch motions as shown in the Figures .2, 3 and 4.


Moreover, roughly speaking, the example taxonomy distinguishes extra corporeal fixtures, mainly derived out of conventional technologies, from in-body active devices, generally requiring invasive actions, thus, critically dependent on micro-mechanics and nanotechnologies. With focus on surgery robots, four kinds of tasks are, generally, considered:


Surgical robotic systems are commonly classified according to the degree of direct control the surgeon has over the machine [2].Under this classification there are three principal types of robots Table 1:



**Table 1.** Classification of robotic surgical systems

The systems in study at this present work are Zeus and Da Vinci robotic arms which are usually attached to a patient-side tower structure and consists of two to three arms that control the operative instruments and a separate arm that controls the video endoscope as shown in the Figure 1.

**Figure 1.** Zeus and Da Vinci robotic arms

282 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

2. Laboratory support: clinical testers, radiation therapies assistants, etc.

1. Organ inspection: cerebral probing, laparoscopic monitoring, etc. 2. Organ nursing or repair: internal anastomosis, obstruction relief, etc.

3. Organ removal: cysts excision, lymph node dissection, etc.

2. Surgical Assist Device: surgeon and robot share control.

3. Teleoperator: function of the robot completely controlled by the surgeon.

PUMA (Programmable Universal Machine for Assembly)

4. (Artificial) organ implant: prosthesis insertion, etc.

considered:

of robots Table 1:

surgeon.

**Autonomous** 

**Surgical Assist** 

**Teleoperator** 

**Table 1.** Classification of robotic surgical systems

1. Patients and disabled aid: bed automation, walking assistants, delivery servants, etc.

Moreover, roughly speaking, the example taxonomy distinguishes extra corporeal fixtures, mainly derived out of conventional technologies, from in-body active devices, generally requiring invasive actions, thus, critically dependent on micro-mechanics and nanotechnologies. With focus on surgery robots, four kinds of tasks are, generally,

Surgical robotic systems are commonly classified according to the degree of direct control the surgeon has over the machine [2].Under this classification there are three principal types

1. Autonomous: performs a preoperative plan without any immediate control from the

**Type of system Examples Function(s) Clinical** 

Robodoc Percutaneous renal

Caspar Voice controlled

PAKY-RCM Prostatectomy Urology ProBot Hip surgery Urology

AESOP Stereotactic Multiple NeuroMate Neurosurgery Neurosurgery

Da Vinci Multiple Multiple Zeus Multiple Multiple Neurobot Multiple Neurosurgery

Acrobat Knee arthroplasty Orthopedic surgery

**Discipline(s)** 

needle placement Orthopedic surgery

telescope Orthopedic surgery

Multiple Multiple

3. Soundness care: pace-makers, health-monitors, drugs dosing up suppliers, etc. 4. Surgery help: surgeon's servants, remote effectors, autonomous actors, etc.

> Both the Zeus and Da Vinci systems enhance dexterity in several ways. Internal software filters out the natural tremor of a surgeon's hand, which becomes particularly evident under high magnification and problematic when attempting fine maneuvers in very small fields. In addition, the system can scale movements such that large movements of the control grips can be transformed into smaller movements inside the patient. Finally the system group has 7-DOF. The Surgery arm has 6-DOF plus 1-DOF for the tool actuation. Arrangement, the DOF ''a'' and ''b'' are respectively the last DOF at the carrier and the 6-DOF robot joints has Roll-Yaw-Pitch motions as shown in the Figures .2, 3 and 4.

**Figure 2.** The ZEUS® surgery tools

Micro-Robot Management 285

1. Find and identify all joint axes: Z0 to Zn-1.

5. Establish Yi to form a right hand system

6. Repeat Steps 3 to 5 for i= 1 : n-1.

10. Build forward kinematic solution: T�

**Figure 5.** Construction of the link frame

that n=oxa.

conveniently and to form a right hand frame.

If Zi intersects Zi-1 locate Oi at this intersection. If Zi-1 and Zi are parallel, locate Oi at Joint (i+1).

8. Create a table of "Link" parameters: See Figure 5. Joint Angle qi : angle between Xi-1 and Xi about Zi. Link Offset di : distance from Xi-1 and Xi along Zi. Link Twist ai : angle between Zi and Zi+1 about Xi. Link length ai : distance between Zi and Zi+1 along Xi.

table by substituting q, d, a and a into the general model.

2. Establish the base frame. Set base origin anywhere on the Z0 axis. Choose X0 and Y0

4. Establish Xi along the common normal between Zi-1 and Zi through Oi, or in the

Set Kn = a along the direction Zn-1 and establish the origin On conveniently along Zn, at center of tool tip. Set jn=o in the direction of tool closure (opening) and set in= n, such

If the tool is not a simple gripper, set Xn and Yn conveniently to form a right hand frame.

9. Form HTM matrices A1, A2 … An from the information contained in each row of the LP

� = A1\* A2 \* … \* An.

3. Locate the origin Oi where the common normal to Zi-1 and Zi intersects Zi.

direction normal to the plane Zi-1 - Zi if these axes intersect. See Figure 5.

7. Establish the end effector (n) frame: OnXnYnZn. Assuming the nth joint is revolute.

**Figure 3.** Da Vinci® surgery tools

**Figure 4.** Roll-Yaw-Pitch motions

## **2. The kinematic model**

## **2.1. The forward kinematics**

The forward kinematics problem is concerned with the relationship between the individual joints of the robot manipulator and the position and orientation of the tool or end effector. Stated more formally, the forward kinematics problem is to determine the position and orientation of the end effector, given the values for the joint variables of the robot. The joint variables are the angles between the links in the case of revolute or rotational joints, and the link extension in the case of prismatic or sliding joints.

The solution is always unique: one given joint position vector always corresponds to only one single end effector pose. The FK problem is not difficult to solve, even for a completely arbitrary kinematic structure.

There are different methods for a forward kinematic analysis: like using straightforward geometry and using transformation matrices.

### *2.1.1. The Denavit-Hartenberg convention*

The D-H modeling rules:

1. Find and identify all joint axes: Z0 to Zn-1.

284 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

The forward kinematics problem is concerned with the relationship between the individual joints of the robot manipulator and the position and orientation of the tool or end effector. Stated more formally, the forward kinematics problem is to determine the position and orientation of the end effector, given the values for the joint variables of the robot. The joint variables are the angles between the links in the case of revolute or rotational joints, and the

The solution is always unique: one given joint position vector always corresponds to only one single end effector pose. The FK problem is not difficult to solve, even for a completely

There are different methods for a forward kinematic analysis: like using straightforward

**Figure 3.** Da Vinci® surgery tools

**Figure 4.** Roll-Yaw-Pitch motions

**2. The kinematic model** 

arbitrary kinematic structure.

The D-H modeling rules:

**2.1. The forward kinematics** 

link extension in the case of prismatic or sliding joints.

geometry and using transformation matrices.

*2.1.1. The Denavit-Hartenberg convention* 


If the tool is not a simple gripper, set Xn and Yn conveniently to form a right hand frame.

8. Create a table of "Link" parameters: See Figure 5. Joint Angle qi : angle between Xi-1 and Xi about Zi. Link Offset di : distance from Xi-1 and Xi along Zi. Link Twist ai : angle between Zi and Zi+1 about Xi.

Link length ai : distance between Zi and Zi+1 along Xi.


**Figure 5.** Construction of the link frame

### **2.2. The kinematics of Zeus and Da Vinci robotic arms**

The geometrical model of the surgical robot in this study has 6 degrees of freedom (DOF) and an extra one for tool action. The end-effector has 3 rotations (Roll, Pitch and Yaw) as shown in Figure 6 and the frame assignment of 6-DOF surgical manipulator is represented in Figure 7.

Micro-Robot Management 287

The 6-DOF manipulator kinematic parameters are derived using Denavit Hartemberg

Link # θ<sup>j</sup> dj aj α<sup>j</sup> T θ<sup>1</sup> 0 L1 0 0T1 θ<sup>2</sup> 0 L2 90 1T2 θ<sup>3</sup> 0 0 -90 2T3 θ<sup>4</sup> L3 0 90 3T4 θ<sup>5</sup> 0 0 -90 4T5 θ<sup>6</sup> L4 0 0 5T6

The flowchart representing the sequence of generating the MATLAB CODE of the link

ROBOT ARCHITECTURE

JOINT COORDINATES:

JOINT RANGES:

DENAVIT HARTEMBERG

formulation shown in Table 2.

**Table 2.** Full mobility robotic tool: geometry and link parameters

transformations matrix is shown in Figure 8.

**Figure 8.** The flowchart of the link transformations matrix

j

The link transformations matrix can be given as:

*C S LC S C LS <sup>T</sup>*

0 1 1 11

1 1 11

0 0 0 01 0 0 00 1

1

T

The general form of the Homogeneous Transformation Matrix is:

 2

0 sin cos

 

j jj j j j


TRANSFORMATION MATRIX

GEOM**ET**RY PARAMETERS: L1, L2, L3, L4

00 0 1

 2 2 22

*C S LC S C LS <sup>T</sup>*

01 0 0 00 0 1

1 2 2 22

0 0

cos sin cos sin sin cos sin cos cos cos sin sin

j j

j-1 j jj j j j

 

> 

 

*j j j*

3

*a a d*

 

(1)

 3 3

*C S*

0 0 0 0 0 100 00 01

2 3 3

*S C <sup>T</sup>*

**Figure 6.** The geometrical model of surgical manipulator

**Figure 7.** The frame assignment of 6-DOF surgical manipulator


The 6-DOF manipulator kinematic parameters are derived using Denavit Hartemberg formulation shown in Table 2.

**Table 2.** Full mobility robotic tool: geometry and link parameters

286 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

The geometrical model of the surgical robot in this study has 6 degrees of freedom (DOF) and an extra one for tool action. The end-effector has 3 rotations (Roll, Pitch and Yaw) as shown in Figure 6 and the frame assignment of 6-DOF surgical manipulator is represented

**2.2. The kinematics of Zeus and Da Vinci robotic arms** 

**Figure 6.** The geometrical model of surgical manipulator

**Figure 7.** The frame assignment of 6-DOF surgical manipulator

in Figure 7.

The flowchart representing the sequence of generating the MATLAB CODE of the link transformations matrix is shown in Figure 8.

**Figure 8.** The flowchart of the link transformations matrix

The general form of the Homogeneous Transformation Matrix is:

$$\mathbf{T}\_{\mathbf{j}}^{\text{j}-1}\mathbf{T}\_{\mathbf{j}} = \begin{bmatrix} \cos\theta\_{\mathbf{j}} & -\sin\theta\_{\mathbf{j}}\cos\alpha\_{\mathbf{j}} & \sin\theta\_{\mathbf{j}}\sin\alpha\_{\mathbf{j}} & a\_{\mathbf{j}}\cos\theta\_{\mathbf{j}} \\ \sin\theta\_{\mathbf{j}} & \cos\theta\_{\mathbf{j}}\cos\alpha\_{\mathbf{j}} & -\cos\theta\_{\mathbf{j}}\sin\alpha\_{\mathbf{j}} & a\_{\mathbf{j}}\sin\theta\_{\mathbf{j}} \\ 0 & \sin\alpha\_{\mathbf{j}} & \cos\alpha\_{\mathbf{j}} & d\_{\mathbf{j}} \\ 0 & 0 & 0 & 1 \end{bmatrix} \tag{1}$$

The link transformations matrix can be given as:

$$\begin{aligned} \;^0T\_1 = \begin{bmatrix} \mathbb{C}\_1 & -\mathbb{S}\_1 & 0 & L\_1 \mathbb{C}\_1 \\ \mathbb{S}\_1 & \mathbb{C}\_1 & 0 & L\_1 \mathbb{S}\_1 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \quad ^1T\_2 = \begin{bmatrix} \mathbb{C}\_2 & 0 & \mathbb{S}\_2 & L\_2 \mathbb{C}\_2 \\ \mathbb{S}\_2 & 0 & -\mathbb{C}\_2 & L\_2 \mathbb{S}\_2 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \quad ^2T\_3 = \begin{bmatrix} \mathbb{C}\_3 & 0 & -\mathbb{S}\_3 & 0 \\ \mathbb{S}\_3 & 0 & \mathbb{C}\_3 & 0 \\ 0 & -1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \end{aligned}$$

$$\begin{aligned} \;^3T\_4 = \begin{bmatrix} \mathbf{C}\_4 & \mathbf{0} & -\mathbf{S}\_4 & \mathbf{0} \\ \mathbf{S}\_4 & \mathbf{0} & \mathbf{C}\_4 & \mathbf{0} \\ \mathbf{0} & -\mathbf{1} & \mathbf{0} & L\_3 \\ \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{1} \end{bmatrix} \quad ^4T\_5 = \begin{bmatrix} \mathbf{C}\_5 & \mathbf{0} & -\mathbf{S}\_5 & \mathbf{0} \\ \mathbf{S}\_5 & \mathbf{0} & \mathbf{C}\_5 & \mathbf{0} \\ \mathbf{0} & -\mathbf{1} & \mathbf{0} & \mathbf{0} \\ \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{1} \end{bmatrix} \quad ^5T\_6 = \begin{bmatrix} \mathbf{C}\_6 & -\mathbf{S}\_6 & \mathbf{0} & \mathbf{0} \\ \mathbf{S}\_6 & \mathbf{C}\_6 & \mathbf{0} & \mathbf{0} \\ \mathbf{0} & \mathbf{0} & \mathbf{1} & L\_4 \\ \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{1} \end{bmatrix} \end{aligned}$$

Micro-Robot Management 289

*2.3.1. The workspace calculation* 

MATLAB symbolic Toolbox.

Joint coordinates ranges

**Figure 9.** The flowchart of The Robot workspace

of end-effector respectively.

**Table 3.** Joint coordinates ranges

cannot reach.

The workspace may be found mathematically by writing equations that define the robot's links and joints and including their limitations, such as ranges of motions for each joint. Alternatively, the workspace may be found empirically, by moving each joint through each range of motion and combining all the space in can reach and subtracting what it

The workspace of the surgical manipulator can be represented by solving the inverse kinematic equations and taking into consideration all the physical limits of the joints. Figure 9 represents the flowchart showing the sequence of generating the three dimensional workspace of the robot and end-effector to be manipulated using the

> The kinematics equations of the end effectors

**Robot workspace**

Inverse kinematics model of arm architecture

Graphical output

Table 3 represent the physical limits of the six joints while Figure10 represent the workspace

Arm Configuration

Link # 1 2 3 4 5 6 θi (degree) -180° -90º 0 -180° -90º -180° θf (degree) 180° 90º 180° 180° 90º 180° L (mm) 0 50 15 36 0 39.5

The workspace of the end-effector depends on the physical limits of the six joints angle, i.e. if the angle range of the robot joints is changes the workspace of the robot changes. So it is important to take into account the accuracy in determining the angle range of the robot

joints to get the required workspace which covers the work area.

The kinematics equations of the end effectors are manipulated using MATLAB symbolic Toolbox were as follows:

 1 212 3 4 121 2 4 5 1 212 3 5 4 1 212 3 3 1 2 21 22 1 1 12 1 2 3 4 1 212 4 5 ((-(C \*C -S \*S )\*C \*C -(-C \*S -S \*C )\*S )\*S + (C \*C -S \*S )\*S \*C )\*L -(C \*C -S \*S )\*S \*L + C \*L \*C -S \*L \*S +L \*C ((-(C \*S +S \*C )\*C \*C -(C \*C -S \*S )\*S )\*S + *X Y Z P P P Z* 12 1 2 3 5 4 12 1 2 33 1 2 122 11 3 45 3 5 4 33 (C \*S +S \*C )\*S \*C )\*L -(C \*S +S \*C )\*S \*L + S \*L2\*C +C \*L \*S +L \*S (-S \*C \*S -C \*C )\*L +C \*L 1

#### **2.3. The robot workspace**

The workspace of a robot can be defined as the set of points that are reachable by the manipulator (with fixed base). Roughly speaking the workspace is the volume of space which the end effector of the robot can reach. Both shape and total volume are important. Workspace is also called work volume or work envelope.

The workspace depends on the characteristics of the manipulator; physical configurations, size, number of axes, the robot mounted position (overhead gantry, wall-mounted, floor mounted, on tracks, etc), limits of arm and joint configurations. The addition of an end effector can move or offset the entire work volume.

The kinematics design of a manipulator can tailor the workspace to some extent to the operational requirements of the robot.

Some robots will have unusable spaces such as dead zones, singular poses, and wrist-wrap poses inside of the boundaries of their reach. Elbow manipulators tend to have a wider volume of workspace.


The dexterous workspace is obviously a subset of the reachable workspace.

## *2.3.1. The workspace calculation*

288 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

5

 5 5

*C S S C <sup>T</sup>*

The kinematics equations of the end effectors are manipulated using MATLAB symbolic

0 0 0 0 0 100 00 01

1 212 3 4 121 2 4 5 1 212 3 5 4 1 212 3 3 1 2 21 22 1 1

((-(C \*C -S \*S )\*C \*C -(-C \*S -S \*C )\*S )\*S + (C \*C -S \*S )\*S \*C )\*L -(C \*C -S \*S )\*S \*L + C \*L \*C -S \*L \*S +L \*C

12 1 2 3 4 1 212 4 5

3 45 3 5 4 33

(-S \*C \*S -C \*C )\*L +C \*L

1

The workspace of a robot can be defined as the set of points that are reachable by the manipulator (with fixed base). Roughly speaking the workspace is the volume of space which the end effector of the robot can reach. Both shape and total volume are important.

The workspace depends on the characteristics of the manipulator; physical configurations, size, number of axes, the robot mounted position (overhead gantry, wall-mounted, floor mounted, on tracks, etc), limits of arm and joint configurations. The addition of an end

The kinematics design of a manipulator can tailor the workspace to some extent to the

Some robots will have unusable spaces such as dead zones, singular poses, and wrist-wrap poses inside of the boundaries of their reach. Elbow manipulators tend to have a wider

1. Dexterous workspace: This is the volume of space which the end-effector of the

2. Reachable workspace: This is the volume of space which the end-effector of the

((-(C \*S +S \*C )\*C \*C -(C \*C -S \*S )\*S )\*S +

 12 1 2 3 5 4 12 1 2 33 1 2 122 11

(C \*S +S \*C )\*S \*C )\*L -(C \*S +S \*C )\*S \*L + S \*L2\*C +C \*L \*S +L \*S

0 01 0 0 01

4

*L*

6 6

*C S*

5 6 6 6

*S C <sup>T</sup>*

4 5 5

0 0 0 0

4 4

*C S*

0 10 00 0 1

 

*X*

*P*

*Y*

*P*

*Z*

*Z*

Workspace is also called work volume or work envelope.

effector can move or offset the entire work volume.

manipulator can reach with all orientations.

manipulator can reach with at least one orientation.

The dexterous workspace is obviously a subset of the reachable workspace.

operational requirements of the robot.

volume of workspace.

**2.3. The robot workspace** 

*P*

3

*L*

Toolbox were as follows:

4

3 4 4

*S C <sup>T</sup>*

The workspace may be found mathematically by writing equations that define the robot's links and joints and including their limitations, such as ranges of motions for each joint. Alternatively, the workspace may be found empirically, by moving each joint through each range of motion and combining all the space in can reach and subtracting what it cannot reach.

The workspace of the surgical manipulator can be represented by solving the inverse kinematic equations and taking into consideration all the physical limits of the joints. Figure 9 represents the flowchart showing the sequence of generating the three dimensional workspace of the robot and end-effector to be manipulated using the MATLAB symbolic Toolbox.

**Figure 9.** The flowchart of The Robot workspace

Table 3 represent the physical limits of the six joints while Figure10 represent the workspace of end-effector respectively.



The workspace of the end-effector depends on the physical limits of the six joints angle, i.e. if the angle range of the robot joints is changes the workspace of the robot changes. So it is important to take into account the accuracy in determining the angle range of the robot joints to get the required workspace which covers the work area.

Micro-Robot Management 291

(3)

(4)

*j i*

*j i*

Arm Configuration

*j i*

Y

Y

Y

*2.4.3. The Jacobian matrix* 

*2.4.4. The Jacobian relations* 

matrix of the robot are:

*XP f*

*YP f*

**Figure 11.** The flowchart of the Jacobian matrix

Yi

112 1 2

212 1 2

i12 1 2

1 212 3 3 1 2 21 22 1 1

12 1 2 33 1 2 122 11

**JACOBIAN FORMULA** 

Inverse kinematics model of arm

**MATLAB**

The Jacobian matrix and graphical output

(C \*C -S \*S )\*S \*L +C \*L \*C -S \*L \*S +L \*C

(C \*S +S \*C )\*S \*L +S \*L2\*C +C \*L \*S +L \*S

Joint coordinates ranges

 

 

1 1 1

*<sup>f</sup> f f X X <sup>X</sup> X X X*

*f f <sup>f</sup> X X <sup>X</sup> X X X*

2 2 2

 

> 

 

*j*

The Kinematics equations of the end effectors which are used to calculate the Jacobian

1 212 3 4 121 2 4 5 1 212 3 5 4 <sup>1</sup>

12 1 2 3 4 1 212 4 5 12 1 2 3 5 4 <sup>2</sup>

3 45 3 5 4 33 <sup>3</sup> (-S \*C \*S -C \*C )\*L +C \*L *ZP f*

The kinematics equations of the end effectors

((-(C \*C -S \*S )\*C \*C -(-C \*S -S \*C )\*S )\*S +(C \*C -S \*S )\*S \*C )\*L -

((-(C \*S +S \*C )\*C \*C -(C \*C -S \*S )\*S )\*S +(C \*S +S \*C )\*S \*C )\*L -

*<sup>f</sup> X D JD <sup>X</sup>*

*i*

*i*

 

*i i i*

*f f <sup>f</sup> X X <sup>X</sup> X X X*

**Figure 10.** The work space of end effector

#### **2.4. The robot Jacobian**

The Jacobian is a representation of the geometry of the elements of mechanism in time. It allows the conversion of differential motions or velocities of individual joints to differential motions or velocities of pints of interest. It also relates the individual joint motion to overall mechanism motions. Jacobian is time related; since the values of *<sup>i</sup>* vary in time, and the magnitude of the elements of Jacobian vary in time as well.

#### *2.4.1. The differential motions and velocities equations*

Differential motions are small movements of robot parts that can be used to derive velocity relationships between different parts of the robot. To find these relations the following steps, are to be considered:


#### *2.4.2. The Jacobian equations*

Suppose we have a set of equations Yi in terms of variables Xj

$$Y\_i = f\_i(X\_{1'}X\_{2'}X\_3\cdots\_{'}X\_j) \tag{2}$$

The differential change in Yi for a differential change in Xj is:

$$\begin{aligned} \delta \mathbf{Y}\_1 &= \frac{\partial f\_1}{\partial \mathbf{X}\_1} \delta \mathbf{X}\_1 + \frac{\partial f\_1}{\partial \mathbf{X}\_2} \delta \mathbf{X}\_2 + \dots + \dots + \dots + \frac{\partial f\_1}{\partial \mathbf{X}\_i} \delta \mathbf{X}\_j \\ \delta \mathbf{Y}\_2 &= \frac{\partial f\_2}{\partial \mathbf{X}\_1} \delta \mathbf{X}\_1 + \frac{\partial f\_2}{\partial \mathbf{X}\_2} \delta \mathbf{X}\_2 + \dots + \dots + \dots + \frac{\partial f\_2}{\partial \mathbf{X}\_i} \delta \mathbf{X}\_j \\ \vdots & \vdots & \vdots & \vdots \\ \vdots & \vdots & \vdots & \vdots \\ \delta \mathbf{Y}\_i &= \frac{\partial f\_i}{\partial \mathbf{X}\_1} \delta \mathbf{X}\_1 + \frac{\partial f\_i}{\partial \mathbf{X}\_2} \delta \mathbf{X}\_2 + \dots + \dots + \dots + \frac{\partial f\_i}{\partial \mathbf{X}\_i} \delta \mathbf{X}\_j \end{aligned} \tag{3}$$

*2.4.3. The Jacobian matrix* 

290 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

The Jacobian is a representation of the geometry of the elements of mechanism in time. It allows the conversion of differential motions or velocities of individual joints to differential motions or velocities of pints of interest. It also relates the individual joint motion to overall

**-100 0 100**

**Px(mm)**

**-40**

**-30**

**-20**

**-10**

**0**

**Pz(mm)**

**10**

**20**

**30**

**40**

Differential motions are small movements of robot parts that can be used to derive velocity relationships between different parts of the robot. To find these relations the following steps,

**-100 0 100**

**Py(mm)**

**-40**

**-30**

**-20**

**-10**

**0**

**Pz(mm)**

**10**

**20**

**30**

**40**

*Y fXX X X i i* ( , , ., ) <sup>123</sup> *<sup>j</sup>* (2)

*<sup>i</sup>* vary in time, and the

mechanism motions. Jacobian is time related; since the values of

magnitude of the elements of Jacobian vary in time as well.

**-100 0 100**

**Px(mm)**

Suppose we have a set of equations Yi in terms of variables Xj

The differential change in Yi for a differential change in Xj is:

*2.4.1. The differential motions and velocities equations* 

**Figure 10.** The work space of end effector

**-80**

**-60**

**-40**

**-20**

**0**

**Py(mm)**

**20**

**40**

**60**

**80**

**2.4. The robot Jacobian** 

are to be considered:

3. Jacobian matrix.

1. Frames relative to a fixed frame. 2. Robot joint relative to a fixed frame.

4. Robot velocity relationship.

*2.4.2. The Jacobian equations* 

$$
\begin{bmatrix} \delta \mathbf{Y}\_i \end{bmatrix} = \begin{bmatrix} \frac{\partial f\_i}{\partial X\_i} \end{bmatrix} \begin{bmatrix} \delta X\_j \end{bmatrix} = \begin{bmatrix} D \end{bmatrix} = \begin{bmatrix} f \end{bmatrix} \begin{bmatrix} D\_\theta \end{bmatrix} \tag{4}
$$

#### *2.4.4. The Jacobian relations*

The Kinematics equations of the end effectors which are used to calculate the Jacobian matrix of the robot are:

$$P\_X = f\_1 = \left( \left( \text{-} \text{(Cr}^\* \text{Cz-Sr}^\* \text{Sz})^\* \text{Cz}^\* \text{Cz-(-Cr^\*Sz-Sr^\*Cz)^\*Sz} \right) \text{\*Sz} + \left( \text{Cr^\*Cz-Sr^\*Sz} \right) \text{\*Sz}^\* \text{Cz} \right) \text{\*} \text{L} + \left( \text{Cr^\*Cz-Sr^\*Sz} \right) \text{\*Sz} + \text{T} \left( \text{T} \text{S} \right) \text{\*} \text{T} \left( \text{T} \right)$$
 
$$\text{(Cr^\*Cz-Sr^\*Sz)^\*Sz} \text{\*} \text{\*} \text{\*} \text{\*} \text{\*} \text{\*} \text{\*} \text{\*} \text{\*} \text{\*} \text{\*} \text{\*} \text{\*} \text{\*} \text{\*} \text{\*} \text{\*} \text{\*} \text{\*} \text{\*} $$

$$P\_Y = f\_2 = \left( \{\text{-(Cl^\*Sz+Si^\*Cz)\*Cz^\*Cz^\*Cz-(Ci^\*Cz-Si^\*Sz)\*Sz} \text{"Sz} + \{\text{Cr^\*Sz+Si^\*Cz}\} \text{"Sz} \text{"Sz} \right) \text{"Lz} + \{\text{Cr^\*Sz+Si^\*Cz^\*Cz} \text{"Sz} + \text{Cr^\*Sz} \} \text{"Sz} \}$$

$$P\_Z = f\_3 = (\text{-Sc}^\ast \text{C} \text{4}^\ast \text{S} \text{s} \text{-C} \text{3}^\ast \text{C} \text{s})^\ast \text{L} \text{4} \text{+C} \text{3}^\ast \text{L} \text{s}^\ast$$

**Figure 11.** The flowchart of the Jacobian matrix

The Jacobian matrix of the robot can be calculated by MATLAB symbolic Toolbox using the kinematics equations as shown in the Figure 11.

Micro-Robot Management 293

**-100 0**

**0 50 100**

**-100**

**-14 -14 -14 -14 -4.4087 -4.4087 -4.4087 -4.4087 -4.4087 x 10-15**

**dPx dPy**

**dPx dPy**

**-50**

**dPz**

**100**

The previous differential equations of motion of the end effector represent the relation between the magnitude of the elements of Jacobian (the elements of end effector motion) and the joints angle. Figures 12 a, b, c, d, e and f represents the relation between angle of joints and the end effector differential translation. This shows six figures is (a, b, c, d, e and f) for six joints. It is to be noted that in Figures 12-a and 12-b for the first and second joints respectively the relation between angle of joint and the end effector differential translation in the Z direction is constant i.e. the motion of the end effector in the Z direction is not affected by the change in angle of the first and second joints. In the same time the motion of the end effector in all directions (X, Y and Z) is not affected by the change in angle of the six joints because the frame of the end effector is in the same directions of the frame of the joint number six. This can clearly be inferred from the geometrical model and the frame of the

The relations between the magnitude of the elements of Jacobian (the elements of end effector motion at all directions) i.e. dPX, dPY and dPZ give of the path of the robot joints as

(a) The path of the first joint (b) The path of the second joint (c) The path of the third joint

**-200**

**0**

**200 -1 -0.5 0 0.5 1**

**dPz**

**-100 0 100 200**

**dPx dPy -200**

**100**

**dPz**

**dPx dPy -50**

Robot study is divided into two parts; they are the kinematics and dynamics. This means that using the equations of motion of the robot, its position can be determined if the joint variables are known. Path and trajectory planning relates the way a robot is moved from one location to another in controlled manner. In this chapter, a study of the sequence of

(d) The path of the forth joint (e) The path of the fifth joint (f) The path of the sixth joint

**-14 -14 -14 -14 -1 -0.5 0 0.5 1**

**-200 -100 0**

robot given in Figures 6 and 7 respectively.

**100 200**

**dPx dPy -200**

**100**

**dPz**

shown in Figures 13 a, b, c, d, e and f.

**-200 -100 <sup>0</sup>**

**-200**

**0**

**200 -1 -0.5 0 0.5 1**

**dPz**

**dPz**

**Figure 13.** The path of the robot joints

**-200 -100 0**

**dPx dPy**

**-200**

**0**

**3. The trajectory planning** 

**3.1. Introduction to the trajectory planning** 

The differential equations of motion of the end effector for the surgical robot are represented by:

$$\begin{aligned} \mathrm{d}\mathbb{P}\_{\text{x}} &= \mathrm{\mathbb{V}}\_{\text{x}} = (\langle\langle(\mathbf{C\_{1}} \ \mathbf{S\_{2}} + \mathbf{S\_{1}} \ \mathbf{C\_{2}}) \ \mathbf{C\_{3}} \ \mathbf{C\_{4}} \ \mathbf{C\_{1}} \ \mathbf{C\_{2}} + \mathbf{S\_{1}} \ \mathbf{S\_{2}} \ \mathbf{S\_{2}}) \ \mathbf{S\_{3}} + \langle(\mathbf{C\_{1}} \ \mathbf{S\_{2}} - \mathbf{S\_{1}} \ \mathbf{C\_{2}}) \ \mathbf{S\_{3}} \ \mathbf{C\_{3}} \ \mathbf{C\_{4}} \ \mathbf{C\_{4}} \ \mathbf{C\_{5}} \ \mathbf{C\_{6}} \ \mathbf{C\_{7}} \ \mathbf{C\_{8}} \ \mathbf{C\_{9}} \ \mathbf{C\_{1}} \ \mathbf{C\_{1}} \ \mathbf{C\_{2}} \ \mathbf{C\_{2}} \ \mathbf{C\_{3}} \ \mathbf{C\_{4}} \ \mathbf{C\_{5}} \ \mathbf{C\_{6}} \ \mathbf{C\_{7}} \ \mathbf{C\_{8}} \ \mathbf{C\_{7}} \ \mathbf{C\_{8}} \ \mathbf{C\_{1}} \ \mathbf{C\_{2}} \ \mathbf{C\_{4}} \ \mathbf{C\_{5}} \ \mathbf{C\_{6}} \ \mathbf{C\_{7}} \ \mathbf{C\_{7}} \ \mathbf{C\_{8}} \ \mathbf{C\_{1}} \ \mathbf{C\_{1}} \ \mathbf{C\_{2}} \ \mathbf{C\_{4}} \ \mathbf{C\_{2}} \ \mathbf{C\_{5}} \ \mathbf{C\_{2}} \ \mathbf{C\_{4}} \ \mathbf{C\_{5}} \ \mathbf{C\_{6}} \ \mathbf{C\_{7}} \ \mathbf{C\_{7}} \ \mathbf{C\_{8}} \ \mathbf{C$$

 y y 1 2 12 3 4 121 2 4 5 1 212 3 5 4 1 212 3 3 1 2 21 2 2 1 1 1 1 2 12 3 4 121 2 4 5 1 212 3 5 4 1 dP =V ((((-C \*C +S \*S )\*C \*C -(-C \*S -S \*C )\*S )\*S +(C \*C -S \*S )\*S \*C )\*L - (C \*C -S \*S )\*S \*L +C \*L \*C -S \*L \*S +L \*C )\*d +((((-C \*C +S \*S )\*C \*C - (-C \*S -S \*C )\*S )\*S +(C \*C -S \*S )\*S \*C )\*L -(C 212 3 3 1 2 2 122 2 12 1 2 3 45 12 1 2 3 5 4 12 1 2 3 3 3 12 1 2 34 1 212 4 5 4 4 121 2 3 4 1 212 \*C -S \*S )\*S \*L +C \*L \*C - S \*L \*S )\*d +(((C \*S +S \*C )\*S \*C \*S +(C \*S +S \*C )\*C \*C )\*L - (C \*S +S \*C )\*C \*L )\*d +((C \*S +S \*C )\*C \*S -(C \*C -S \*S )\*C )\*S \*L \*d + (((-C \*S -S \*C )\*C \*C -(C \*C -S \*S )\* 4 5 12 1 2 35 4 5 S )\*C -(C \*S +S \*C )\*S \*S )\*L \*d

 z z 3 4 5 3 5 4 3 3 3 3 4 5 4 4 3 4 5 3 5 4 5 dP =V ((-C \*C \*S +S \*C )\*L -S \*L )\*d +S \*S \*S \*L \*d +(-S \*C \*C +C \*S )\*L \*d

**Figure 12.** The relation between angle of joints and the end effector differential translation

The previous differential equations of motion of the end effector represent the relation between the magnitude of the elements of Jacobian (the elements of end effector motion) and the joints angle. Figures 12 a, b, c, d, e and f represents the relation between angle of joints and the end effector differential translation. This shows six figures is (a, b, c, d, e and f) for six joints. It is to be noted that in Figures 12-a and 12-b for the first and second joints respectively the relation between angle of joint and the end effector differential translation in the Z direction is constant i.e. the motion of the end effector in the Z direction is not affected by the change in angle of the first and second joints. In the same time the motion of the end effector in all directions (X, Y and Z) is not affected by the change in angle of the six joints because the frame of the end effector is in the same directions of the frame of the joint number six. This can clearly be inferred from the geometrical model and the frame of the robot given in Figures 6 and 7 respectively.

The relations between the magnitude of the elements of Jacobian (the elements of end effector motion at all directions) i.e. dPX, dPY and dPZ give of the path of the robot joints as shown in Figures 13 a, b, c, d, e and f.

(d) The path of the forth joint (e) The path of the fifth joint (f) The path of the sixth joint

292 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

kinematics equations as shown in the Figure 11.

**-5 <sup>0</sup> <sup>5</sup>**

**th1(rad)**

**-5 <sup>0</sup> <sup>5</sup>**

**-100 -50 0 50 100**

**dPy(mm)**

**-5 0 5**

**th4(rad)**

**-5 0 5 -200 -150 -100 -50 0 50 100 150 200**

**dPy(mm)**

**-200 -150 -100 -50 0 50 100 150 200**

**-200 -150 -100 -50 0**

**dPx(mm)**

**th4(rad)**

**dPx(mm)**

**th1(rad)**

1 2 12 4 5 121 2 3 5 4

1 2 12 3 4 121

(((-C \*C +S \*S )\*C \*C -(-C \*S -S \*C

(-C \*C +S \*S )\*S )\*S +(-C \*S -S \*C )\*S \*C )\*L -(-C

121 2 4 5 1 212 3 5 4 1

(-C \*S -S \*C )\*S )\*S +(C \*C -S \*S )\*S \*C )\*L -(C

121 2 3 4 1 212

**-5 <sup>0</sup> <sup>5</sup> -57.5**

**th1(rad)**

**-5 0 5 -70 -60 -50 -40 -30 -20 -10 0**

**th4(rad)**

**-57 -56.5 -56 -55.5 -55**

**dPz(mm)**

**dPz(mm)**

(((-C \*S -S \*C )\*C \*C -(C \*C -S \*S )\*

by:

The Jacobian matrix of the robot can be calculated by MATLAB symbolic Toolbox using the

The differential equations of motion of the end effector for the surgical robot are represented

x x 12 1 2 3 4 1 2 12 4 5 121 2 3 4

dP =V ((((C \*S +S \*C )\*C \*C -(-C \*C +S \*S )\*S )\*S +(-C \*S -S \*C )\*S \*C5\*L - (-C \*S -S \*C )\*S \*L -S \*L \*C -C \*L \*S -L \*S )\*d +((((C \*S +S \*C )\*C \*C -

121 2 3 31 2 2 1 2 211 1 12 1 2 3 4

1 212 3 3 3 1 212 3 4 121 2 4 5 4 4

y y 1 2 12 3 4 121 2 4 5 1 212 3 5 4

dP =V ((((-C \*C +S \*S )\*C \*C -(-C \*S -S \*C )\*S )\*S +(C \*C -S \*S )\*S \*C )\*L - (C \*C -S \*S )\*S \*L +C \*L \*C -S \*L \*S +L \*C )\*d +((((-C \*C +S \*S )\*C \*C -

(C \*C -S \*S )\*C \*L )\*d +((C \*C -S \*S )\*C \*S -(-C \*S -S \*C )\*C )\*S \*L \*d +

1 212 3 3 1 2 21 2 2 1 1 1 1 2 12 3 4

12 1 2 3 3 3 12 1 2 34 1 212 4 5 4 4

(C \*S +S \*C )\*C \*L )\*d +((C \*S +S \*C )\*C \*S -(C \*C -S \*S )\*C )\*S \*L \*d +

(a) The first joint (b) The second joint (c) The third joint

**dPy(mm)**

**-5 0 5 -200 -150 -100 -50 0 50 100 150**

**-5 <sup>0</sup> <sup>5</sup> -57.5**

**th2(rad)**

**-5 0 5 -60 -40 -20 0 20 40 60**

**th5(rad)**

**-57 -56.5 -56 -55.5 -55**

**dPz(mm)**

**th2(rad)**

**-5 0 5**

**th2(rad)**

**-200 -150 -100 -50 0 50 100**

**dPx(mm)**

**Figure 12.** The relation between angle of joints and the end effector differential translation

**-5 0 5**

**th5(rad)**

**-200 -150 -100 -50 0**

**dPx(mm)**

(d) The forth joint (e) The fifth joint (f) The sixth joint

**dPy(mm)**

**dPz(mm)**

**th5(rad)**

z z 3 4 5 3 5 4 3 3 3 3 4 5 4 4 3 4 5 3 5 4 5 dP =V ((-C \*C \*S +S \*C )\*L -S \*L )\*d +S \*S \*S \*L \*d +(-S \*C \*C +C \*S )\*L \*d

1 2 2 2 1 212 3 4 5 1 212 3 5 4

122 2 12 1 2 3 45 12 1 2 3 5 4

S \*L \*S )\*d +(((C \*S +S \*C )\*S \*C \*S +(C \*S +S \*C )\*C \*C )\*L -

C \*L \*S )\*d +(((C \*C -S \*S )\*S \*C \*S +(C \*C -S \*S )\*C \*C )\*L -

2 4 5 1 212 35 4 5 )\*S )\*C -(C \*C -S \*S )\*S \*S )\*L \*d

4 5 12 1 2 35 4 5 S )\*C -(C \*S +S \*C )\*S \*S )\*L \*d

 

 

> 

**-5 0 5**

**th3(rad)**

**-5 <sup>0</sup> <sup>5</sup> -57.5**

**th6(rad)**

**-57 -56.5 -56 -55.5 -55**

**dPz(mm)**

**-100 -50 0 50 100**

**dPz(mm)**

**-5 0 5 -150 -100 -50 0 50 100**

**th3(rad)**

**-5 <sup>0</sup> <sup>5</sup> -76.5**

**th6(rad)**

**-76 -75.5 -75 -74.5 -74**

**dPy(mm)**

121 2 3 31 2 2

212 3 3 1 2 2

\*C -S \*S )\*S \*L +C \*L \*C -

**-5 0 5**

**dPy(mm)**

**th3(rad)**

**-5 <sup>0</sup> <sup>5</sup> -185**

**th6(rad)**

**-184.5 -184 -183.5 -183 -182.5**

**dPx(mm)**

**-200 -150 -100 -50 0**

**dPx(mm)**

\*S -S \*C )\*S \*L -S \*L \*C -

**Figure 13.** The path of the robot joints

### **3. The trajectory planning**

#### **3.1. Introduction to the trajectory planning**

Robot study is divided into two parts; they are the kinematics and dynamics. This means that using the equations of motion of the robot, its position can be determined if the joint variables are known. Path and trajectory planning relates the way a robot is moved from one location to another in controlled manner. In this chapter, a study of the sequence of movements is to be made to create a controlled movement between motion segments, in straight-line motion, or in sequential motions. Path and trajectory planning requires the use of both kinematics and dynamics of robots. In practice, precise motion requirements are so intensive that approximations are always necessary [23].

Micro-Robot Management 295

robot link consequently decreases accidentally irrespective of the methods used. The orientation must be seen carefully examined and the behaviour should be increasing gradually with the time from the initial angle to the final angle. The final time required to complete the process for each method should be optimized and this is called optimal planning. In this work the trajectory planning of the four times is derived and then, comparison of the results at specific joint is made. The proper time which gives

The most common techniques for trajectory planning for industrial robots are the use of polynomial of different orders, such as Cubic and B-splines, linear segments with parabolic blends and the soft motion trajectory [22]. The Linear Segments with Parabolic blends trajectories are faster and more suitable for industrial applications. On the other hand, the higher order polynomials trajectory as well as the soft motion trajectory [24] are easy to design and control especially for the jerk. They are accurate, precise and suitable for medical applications. In this work, the trajectory planning for each joint is designed using third order polynomial as a rest-to-rest manoeuvring where the link starts from rest, accelerates and

2 3

In which <sup>012</sup> *CC C* , , and*C*<sup>3</sup> are coefficients to be determined from the initial conditions as

<sup>2</sup>

i 1 (t ) =C 0

<sup>2</sup>

 

 

i 0 (t ) =C *<sup>i</sup>*

ii ff (t ) = and (t ) =

01 2 3 ( )*t C Ct Ct Ct* (5)

12 3 (t) = C + 2 C t + 3 C t (6)

i f (t ) =0 and (t ) =0 (Rest to Rest manouvering)

f 1 2f 3f (t ) = C + 2 C t + 3 C t 0 (7)

f 01 2 3 (t ) = *C Ct Ct Ct <sup>f</sup> f ff* (8)

2 3

satisfactory results is obtained.

By substituting in to equation (6):

By substituting in to equation (5):

follows:

*3.2.1. Third-Order polynomial trajectory planning* 

decelerates at the end of the trajectory. The trajectory is given by [23]:

The initial and final location and orientation of robot are known from:

What is the different between the path and the trajectory planning?

A Path is defined as a sequence of robot configurations in particular order without regard to timing of these configurations as shown in Figure 14. A trajectory is concerned about when each part of the path must be obtained thus specifying timing (Velocity and Acceleration). Or a trajectory is a spatial position/time curve that usually represents a desired manipulation motion in either link or Cartesian space as shown in Figure 15.

**Figure 14.** Sequential robot movements in a path [23]

**Figure 15.** Sequential motions of a robot to follow a straight line [23]

## **3.2. The methods to calculate trajectory planning**

There are four different methods which have been derived to calculate the trajectory planning of the robot using MATLAB code. The trajectory planning in the four methods needs two parameters, namely the joint angle range and the final time required to complete the process. The first one was selected from the workspace needed to complete the process In any case, this dependent on the type of surgical applications and can easily be identified. The final time required is a very important parameter to derive the trajectory planning of the robot. As all the results that have been inferred from the orientation, velocity, acceleration and torque of the robot are based on this parameter. If the time increases the velocity required decreases and acceleration i.e. the inertia of the robot link consequently decreases accidentally irrespective of the methods used. The orientation must be seen carefully examined and the behaviour should be increasing gradually with the time from the initial angle to the final angle. The final time required to complete the process for each method should be optimized and this is called optimal planning. In this work the trajectory planning of the four times is derived and then, comparison of the results at specific joint is made. The proper time which gives satisfactory results is obtained.

#### *3.2.1. Third-Order polynomial trajectory planning*

294 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

manipulation motion in either link or Cartesian space as shown in Figure 15.

intensive that approximations are always necessary [23].

**Figure 14.** Sequential robot movements in a path [23]

**Figure 15.** Sequential motions of a robot to follow a straight line [23]

**3.2. The methods to calculate trajectory planning** 

What is the different between the path and the trajectory planning?

movements is to be made to create a controlled movement between motion segments, in straight-line motion, or in sequential motions. Path and trajectory planning requires the use of both kinematics and dynamics of robots. In practice, precise motion requirements are so

A Path is defined as a sequence of robot configurations in particular order without regard to timing of these configurations as shown in Figure 14. A trajectory is concerned about when each part of the path must be obtained thus specifying timing (Velocity and Acceleration). Or a trajectory is a spatial position/time curve that usually represents a desired

There are four different methods which have been derived to calculate the trajectory planning of the robot using MATLAB code. The trajectory planning in the four methods needs two parameters, namely the joint angle range and the final time required to complete the process. The first one was selected from the workspace needed to complete the process In any case, this dependent on the type of surgical applications and can easily be identified. The final time required is a very important parameter to derive the trajectory planning of the robot. As all the results that have been inferred from the orientation, velocity, acceleration and torque of the robot are based on this parameter. If the time increases the velocity required decreases and acceleration i.e. the inertia of the The most common techniques for trajectory planning for industrial robots are the use of polynomial of different orders, such as Cubic and B-splines, linear segments with parabolic blends and the soft motion trajectory [22]. The Linear Segments with Parabolic blends trajectories are faster and more suitable for industrial applications. On the other hand, the higher order polynomials trajectory as well as the soft motion trajectory [24] are easy to design and control especially for the jerk. They are accurate, precise and suitable for medical applications. In this work, the trajectory planning for each joint is designed using third order polynomial as a rest-to-rest manoeuvring where the link starts from rest, accelerates and decelerates at the end of the trajectory. The trajectory is given by [23]:

$$\theta(t) = \mathbb{C}\_0 + \mathbb{C}\_1 t + \mathbb{C}\_2 t^2 + \mathbb{C}\_3 t^3 \tag{5}$$

In which <sup>012</sup> *CC C* , , and*C*<sup>3</sup> are coefficients to be determined from the initial conditions as follows:

$$\dot{\theta}(\mathbf{t}) = \mathbf{C}\_1 + 2\,\mathbf{C}\_2\,\mathbf{t} + 3\,\mathbf{C}\_3\,\mathbf{t}^2 \tag{6}$$

$$
\dot{\theta}(\mathbf{t}\_i) = 0 \quad \text{and} \quad \dot{\theta}(\mathbf{t}\_f) = 0 \qquad \qquad \text{(Rest to Rest manouvering)}
$$

By substituting in to equation (6):

$$
\dot{\boldsymbol{\theta}}(\mathbf{t}\_i) = \mathbf{C}\_1 = \mathbf{0}
$$

$$
\dot{\boldsymbol{\theta}}(\mathbf{t}\_f) = \mathbf{C}\_1 + 2\mathbf{C}\_2\ \mathbf{t}\_f + 3\mathbf{C}\_3\ \mathbf{t}\_f^2 = \mathbf{0} \tag{7}
$$

The initial and final location and orientation of robot are known from:

$$
\theta(\mathbf{t}\_i) = \theta\_i \text{ and } \ \theta(\mathbf{t}\_f) = \theta\_f
$$

By substituting in to equation (5):

$$
\boldsymbol{\theta}(\mathbf{t}\_i) = \mathbf{C}\_0 = \boldsymbol{\theta}\_i
$$

$$
\boldsymbol{\theta}(\mathbf{t}\_f) = \mathbf{C}\_0 + \mathbf{C}\_1 \mathbf{t}\_f + \mathbf{C}\_2 \mathbf{t}\_f \;^2 + \mathbf{C}\_3 \mathbf{t}\_f \;^3 = \boldsymbol{\theta}\_f \tag{8}
$$

By solving equations (7), (8) simultaneously:

$$\mathbf{C}\_2 = \mathfrak{Z}(\boldsymbol{\theta}\_f - \boldsymbol{\theta}\_i) / \operatorname\*{\bf t}\_f^2 \quad \text{and} \quad \mathbf{C}\_3 = \mathfrak{Z}(\boldsymbol{\theta}\_f - \boldsymbol{\theta}\_i) / \operatorname\*{\bf t}\_f^3$$

#### *3.2.2. Fifth-Order polynomial trajectory planning*

The third order trajectory only takes into account starting and end velocities. The equations of the fifth order polynomial takes into account starting and end accelerations. In this case, the total number of boundary conditions are six, allowing a fifth.

The initial and final velocities are zero. (Rest to Rest manoeuvring) and the trajectory is given by [23]:

$$\theta(t) = \mathcal{C}\_0 + \mathcal{C}\_1 t + \mathcal{C}\_2 t^2 + \mathcal{C}\_3 t^3 + \mathcal{C}\_4 t^4 + \mathcal{C}\_5 t^5 \tag{9}$$

Micro-Robot Management 297

**Figure 16.** Scheme for linear segments with parabolic blends

calculate the coefficients of the parabolic segments.

*3.2.3.3. Second parabolic blends ( tf – tb to tf )* 

 *A B wt* ,

*3.2.3.2. Straight line (ta to tb)* 

1 2 (t)= C + C t and

The position of the robot at time t0 is known and using the inverse Kinematic equations of

To blend the motion segments together, the boundary conditions at each point are used to

the robot, the joint angles at via points and at the end of the motion can be found.

 *A B w* and

 <sup>2</sup> f f b <sup>w</sup> (t)= C + (t ) 2t

> *t* and

b w = t *C* and

In this method we consider the trajectory planning of points generated by a motion planning technique. The motion planner calculates the trajectory which the end effector must follow in space. However, the temporal characteristics of this movement are independent. One important difference between industrial robotic manipulators and service robot applications is the human interaction, which introduce safety and comfort constraints. In this work, we define soft motions conditions to facilitate this cohabitation. An on-line trajectory planner is proposed here. It generates the necessary references to produce soft

 <sup>f</sup> b <sup>w</sup> (t)= (t ) <sup>t</sup>

*wt*

*<sup>w</sup>* , 2

 ( ) *if f*

*b*

*t*

*3.2.4. Soft motion trajectory planning* 

<sup>2</sup> (t)= C

0

b <sup>w</sup> (t)= - <sup>t</sup>

max

*w*

 

2( ) *<sup>f</sup> <sup>i</sup> f*

*t*

*t* (13)

In which 0 1234 *CC CCC* , ,,, and*C*<sup>5</sup> are coefficients to be determined from the initial and final conditions as follows:

$$\dot{\theta}(t) = \mathbb{C}\_1 + 2\mathbb{C}\_2 t + \mathfrak{X}\mathbb{C}\_3 t^2 + 4\mathbb{C}\_4 t^3 + 5\mathbb{C}\_5 t^4 \tag{10}$$

$$\ddot{\theta}(t) = 2\mathbf{C}\_2 + 6\mathbf{C}\_3t + 12\mathbf{C}\_4t^2 + 20\mathbf{C}\_5t^3 \tag{11}$$

 i f (t ) =0 and (t ) =0 (Rest to Rest manoeuvring)

$$
\ddot{\theta}(\mathbf{t}\_{\mathrm{i}}) = \ddot{\theta}\_{\mathrm{i}} \text{ and } \ddot{\theta}(\mathbf{t}\_{\mathrm{f}}) = \ddot{\theta}\_{f}
$$

$$\mathbf{C}\_{0} = \boldsymbol{\theta}\_{i} \quad \text{\text{\textdegree C}}\_{1} = \dot{\boldsymbol{\theta}}\_{i} \text{\textdegree C}\_{2} = \frac{\ddot{\boldsymbol{\theta}}\_{i}}{2} \text{\textdegree C}\_{3} = \frac{20 \,\text{\textdegree C}\_{\text{i}} \cdot 20 \,\text{\textdegree C}\_{\text{i}} \cdot (8 \,\dot{\boldsymbol{\theta}}\_{\text{i}} + 12 \,\dot{\boldsymbol{\theta}}\_{\text{i}}) \text{\textdegree t}\_{\text{f}} \cdot (\text{3} \,\ddot{\boldsymbol{\theta}}\_{\text{i}} \cdot \ddot{\boldsymbol{\theta}}\_{\text{f}}) \text{\textdegree t}\_{\text{f}}}{2 \text{t}\_{f}^{\text{\textdegree C}}} \text{\textdegree t}\_{\text{f}}$$

$$\mathbf{C}\_{4} = \frac{\mathbf{3}0\boldsymbol{\theta}\_{\text{f}} \cdot \mathbf{3}0\boldsymbol{\theta}\_{\text{i}} + (\mathbf{1}4\dot{\boldsymbol{\theta}}\_{\text{f}} + \mathbf{1}6\dot{\boldsymbol{\theta}}\_{\text{i}})\,\mathbf{t}\_{\text{f}} + (\mathbf{3}\ddot{\boldsymbol{\theta}}\_{\text{i}} \cdot \mathbf{2}\ddot{\boldsymbol{\theta}}\_{\text{i}})\mathbf{t}\_{\text{f}}^{2}}{2\mathbf{t}\_{\text{f}}^{4}} \text{ and } \mathbf{C}\_{5} = \frac{12\boldsymbol{\theta}\_{\text{f}} \cdot \mathbf{1}2\boldsymbol{\theta}\_{\text{i}} \cdot (6\dot{\boldsymbol{\theta}}\_{\text{f}} \star 6\dot{\boldsymbol{\theta}}\_{\text{i}})\,\mathbf{t}\_{\text{f}} + (\ddot{\boldsymbol{\theta}}\_{\text{i}} \cdot \ddot{\boldsymbol{\theta}}\_{\text{i}})\mathbf{t}\_{\text{f}}^{2}}{2\mathbf{t}\_{\text{f}}^{5}}$$

#### *3.2.3. Linear segments with parabolic blends*

Linear segments can be blended with parabolic sections at the beginning and the end of the motion segment, creating continuous position and velocity. Acceleration is constant for the parabolic sections, yielding a linear velocity at the common points A and B as shown in the Figure 16.

*3.2.3.1. First parabolic blends (t0 to ta)* 

$$\theta(\mathbf{t}) = \mathbf{C}\_0 + \mathbf{C}\_1 \mathbf{t} + \frac{1}{2} \|\mathbf{C}\_2 \mathbf{t}\|^2 \tag{12}$$

**Figure 16.** Scheme for linear segments with parabolic blends

The position of the robot at time t0 is known and using the inverse Kinematic equations of the robot, the joint angles at via points and at the end of the motion can be found.

To blend the motion segments together, the boundary conditions at each point are used to calculate the coefficients of the parabolic segments.

*3.2.3.2. Straight line (ta to tb)* 

296 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

 <sup>3</sup>

The third order trajectory only takes into account starting and end velocities. The equations of the fifth order polynomial takes into account starting and end accelerations. In this case,

The initial and final velocities are zero. (Rest to Rest manoeuvring) and the trajectory is

<sup>2345</sup>

In which 0 1234 *CC CCC* , ,,, and*C*<sup>5</sup> are coefficients to be determined from the initial and final

<sup>234</sup>

2 3

 

 

 

and

Linear segments can be blended with parabolic sections at the beginning and the end of the motion segment, creating continuous position and velocity. Acceleration is constant for the parabolic sections, yielding a linear velocity at the common points A and B as shown in the

> <sup>2</sup> 01 2

3 3

*C*

ii f (t ) = and (t ) = *<sup>f</sup>*

<sup>3</sup> 2( ) / *C t <sup>f</sup> i f*

01 2 3 4 5 ( )*t C Ct Ct Ct Ct Ct* (9)

12 3 4 5 () 2 3 4 5 *t C Ct Ct Ct Ct* (10)

23 4 5 ( ) 2 6 12 20 *t C Ct Ct Ct* (11)

 

5 5

<sup>1</sup> (t)= C + C t + C t 2 (12)

 <sup>2</sup> f i f i f i ff

> 

20 -20 -(8 +12 ) t -(3 - )t 2 *f*

 

*<sup>t</sup>* ,

 <sup>2</sup> f i f i f i ff

12 -12 -(6 +6 ) t ( - )t 2 *f*

*t*

 

i f (t ) =0 and (t ) =0 (Rest to Rest manoeuvring)

 <sup>2</sup> <sup>2</sup> 3( ) / *C t <sup>f</sup> i f* and

the total number of boundary conditions are six, allowing a fifth.

By solving equations (7), (8) simultaneously:

given by [23]:

*C*

Figure 16.

conditions as follows:

 *C*<sup>0</sup> *<sup>i</sup>* ,

4 4

*3.2.3.1. First parabolic blends (t0 to ta)* 

 

*3.2.2. Fifth-Order polynomial trajectory planning* 

 

 <sup>2</sup> f i f i f i ff

30 -30 (14 +16 ) t (3 -2 )t 2 *f*

*t*

*<sup>C</sup>*<sup>1</sup> *<sup>i</sup>* ,

 

*3.2.3. Linear segments with parabolic blends* 

 

 <sup>2</sup> 2 *<sup>i</sup> C* , *C*

$$
\theta\_A = \theta\_\mathcal{B} + wt \text{ , } \dot{\theta}\_A = \dot{\theta}\_\mathcal{B} + w \text{ and } \ddot{\theta} = 0
$$

*3.2.3.3. Second parabolic blends ( tf – tb to tf )* 

$$
\theta(\mathbf{t}) = \mathbf{C}\_{\mathbf{f}} + \frac{\mathbf{w}}{2\mathbf{t}\_{\mathbf{b}}}(\mathbf{t}\_{\mathbf{f}} - \mathbf{t})^2 \tag{13}
$$

$$
\dot{\theta}(\mathbf{t}) = \frac{\mathbf{w}}{\mathbf{t}\_{\mathbf{b}}}(\mathbf{t}\_{\mathbf{f}} - \mathbf{t}) \text{ and } \ddot{\theta}(\mathbf{t}) = -\frac{\mathbf{w}}{\mathbf{t}\_{\mathbf{b}}}
$$

$$
= \frac{(\theta\_{\mathbf{i}} - \theta\_{\mathbf{f}} + \pi v t\_{f})}{\varpi}, \quad \mathbf{C}\_{\mathbf{2}} = \frac{\mathbf{w}}{\mathbf{t}\_{\mathbf{b}}} \quad \text{and} \quad w\_{\max} = \frac{2(\theta\_{\mathbf{f}} - \theta\_{\mathbf{i}})}{t\_{f}}
$$

#### *3.2.4. Soft motion trajectory planning*

*b*

*t*

In this method we consider the trajectory planning of points generated by a motion planning technique. The motion planner calculates the trajectory which the end effector must follow in space. However, the temporal characteristics of this movement are independent. One important difference between industrial robotic manipulators and service robot applications is the human interaction, which introduce safety and comfort constraints. In this work, we define soft motions conditions to facilitate this cohabitation. An on-line trajectory planner is proposed here. It generates the necessary references to produce soft motion and a control loop that guarantees the end effector's motion characteristics (jerk, acceleration, velocity and position) in the Cartesian space, by using quaternion feedback. Two visual feedback control loops are proposed: a visual servoing control loop in a shared position - vision schema and a visual guided loop (which is the general case of soft motion trajectory) are given by:

*3.2.4.1. The motion with a maximum jerk (Jmax)* 

$$
\theta(\mathbf{t}) = \theta\_0 + \dot{\theta}\_0 \mathbf{t} + \frac{1}{2} \ddot{\theta} \mathbf{t}^2 + \frac{1}{6} J\_{\text{max}} \mathbf{t}^3 \tag{14}
$$

Micro-Robot Management 299

*J*

Dthr1

**Condition (2):** 

times used to calculate (Dthr2) are:

The angular movement (Dthr2) becomes:

Dthr2 2

depending on the maximum Jerk algorithm as:

**Case (1) (General case):** If D ≥ Dthr1

**Case (2):** If Dthr2 >D ≥ Dthr2

**Case (3):** If D < Dthr2

analysis as shown in Table 4.

the Figure 17.

 <sup>3</sup> max 2 max

*<sup>J</sup>* ,

<sup>0</sup> *<sup>v</sup> <sup>T</sup>* , max *j j T T* and

**3.3. The robot trajectory planning parameters** 

Where only

 

max *j j T T* , <sup>0</sup> *<sup>a</sup> <sup>T</sup>* and <sup>0</sup> *<sup>v</sup> <sup>T</sup>*

*J*

max max

The soft motion trajectory planning of 6-DOF surgical robot is divided in to three cases

and

*a T*

 

max

max *j j T T* , max *a a T T* and

0 *<sup>v</sup> T* , 0 *<sup>a</sup> T* and <sup>3</sup>

In this work, four different methods are applied here to design the joints trajectories third order polynomial, fifth order polynomial, linear segments with parabolic blends and soft motion trajectory. The trajectories have the same initial and final angles and different four duration times (5, 10, 20 and 60 s) are applied to choose the best duration time give the correct dynamic response. As well but they differ in the acceleration and the jerk. After designing the joints trajectories, the hub torques of the robot actuators can be simulated using MATLAB. The parameters of six joints were obtained using inverse kinematics

The flowchart representing the sequence of generating the trajectory planning is shown in

*j T*

 

max max max max max

max is reached. Then we have to find the traversed angular (Dthr2). The limit

2

*J J*

 

4 2 *<sup>a</sup> <sup>D</sup> <sup>T</sup>*

> max <sup>2</sup> *<sup>j</sup> <sup>D</sup> <sup>T</sup> J*

max Dthr1

max max max max max

 

3

*v <sup>D</sup> <sup>T</sup>*

2

max

 

*J*

 

max max max max

$$\dot{\partial}(t) = \dot{\theta}\_0 + \ddot{\theta}\_0 \mathbf{t} + \frac{1}{2} \mathbf{J}\_{\text{max}} t^2 \ \ \dot{\theta}(t) = \ddot{\theta}\_0 + \mathbf{J}\_{\text{max}} \ \text{and } \ \mathbf{J}(t) = \mathbf{J}\_{\text{max}}$$

*3.2.4.2. The motion with a maximum acceleration (Amax)* 

$$
\theta(t) = \theta\_0 + \dot{\theta}\_0 t + \frac{1}{2} \ddot{\theta}\_{\text{max}} t^2 \tag{15}
$$

$$
\dot{\partial}(t) = \dot{\partial}\_0 + \ddot{\partial}\_{\text{max}} \; \prime \; \dot{\partial}(t) = \ddot{\partial}\_{\text{max}} \; \text{and} \; \text{J}(t) = 0
$$

*3.2.4.3. Finally, the equations for the motion with a maximum velocity (Vmax)* 

$$
\theta(t) = \theta\_0 + \dot{\theta}\_{\text{max}} \mathbf{t} \tag{16}
$$

$$
\dot{\theta}(t) = \dot{\theta}\_{\text{max}} \; \prime \; \ddot{\theta}(t) = 0 \; \text{ and } \; \text{J}(t) = 0
$$

The initial conditions are:

$$
\ddot{\theta}(0) = 0 \quad \dot{\theta}(0) = 0 \quad \theta(0) = \theta\_0 \quad \text{and} \quad D = \theta\_D - \theta\_0
$$

Where: D is general traversed angular movement.

The final conditions are:

$$\ddot{\theta}(t\_f) = 0 \quad \dot{\theta}(t\_f) = 0 \text{ and } \(\theta(t\_f) = \theta\_D\)$$

We have two limit conditions to obtain the traversed angular movement:

#### **Condition (1):**

Where max is reached. It means, max is reached too. Then we have to find the traversed angular (Dthr1). The limit times used to calculate (Dthr1) are:

$$T\_j = T\_{j\_{\text{max}}} \quad \text{ } \ T\_a = T\_{a\_{\text{max}}} \quad \mathbf{and} \quad T\_v = 0.$$

The angular movement (Dthr1) becomes:

$$\mathbf{D}\mathbf{thr}1 = \frac{\ddot{\boldsymbol{\theta}}\_{\text{max}} \dot{\boldsymbol{\theta}}\_{\text{max}}}{J\_{\text{max}}} + \frac{\dot{\boldsymbol{\theta}}\_{\text{max}}^2}{\ddot{\boldsymbol{\theta}}\_{\text{max}}}$$

#### **Condition (2):**

298 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

trajectory) are given by:

The initial conditions are:

The final conditions are:

**Condition (1):** 

Where

*3.2.4.1. The motion with a maximum jerk (Jmax)* 

 <sup>2</sup> 0 0 max <sup>1</sup> () t J <sup>2</sup> *t t* ,

*3.2.4.2. The motion with a maximum acceleration (Amax)* 

 

*3.2.4.3. Finally, the equations for the motion with a maximum velocity (Vmax)* 

 max ( )*<sup>t</sup>* ,

> (0) 0 ,

 0 max ( )*<sup>t</sup>* ,

()0 *<sup>f</sup> <sup>t</sup>* ,

angular (Dthr1). The limit times used to calculate (Dthr1) are:

(0) 0 ,

Where: D is general traversed angular movement.

max is reached. It means,

The angular movement (Dthr1) becomes:

 

<sup>1</sup> () t <sup>2</sup> *t t*

 

 <sup>0</sup> (0) and

()0 *<sup>f</sup> <sup>t</sup>* and

max *j j T T* , max *a a T T* and <sup>0</sup> *<sup>v</sup> <sup>T</sup>*

We have two limit conditions to obtain the traversed angular movement:

motion and a control loop that guarantees the end effector's motion characteristics (jerk, acceleration, velocity and position) in the Cartesian space, by using quaternion feedback. Two visual feedback control loops are proposed: a visual servoing control loop in a shared position - vision schema and a visual guided loop (which is the general case of soft motion

> 2 3 0 0 max

> >

 <sup>2</sup> 0 0 max

() 0 *t* and J(t) = 0

( ) *<sup>f</sup> <sup>D</sup> t*

 max ( )*<sup>t</sup>* and J(t) = 0

0 max () J *<sup>t</sup>* and max J(t) = J

0 max () t *<sup>t</sup>* (16)

 *D <sup>D</sup>* <sup>0</sup>

max is reached too. Then we have to find the traversed

(14)

(15)

1 1 () t 2 6 *t t Jt*

Where only max is reached. Then we have to find the traversed angular (Dthr2). The limit times used to calculate (Dthr2) are:

$$T\_j = T\_{j\_{\max}} \; \; \; \; T\_a = 0 \quad \text{and} \; \; T\_v = 0 \; \; \;$$

The angular movement (Dthr2) becomes:

$$\text{Dthr2} = 2\frac{\ddot{\theta}^3\_{\text{max}}}{J^2\_{\text{max}}} \text{ } \begin{array}{l} T\_{\dot{j}\_{\text{max}}} = \frac{\ddot{\theta}\_{\text{max}}}{J\_{\text{max}}} \text{ and } \begin{array}{l} T\_{a\_{\text{max}}} = \left(\frac{\dot{\theta}\_{\text{max}}}{\ddot{\theta}\_{\text{max}}}\right) - \left(\frac{\ddot{\theta}\_{\text{max}}}{J\_{\text{max}}}\right) \end{array}$$

The soft motion trajectory planning of 6-DOF surgical robot is divided in to three cases depending on the maximum Jerk algorithm as:

**Case (1) (General case):** If D ≥ Dthr1

$$T\_{\dot{j}} = T\_{\dot{j}\_{\text{max}}\text{ }\prime} \quad T\_a = T\_{a\_{\text{max}}} \quad \text{and} \quad T\_v = \frac{D - \text{Dthr}1}{\dot{\theta}\_{\text{max}}}$$

**Case (2):** If Dthr2 >D ≥ Dthr2

$$T\_v = 0 \,\,\,\,\,\,\,T\_{\dot{j}} = T\_{\dot{j}\_{\text{max}}} \,\,\text{and}\,\,\,\,T\_a = \sqrt{\frac{\dot{\partial}^2\_{\text{max}}}{4J\_{\text{max}}} + \frac{D}{\ddot{\partial}\_{\text{max}}}} - \frac{3\ddot{\partial}\_{\text{max}}}{2J\_{\text{max}}}$$

**Case (3):** If D < Dthr2

$$T\_v = 0 \text{ \textdegree\\_}\\_T\_a = 0 \text{ \textdegree\\_}\\_T\_j = \sqrt[3]{\frac{D}{2J\_{\text{max}}}}$$

#### **3.3. The robot trajectory planning parameters**

In this work, four different methods are applied here to design the joints trajectories third order polynomial, fifth order polynomial, linear segments with parabolic blends and soft motion trajectory. The trajectories have the same initial and final angles and different four duration times (5, 10, 20 and 60 s) are applied to choose the best duration time give the correct dynamic response. As well but they differ in the acceleration and the jerk. After designing the joints trajectories, the hub torques of the robot actuators can be simulated using MATLAB. The parameters of six joints were obtained using inverse kinematics analysis as shown in Table 4.

The flowchart representing the sequence of generating the trajectory planning is shown in the Figure 17.



Micro-Robot Management 301

history and mathematics of the dynamics of serial-link manipulators are well covered in the

These equations of motion can be derived by six methods, namely the Newton's second law method, D'Alembert method, Lagrange method, Hemilton method, Lagrange-Euler method and Newton-Euler method. But not all previous methods can be used to derive the equations of motion for the robot subject of this work. That is not all methods can easily

As we have stated, the dynamic equation for two-degree of freedom system is much more complicated than a one-degree of freedom system. Similarly, these equations for multipledegree of freedom robot are cumbersome and complicated, but can be found by calculating the kinetic and potential energies of the links and joints [25]. For the robot considered in this work the robot has 6-DOF and the most appropriate method to derive the equations of

The Lagrange-Euler technique is utilized here to calculate the kinetic energy, potential energy and to derive the dynamic equations in symbolic form using the MATLAB symbolic toolbox for the six-degree of freedom robot. The equations of motion are given in a concise

The total kinetic energy of multiple-degree of freedom robot is given in a concise form as:

1 1 K = ( ) 2 2

 0

<sup>2</sup>

*ip i ir p r iact i*

*<sup>T</sup> U QT* , , *U UU U ir ri iP Pi* and

*Q prismatic <sup>i</sup>*

*Trace U J U T q q I q* (18)

0000

( ) <sup>0001</sup>

0000 0000

1 11 1

*i* 0 *ir r i r*

But in our case all joints in the robot arm used in surgical applications are considered

*ni i n*

Q=M(q) q + C(q.q ) q + G(q) (17)

literature. The equations of motion for an n-axis manipulator are given by [25]:

derived the equations of motion for a robot having multi-degree of freedom.

**4.2. Dynamic equations for multiple-degree of freedom robots** 

*4.2.1. Derivation of the equations of motion by Lagrange-Euler technique* 

0 0 00

0 100 1 0 00

*i pr*

( ) 0 0 00

*Q revolute <sup>i</sup>* ,

i

*i* 0 *ip P i P <sup>T</sup> U QT* ,

revolute joints where *QP* = *Qr* = Q.

 0

motion is likely to be Lagrange-Euler technique.

form similar to that given in [25].

*4.2.1.1. The total kinetic energy* 

**Table 4.** Full robotic mobility information used in trajectory planning

**Figure 17.** The flowchart of the trajectory planning

Where: Position.1 for first methods of trajectory planning and Position .2 for Soft motion trajectory planning.

## **4. The dynamic model**

### **4.1. Introduction to the dynamic model of robot**

Manipulator dynamics is concerned with the equations of motion, the way in which the manipulator moves in response to torques applied by the actuators, and external forces. The history and mathematics of the dynamics of serial-link manipulators are well covered in the literature. The equations of motion for an n-axis manipulator are given by [25]:

$$\mathbf{Q} \models \mathbf{M(q)} \; \ddot{\mathbf{q}} + \mathbf{C(q, \dot{q})} \; \dot{\mathbf{q}} + \mathbf{G(q)} \tag{17}$$

These equations of motion can be derived by six methods, namely the Newton's second law method, D'Alembert method, Lagrange method, Hemilton method, Lagrange-Euler method and Newton-Euler method. But not all previous methods can be used to derive the equations of motion for the robot subject of this work. That is not all methods can easily derived the equations of motion for a robot having multi-degree of freedom.

#### **4.2. Dynamic equations for multiple-degree of freedom robots**

As we have stated, the dynamic equation for two-degree of freedom system is much more complicated than a one-degree of freedom system. Similarly, these equations for multipledegree of freedom robot are cumbersome and complicated, but can be found by calculating the kinetic and potential energies of the links and joints [25]. For the robot considered in this work the robot has 6-DOF and the most appropriate method to derive the equations of motion is likely to be Lagrange-Euler technique.

#### *4.2.1. Derivation of the equations of motion by Lagrange-Euler technique*

The Lagrange-Euler technique is utilized here to calculate the kinetic energy, potential energy and to derive the dynamic equations in symbolic form using the MATLAB symbolic toolbox for the six-degree of freedom robot. The equations of motion are given in a concise form similar to that given in [25].

#### *4.2.1.1. The total kinetic energy*

300 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

**Table 4.** Full robotic mobility information used in trajectory planning

**Figure 17.** The flowchart of the trajectory planning

**4.1. Introduction to the dynamic model of robot** 

trajectory planning.

**4. The dynamic model** 

θ�

θ�

θ�

θ�

**Link# 1 23 4 5 6** θ�(degree) -180° -90º 0 -180° -90º -180° θ� (degree) 180° 90º 180° 180° 90º 180° L (mm) 0 50 15 36 0 39.5

� ( degree /s2) 5 5 5 5 5 5

� ( degree /s2) -5 -5 -5 -5 -5 -5

���( degree /s) 135 70 70 135 70 135

��� ( degree /s2) 80 40 40 80 40 80 J��� ( degree /s3) 160 80 80 160 80 160 t� (s) 0 00 0 0 0 t� (s) 5 55 5 5 5

Where: Position.1 for first methods of trajectory planning and Position .2 for Soft motion

Manipulator dynamics is concerned with the equations of motion, the way in which the manipulator moves in response to torques applied by the actuators, and external forces. The The total kinetic energy of multiple-degree of freedom robot is given in a concise form as:

$$\mathbf{K}\_{i} = \frac{1}{2} \sum\_{i=1}^{n} \sum\_{p=1}^{i} \sum\_{r=1}^{i} \text{Trace}(\mathbf{U}\_{ip} I\_i \mathbf{U}\_{ir} T) \dot{q}\_p \dot{q}\_r + \frac{1}{2} \sum\_{i=1}^{n} I\_{i\text{int}} \dot{q}\_i^2 \tag{18}$$

$$\mathbf{U}\_{ip} = \frac{\partial^0 T\_i}{\partial \theta\_P} = \mathbf{Q}\_P \,^0 T\_i \quad \text{ } \mathbf{U}\_{ir} = \frac{\partial^0 T\_i}{\partial \theta\_r} = \mathbf{Q}\_r \,^0 T\_i \quad \text{ } \mathbf{U}\_{ir} = \mathbf{U}\_{ri}, \mathbf{U}\_{ip} = \mathbf{U}\_{Pi} \text{ and}$$

$$\mathbf{Q}\_i (revolutions) = \begin{bmatrix} 0 & -1 & 0 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix} \quad \text{ } \mathbf{Q}\_i (prismatrix) = \begin{bmatrix} 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 \end{bmatrix}$$

But in our case all joints in the robot arm used in surgical applications are considered revolute joints where *QP* = *Qr* = Q.

#### *4.2.1.2. The potential energy*

The potential energy of multiple-degree of freedom robot may be given in a concise from as:

$$P = \sum\_{j=1}^{n} P\_i = \sum\_{j=1}^{n} \left[ -m\_i g^T \left( {}^0 T\_j X \overline{r\_j} \right) \right] \tag{19}$$

$$\mathbf{g}^T = \begin{bmatrix} \mathbf{g}\_x & \mathbf{g}\_y & \mathbf{g}\_z & \mathbf{0} \end{bmatrix}$$

Micro-Robot Management 303

Arm Configuration

For the MATLAB simulation, the parameters of the robotic arm are given in table 5. The flowchart for the algorithm employed to calculate the torque history for each actuator based on the derived equations of motion (Equation 20) is shown in the Figure 18. The simulated results for the actuators torques change depending on the method of trajectory planning used to calculate the torque. For example the simulated results for the actuators torques calculated by the Third-Order Polynomial trajectory planning are presented in section 3. It can be seen that the torque history over the selected period of time (5, 10, 20 and 60 s) has

> The links transformation matrix

**Lagrange-Euler** 

Inverse kinematics model of arm architecture

**MATLAB** 

 The arm equations of motion

The torque relations and graphical output

considerable fluctuations.

The Joint trajectory planning

**Figure 18.** The flowchart of the dynamic model

**5.1. Introduction to the dynamic response and dynamic response analysis** 

The results presented in this chapter are those of chapters IV and V that is the trajectory planning and dynamic modeling respectively as they are very much related to each other. The results are divided into two sections. The first one is for the trajectory planning of the surgical robot which is divided into four parts, each represents a method from four chosen different methods for trajectory planning. As mentioned in chapter IV the joints limits for some of the joints are similar as the joints (1, 4, and 6) and (2, 5). Only the trajectory planning of similar joints will be represented. It should be noted that the results of trajectory planning for all methods were derived using four different times (5, 10, 20 and 60 s) in order to select

**5. The dynamic response** 

#### *4.2.1.3. Robot equations of motion*

The equations of motion of multiple-degree of freedom robot be given in a compact form as:

$$T\_i = \sum\_{j=1}^{n} D\_{ij} \ddot{q}\_j + I\_{i(act)j} \ddot{q}\_i + \sum\_{j=1}^{n} \sum\_{k=1}^{n} D\_{ijk} \dot{q}\_j q\_k + D\_i \tag{20}$$

$$\begin{aligned} D\_{ij} &= \sum\_{p=\max\{i,j\}}^n \text{Trace}\{\mathcal{U}\_{pj} I\_p \mathcal{U}\_{pi}^T\} \cdot \mathcal{D}\_{ijk} = \sum\_{p=\max\{i,j,k\}}^n \text{Trace}\{\mathcal{U}\_{pjk} I\_p \mathcal{U}\_{pi}^T\} \cdot \mathcal{U}\_{pj} \\ D\_i &= \sum\_{p=1}^n -m\_p g^T \mathcal{U}\_{pj} \overline{r\_p} \quad \mathcal{U}\_{Pik} = \frac{\partial \mathcal{U}\_{Pi}}{\partial \theta\_k} = \mathcal{U}\_{Pi} \mathcal{Q}\_k \, ^0 T\_k \end{aligned}$$

$$I\_{i} = \begin{bmatrix} \frac{(I\_{XX} + I\_{YY} + I\_{ZZ})}{2} & I\_{XY} & I\_{XZ} & m\_{i}\overline{X\_{i}} \\ & I\_{XY} & \frac{(I\_{XX} - I\_{YY} + I\_{ZZ})}{2} & I\_{YZ} & m\_{i}\overline{Y\_{i}} \\ & I\_{XZ} & I\_{YZ} & \frac{(I\_{XX} + I\_{YY} - I\_{ZZ})}{2} & m\_{i}\overline{Z\_{i}} \\ & m\_{i}\overline{X\_{i}} & & m\_{i}\overline{Z\_{i}} & m\_{i} \end{bmatrix}$$


**Table 5.** Full robotic mobility parameters

For the MATLAB simulation, the parameters of the robotic arm are given in table 5. The flowchart for the algorithm employed to calculate the torque history for each actuator based on the derived equations of motion (Equation 20) is shown in the Figure 18. The simulated results for the actuators torques change depending on the method of trajectory planning used to calculate the torque. For example the simulated results for the actuators torques calculated by the Third-Order Polynomial trajectory planning are presented in section 3. It can be seen that the torque history over the selected period of time (5, 10, 20 and 60 s) has considerable fluctuations.

**Figure 18.** The flowchart of the dynamic model

## **5. The dynamic response**

302 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

 <sup>0</sup> 1 1

*j j*

The potential energy of multiple-degree of freedom robot may be given in a concise from as:

 <sup>0</sup> *<sup>T</sup> xyz g ggg*

The equations of motion of multiple-degree of freedom robot be given in a compact form as:

*i ij j i act i ijk j k i*

**Link # 123456** Iact (Nmm) 10000 10000 10000 10000 10000 10000 m (kg) 6.055 6.055 6.055 6.055 6.055 6.055 L (mm) 0 50 15 36 0 39.5 g (m/s2) 9.81 9.81 9.81 9.81 9.81 9.81 R (mm) 75 75 75 75 75 75

*III <sup>I</sup> I mX*

*XY YZ i i*

*III <sup>I</sup> I mY*

*XZ YZ i i*

*III <sup>I</sup> <sup>I</sup> m Z*

*i i i i i i i*

*m X m Y mZ m*

( ) 2

*XX YY ZZ*

 ( ) 1 1 1

*j j k*

( )

Ixx (1/12)\*mi\*(3\*(R2)+(Li/4)2) Iyy (1/12)\*mi\*(3\*(R2)+(Li/4)2)

Izz mi \* R2 Ixy 0 Ixz 0 Iyz 0 X Li/2 Y 0 Z 0

*<sup>n</sup> <sup>T</sup> ij pj p pi*

> *<sup>n</sup> <sup>T</sup> i p pj p*

*D mgU r* ,

*D Trace U J U* ,

 1

*p*

( ) 2

*XX YY ZZ*

*n n n*

*n n <sup>T</sup>*

[ ( )]

 max( , , )

*p ijk*

*P P m g T Xr* (19)

*T Dq I q D qq D* (20)

( )

*<sup>n</sup> <sup>T</sup> ijk pjk p pi*

*D Trace U J U* ,

*Pi* 0 *Pik Pi k k k <sup>U</sup> U UQ T*

*XY XZ i i*

( ) 2

*XX YY ZZ*

*i i jj*

*4.2.1.2. The potential energy* 

*4.2.1.3. Robot equations of motion* 

*i*

**Table 5.** Full robotic mobility parameters

*J*

 max( , )

*p ij*

### **5.1. Introduction to the dynamic response and dynamic response analysis**

The results presented in this chapter are those of chapters IV and V that is the trajectory planning and dynamic modeling respectively as they are very much related to each other. The results are divided into two sections. The first one is for the trajectory planning of the surgical robot which is divided into four parts, each represents a method from four chosen different methods for trajectory planning. As mentioned in chapter IV the joints limits for some of the joints are similar as the joints (1, 4, and 6) and (2, 5). Only the trajectory planning of similar joints will be represented. It should be noted that the results of trajectory planning for all methods were derived using four different times (5, 10, 20 and 60 s) in order to select

the best time which gives the best and smooth orientation, velocity, acceleration (i.e. the inertia of the robot link) and torque. The dynamic modeling results are dependent on the trajectory planning results. This requires the results of the dynamic modeling to be represented after the trajectory planning results i.e. after comparison of the results of the trajectory planning and selecting the best time to be used.

Micro-Robot Management 305

**0 2 4 6 8 10**

**0 2 4 6 8 10**

**0 10 20 30 40 50 60**

**0 10 20 30 40 50 60**

**<sup>0</sup> <sup>2</sup> <sup>4</sup> <sup>6</sup> <sup>8</sup> <sup>10</sup> <sup>0</sup>**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> <sup>0</sup>**

**-200 -100 0 100 200**

**-200 -100 0 100 200**

> **0 5 10**

> > **50 100 150**

**Figure 19.** The time comparison of third order trajectory planning of the first joint

**0 1 2 3 4 5**

**<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -100**

**0 5 10 15 20**

**0 5 10 15 20**

**<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> <sup>0</sup>**

**<sup>0</sup> <sup>5</sup> <sup>10</sup> <sup>15</sup> <sup>20</sup> <sup>0</sup>**

**-200 -100 0 100 200**

**-200 -100 0 100 200**

**50 100 150**

planning

capabilities is given by:

**Figure 20.** The comparison between the time and torque of the first joint using third order trajectory

For Third-order Polynomial trajectory planning the maximum accelerations for robot's

 

From Figure 19 the robot acceleration needed at the beginning of the motion is 0.62

6( ) ( ) *f i*

*f i t t* (21)

(degree/s2) as well as -0.62 (degree/s2) deceleration at the end of the motion.

 max

Finally, a comparison of the results is held to choose the best method that gives the smooth set trajectory planning and best performance of the robot under investigation.The simulation results were obtained using MATLAB.

## **5.2. The trajectory planning analysis**

As previously stated that trajectory planning was derived using four methods of the trajectory planning to select the best method that gives the smooth set trajectory planning and best performance of the robot under investigation.

The trajectory planning results is presented in two ways. The first one shows the trajectory planning of the first joint of robot derived using four different times and the second one shows the torque history for the first joint and a comparison between the four times of the first joint of robot in terms of the orientation, velocity, acceleration and the torque history to select the best time that can be used to derive the trajectory planning and torque history for all joints of robot model.

## *5.2.1. Third order Polynomial trajectory planning*

Figures 19 and 20 show comparisons between the orientation, velocity, acceleration, torque and four different time ranges (5, 10, 20 and 60 s) of the first joint of the surgical robot. It is clearly shown in Figure 19 that the orientation behaviour increases gradualy with the time from the initial angle to the final angle and as the time increases the velocity required decreases and also the acceleration i.e. the inertia of the robot link decreases. It is also clearly shown in Figure 20 that the original torque history has considerable fluctuations. It is clear that the highest hub torque is for joint one while actuator torque of joint 6 is the lowest.

From Figures 19 and 20 the optimum final time required to complete the process for the robot can be selected. By inspection of Figure 19 for the trajectory planning of the robot we find that for all times the same behaviours i.e. the velocity and acceleration are inversely proportional with the times and the orientation behaviour increases gradualy with the time from the initial angle to the final angle. The largest time i.e. 60s to complete the results of the surgical robot can be selected. Since this time has the lowest acceleration i.e the lowest inertia. In Figure 20 for the torque history in the time 60s we find that the torque decreases with time and the over shooting decreases gradualy near the steady state time 60s.

It is seen from Table 4 that the joints angle ranges are very large. So, it is assured that the robot accelerations will not exceed the maximum permissible limits for robot's capabilities if the robot is satisfying the trajectory in one segment.

**Figure 19.** The time comparison of third order trajectory planning of the first joint

trajectory planning and selecting the best time to be used.

simulation results were obtained using MATLAB.

and best performance of the robot under investigation.

*5.2.1. Third order Polynomial trajectory planning* 

the robot is satisfying the trajectory in one segment.

**5.2. The trajectory planning analysis** 

all joints of robot model.

the best time which gives the best and smooth orientation, velocity, acceleration (i.e. the inertia of the robot link) and torque. The dynamic modeling results are dependent on the trajectory planning results. This requires the results of the dynamic modeling to be represented after the trajectory planning results i.e. after comparison of the results of the

Finally, a comparison of the results is held to choose the best method that gives the smooth set trajectory planning and best performance of the robot under investigation.The

As previously stated that trajectory planning was derived using four methods of the trajectory planning to select the best method that gives the smooth set trajectory planning

The trajectory planning results is presented in two ways. The first one shows the trajectory planning of the first joint of robot derived using four different times and the second one shows the torque history for the first joint and a comparison between the four times of the first joint of robot in terms of the orientation, velocity, acceleration and the torque history to select the best time that can be used to derive the trajectory planning and torque history for

Figures 19 and 20 show comparisons between the orientation, velocity, acceleration, torque and four different time ranges (5, 10, 20 and 60 s) of the first joint of the surgical robot. It is clearly shown in Figure 19 that the orientation behaviour increases gradualy with the time from the initial angle to the final angle and as the time increases the velocity required decreases and also the acceleration i.e. the inertia of the robot link decreases. It is also clearly shown in Figure 20 that the original torque history has considerable fluctuations. It is clear that the highest hub torque is for joint one while actuator torque of joint 6 is the lowest.

From Figures 19 and 20 the optimum final time required to complete the process for the robot can be selected. By inspection of Figure 19 for the trajectory planning of the robot we find that for all times the same behaviours i.e. the velocity and acceleration are inversely proportional with the times and the orientation behaviour increases gradualy with the time from the initial angle to the final angle. The largest time i.e. 60s to complete the results of the surgical robot can be selected. Since this time has the lowest acceleration i.e the lowest inertia. In Figure 20 for the torque history in the time 60s we find that the torque decreases

It is seen from Table 4 that the joints angle ranges are very large. So, it is assured that the robot accelerations will not exceed the maximum permissible limits for robot's capabilities if

with time and the over shooting decreases gradualy near the steady state time 60s.

**Figure 20.** The comparison between the time and torque of the first joint using third order trajectory planning

For Third-order Polynomial trajectory planning the maximum accelerations for robot's capabilities is given by:

$$\ddot{\theta}\_{\text{max}} = \left| \frac{\left(\Theta(\theta\_f - \theta\_i)\right)}{\left(t\_f - t\_i\right)} \right| \tag{21}$$

From Figure 19 the robot acceleration needed at the beginning of the motion is 0.62 (degree/s2) as well as -0.62 (degree/s2) deceleration at the end of the motion.

Micro-Robot Management 307

But from the equation 6.1 the maximum permissible accelerations for this robot joints is 0.6 (degree/s2). So to be ensured that robot joint accelerations will not exceed the maximum accelerations for robot's capabilities the robot should satisfy the trajectory planning in two

Figures 21a, b and c show the modified trajectories for the six joints, after dividing the

The joints angle ranges of the initial and final angles are large compared to the values of the velocity and accelerations. So it is more suitable to represent the angle-Time relation and

Figures 22 and 23 show comparisons between the orientation, velocity, acceleration, and torque for four different time ranges (5, 10, 20 and 60 s) of the first joint of the robot. As is clearly shown in Figure 22 the orientation behaviour increases gradually with time from the initial angle to the final angle for the times (5, 10 and 20 s) only. But for the time 60s the orientation increases gradually from the initial angle to 40 degree then decreases to -40 degree and then increases reaching the final angle. And if the time increases the velocity required decreases. This is similar as to what is shown in Figure 23 which presents the original torque history that has considerable fluctuations. It is clear that the highest hub

> **-200 -100 0 100 200**

> > **0 50 100**

> **-20 -10 0 10 20**

**0 1 2 3 4 5 6 7 8 9 10**

**0 1 2 3 4 5 6 7 8 9 10**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> -200**

**0 10 20 30 40 50 60**

velocity and acceleration – Time relations in two separate figures.

torque is for joint one while actuator torque of joint 6 is the lowest.

**0 1 2 3 4 5**

**<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -100**

**0 5 10 15 20**

**0 5 10 15 20**

**Figure 22.** The time comparison of fifth order trajectory planning of the first joint

*5.2.2. Fifth order Polynomial trajectory planning* 

or more segments.

trajectory in to two segments.

**-200 -100 0 100 200**

**-200 -100 0 100 200**

**Figure 21.** The orientation, angular velocity and angular acceleration for six joint micro-robot using Third order Polynomial trajectory planning

But from the equation 6.1 the maximum permissible accelerations for this robot joints is 0.6 (degree/s2). So to be ensured that robot joint accelerations will not exceed the maximum accelerations for robot's capabilities the robot should satisfy the trajectory planning in two or more segments.

Figures 21a, b and c show the modified trajectories for the six joints, after dividing the trajectory in to two segments.

The joints angle ranges of the initial and final angles are large compared to the values of the velocity and accelerations. So it is more suitable to represent the angle-Time relation and velocity and acceleration – Time relations in two separate figures.

#### *5.2.2. Fifth order Polynomial trajectory planning*

306 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

(a) The first, fourth and sixth joints

**0**

**5**

**ANGULAR VELOCITY & ACCELERATION**

**10**

**15**

**<sup>0</sup> <sup>20</sup> <sup>40</sup> <sup>60</sup> -5**

**ANGULAR VELOCITY ANGULAR ACCELERATION**

**time (S)**

**ANGULAR VELOCITY ANGULAR ACCELERATION**

**<sup>0</sup> <sup>20</sup> <sup>40</sup> <sup>60</sup> -5**

**time (S)**

**ANGULAR VELOCITY ANGULAR ACCELERATION**

**<sup>0</sup> <sup>20</sup> <sup>40</sup> <sup>60</sup> -5**

**time (S)**

**0 20 40 60**

**0 20 40 60**

**time (S)**

**time (S)**

**-150 -100 -50 0 50 100 150**

> **-80 -60 -40 -20 0 20 40 60 80**

**ORIENTATION** 

**ORIENTATION**

**ORIENTATION** 

(b) The second and fifth joints

**0**

**0**

**5**

**ANGULAR VELOCITY & ACCELERATION**

**10**

**5**

**ANGULAR VELOCITY & ACCELERATION**

**10**

**Figure 21.** The orientation, angular velocity and angular acceleration for six joint micro-robot using

(c) The third joint

**<sup>0</sup> <sup>20</sup> <sup>40</sup> <sup>60</sup> <sup>0</sup>**

**time (S)**

Third order Polynomial trajectory planning

Figures 22 and 23 show comparisons between the orientation, velocity, acceleration, and torque for four different time ranges (5, 10, 20 and 60 s) of the first joint of the robot. As is clearly shown in Figure 22 the orientation behaviour increases gradually with time from the initial angle to the final angle for the times (5, 10 and 20 s) only. But for the time 60s the orientation increases gradually from the initial angle to 40 degree then decreases to -40 degree and then increases reaching the final angle. And if the time increases the velocity required decreases. This is similar as to what is shown in Figure 23 which presents the original torque history that has considerable fluctuations. It is clear that the highest hub torque is for joint one while actuator torque of joint 6 is the lowest.

**Figure 22.** The time comparison of fifth order trajectory planning of the first joint

Micro-Robot Management 309

**Figure 24.** The orientation, angular velocity and angular acceleration for six joint micro-robot using

**<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -50**

(c) The the third joint

**time (S)**

(a) The first, fourth and sixth joints

**time (S)**

**ORIENTATION ANGULAR VELOCITY ANGULAR ACCELERATION**

**<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -200**

**-50**

**0**

**50**

**100**

**ORIENTATION & ANGULAR VELOCITY & ACCELERATION**

**150**

**200**

**0**

**ORIENTATION & ANGULAR VELOCITY & ACCELERATION**

**50**

**100**

**ORIENTATION & ANGULAR VELOCITY & ACCELERATION**

(b) The second and fifth joints

**ORIENTATION ANGULAR VELOCITY ANGULAR ACCELERATION**

**time (S)**

**ORIENTATION ANGULAR VELOCITY ANGULAR ACCELERATION**

**<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -100**

Fifth order Polynomial trajectory planning

**Figure 23.** The comparison between the time and torque of the first joint using fifth order trajectory planning

From Figures 22 and 23 the optimum final time required to complete the process for the robot can be selected. It is seen from figures that the trajectory planning of the robot for the times (5, 10 and 20 s) has the same properties i.e. the velocity is inversely proportional with time. The orientation behaviour increased gradualy with the time from the initial angle to the final angle. Where the time 60s is omitted from selected. For figure 23 for the torque history in the time (5, 10, 20 and 60 s) it is found for 5 *<sup>f</sup> t* s, the dominant part in the torque history is the inertia matrix. Increasing the final time to 10, 20 and 60s shifts the dominant term from inertia matrix to Centrifugal and Coriolis matrices. This is due to the vanishing of the acceleration at most of the joint trajectory. Another consequence of increasing the final time is the dramatic increase in the peak value of the joint torque which requires big actuator size for the same task (i.e. the same joint parameters). The time 5s to complete the results of the surgical robot can be selected. Since this time has orientation behaviour was increased gradualy with the time from the initial angle to the final angle and the torque history curves were affected by the inertia of the link of robot.

Figures 24a, b and c show the trajectories for the six joints of the robot using Fifth order Polynomial trajectory planning.

#### *5.2.3. Linear segments with parabolic blends*

Figures 25 and 26 show comparisons between the orientation, velocity, acceleration, torque and four different time ranges (5, 10, 20 and 60 s) of the first joint of the surgical robot. It is clearly shown in the Figure 25 that the orientation behaviour increases gradually with the time from the initial angle to the final angle and as the time increases the velocity required decreases and also the acceleration i.e. the inertia of the robot link decreases**.** It is also clearly shown in the Figure 26 that the original torque history has considerable fluctuations. It is clear that the highest hub torque is for joint one while actuator torque of joint 6 is the lowest.

**<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -500**

**<sup>0</sup> <sup>5</sup> <sup>10</sup> <sup>15</sup> <sup>20</sup> <sup>0</sup>**

**Figure 23.** The comparison between the time and torque of the first joint using fifth order trajectory

history curves were affected by the inertia of the link of robot.

Polynomial trajectory planning.

*5.2.3. Linear segments with parabolic blends* 

actuator torque of joint 6 is the lowest.

From Figures 22 and 23 the optimum final time required to complete the process for the robot can be selected. It is seen from figures that the trajectory planning of the robot for the times (5, 10 and 20 s) has the same properties i.e. the velocity is inversely proportional with time. The orientation behaviour increased gradualy with the time from the initial angle to the final angle. Where the time 60s is omitted from selected. For figure 23 for the torque history in the time (5, 10, 20 and 60 s) it is found for 5 *<sup>f</sup> t* s, the dominant part in the torque history is the inertia matrix. Increasing the final time to 10, 20 and 60s shifts the dominant term from inertia matrix to Centrifugal and Coriolis matrices. This is due to the vanishing of the acceleration at most of the joint trajectory. Another consequence of increasing the final time is the dramatic increase in the peak value of the joint torque which requires big actuator size for the same task (i.e. the same joint parameters). The time 5s to complete the results of the surgical robot can be selected. Since this time has orientation behaviour was increased gradualy with the time from the initial angle to the final angle and the torque

**5000**

**10000**

**<sup>0</sup> <sup>2</sup> <sup>4</sup> <sup>6</sup> <sup>8</sup> <sup>10</sup> <sup>0</sup>**

**0 10 20 30 40 50 60**

Figures 24a, b and c show the trajectories for the six joints of the robot using Fifth order

Figures 25 and 26 show comparisons between the orientation, velocity, acceleration, torque and four different time ranges (5, 10, 20 and 60 s) of the first joint of the surgical robot. It is clearly shown in the Figure 25 that the orientation behaviour increases gradually with the time from the initial angle to the final angle and as the time increases the velocity required decreases and also the acceleration i.e. the inertia of the robot link decreases**.** It is also clearly shown in the Figure 26 that the original torque history has considerable fluctuations. It is clear that the highest hub torque is for joint one while

planning

**0**

**500**

(c) The the third joint

**Figure 24.** The orientation, angular velocity and angular acceleration for six joint micro-robot using Fifth order Polynomial trajectory planning

Micro-Robot Management 311

**Figure 27.** The orientation, angular velocity and angular acceleration for six joint micro-robot using

(c) The third joint

(a) The first, fourth and sixth joints

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> -200**

**time (S)**

**0 10 20 30 40 50 60**

**time (S)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> -1**

**time (S)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> -100**

**time (sec)**

**0 10 20 30 40 50 60**

**time (sec)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> -1**

**time (sec)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> <sup>0</sup>**

**time (sec)**

**0 10 20 30 40 50 60**

**time (sec)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> -1**

**time (sec)**

**0 200**

**0 5 10 ANGULAR VELOCITY**

> **0 1**

**0 100**

**0 2 4 ANGULAR VELOCITY**

> **0 1**

**100 200**

**0 2 4 ANGULAR VELOCITY**

> **0 1**

**ANGULAR ACC**

**ORIENTATION**

**ANGULAR ACC**

**ORIENTATION**

**ANGULAR ACC**

**ORIENTATION**

(b) The second and fifth joints

parabolic blends trajectory planning

**Figure 25.** The time comparison of liner segments with parabolic blends trajectory of the first joint

**Figure 26.** The comparison between the time and torque of the first joint using liner segments with parabolic blends trajectory planning

From Figures 25 and 26 the optimum final time required to complete the process for the robot can be selected. By inspection of Figure 25 the trajectory planning has three segments they are First parabolic blends, Straight line and Second parabolic blends. The straight line segment was very important segment because the velocity in this segment is constant and the acceleration was zero i.e. no inertia of the link of the robot in this segment of time. It is therefore better to have a larger period for this segment. The largest time i.e. 60s to complete the results of the robot can be selected. Since this time has the largest period of straight line segment. By inspection of Figure 26 for the torque history in the time 60s we find that the torque decreases with the time and the shooting decreases gradualy near the steady state time 60s.

Figures 27a, b and c show the trajectories for the six joints of the robot using linear segments with parabolic blends.

**0 200**

> **0 20**

**0 200**

> **0 5 10**

> > **0 1**

> > > **50 100 150**

> > > **50 100 150**

**<sup>0</sup> <sup>2</sup> <sup>4</sup> <sup>6</sup> <sup>8</sup> <sup>10</sup> -200**

**0 2 4 6 8 10**

**<sup>0</sup> <sup>2</sup> <sup>4</sup> <sup>6</sup> <sup>8</sup> <sup>10</sup> -20**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> -200**

**0 10 20 30 40 50 60**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> -1**

**<sup>0</sup> <sup>2</sup> <sup>4</sup> <sup>6</sup> <sup>8</sup> <sup>10</sup> <sup>0</sup>**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> <sup>0</sup>**

**<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -200**

**0 1 2 3 4 5**

**0 1 2 3 4 5**

**<sup>0</sup> <sup>5</sup> <sup>10</sup> <sup>15</sup> <sup>20</sup> -200**

**0 5 10 15 20**

**<sup>0</sup> <sup>5</sup> <sup>10</sup> <sup>15</sup> <sup>20</sup> -5**

**<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> <sup>0</sup>**

**<sup>0</sup> <sup>5</sup> <sup>10</sup> <sup>15</sup> <sup>20</sup> <sup>0</sup>**

**0 200**

> **-50 0 50**

**0 200**

> > **0 5**

**50 100 150**

**50 100 150**

**Figure 25.** The time comparison of liner segments with parabolic blends trajectory of the first joint

**Figure 26.** The comparison between the time and torque of the first joint using liner segments with

with the time and the shooting decreases gradualy near the steady state time 60s.

From Figures 25 and 26 the optimum final time required to complete the process for the robot can be selected. By inspection of Figure 25 the trajectory planning has three segments they are First parabolic blends, Straight line and Second parabolic blends. The straight line segment was very important segment because the velocity in this segment is constant and the acceleration was zero i.e. no inertia of the link of the robot in this segment of time. It is therefore better to have a larger period for this segment. The largest time i.e. 60s to complete the results of the robot can be selected. Since this time has the largest period of straight line segment. By inspection of Figure 26 for the torque history in the time 60s we find that the torque decreases

Figures 27a, b and c show the trajectories for the six joints of the robot using linear segments

parabolic blends trajectory planning

with parabolic blends.

**Figure 27.** The orientation, angular velocity and angular acceleration for six joint micro-robot using parabolic blends trajectory planning

#### *5.2.4. Soft motion trajectory planning*

Figures 28 and 29 show comparisons between the orientation, velocity, acceleration, jerk, torque and four different time ranges (5, 10, 20 and 60 s) of the first joint of the surgical robot. It is clearly shown in the Figure 28 that the orientation behaviour increases gradually with the time from the initial angle to the final angle and as the time increases the velocity required decreases and also the acceleration i.e. the inertia of the robot link decreases. It is also clearly shown in Figure 29 that the original torque history has considerable fluctuations. It is clear that the highest hub torque is for joint one while actuator torque of joint 6 is the lowest.

Micro-Robot Management 313

**Figure 30.** The orientation, angular velocity and angular acceleration for six joint micro-robot using soft

(c) The third joint

**0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5**

**time (S)**

(a) The first, fourth and sixth joints

**time (S)**

**ORIENTATION ANGULAR VELOCITY ANGULAR ACCELERATION JERK**

**<sup>0</sup> 0.5 <sup>1</sup> 1.5 <sup>2</sup> 2.5 <sup>3</sup> 3.5 <sup>4</sup> 4.5 <sup>5</sup> -200**

**-80 -60 -40 -20 0 20 40 60 80 100**

**-50**

**0**

**50**

**ORIENTATION , ANGULAR VELOCITY,** 

**ANGULAR ACCELERATION AND JERK** 

**100**

**150**

**200**

**ORIENTATION ANGULAR VELOCITY ANGULAR ACCELERATION JERK**

**ORIENTATION , ANGULAR VELOCITY,**

 **ANGULAR ACCELERATION AND JERK** 

**ORIENTATION , ANGULAR VELOCITY,**

 **ANGULAR ACCELERATION AND JERK** 

(b) The second and fifth joints

**<sup>0</sup> 0.5 <sup>1</sup> 1.5 <sup>2</sup> 2.5 <sup>3</sup> 3.5 <sup>4</sup> 4.5 <sup>5</sup> -100**

**time (S)**

**ORIENTATION ANGULAR VELOCITY ANGULAR ACCELERATION JERK**

From Figures 28 and 29 we can select the optimum final time required to complete the process for the robot. By inspection of Figure 28 we find the trajectory planning three segments they are maximum jerk, maximum acceleration and maximum velocity. The maximum acceleration and maximum velocity segments were very important segments because the velocity in the maximum velocity segment is constant and the acceleration was zero i.e. no inertia of the link of the robot in this segment of time and the acceleration in the maximum acceleration segment is constant and the jerk of the link of the robot was zero. It is therefore better to have a larger period for this segment. It is seen from figures that the segments were released from time 60s but the the maximum velocity segment only was released from time 10s. Where the times (10

motion trajectory planning

**Figure 28.** The time comparison of Soft motion trajectory planning of the first joint

**Figure 29.** The comparison between the time and torque of the first joint using soft motion trajectory planning

**Figure 28.** The time comparison of Soft motion trajectory planning of the first joint

**Figure 29.** The comparison between the time and torque of the first joint using soft motion trajectory

Figures 28 and 29 show comparisons between the orientation, velocity, acceleration, jerk, torque and four different time ranges (5, 10, 20 and 60 s) of the first joint of the surgical robot. It is clearly shown in the Figure 28 that the orientation behaviour increases gradually with the time from the initial angle to the final angle and as the time increases the velocity required decreases and also the acceleration i.e. the inertia of the robot link decreases. It is also clearly shown in Figure 29 that the original torque history has considerable fluctuations. It is clear that the highest hub torque is for joint one while

> **-200 -100 0 100 200**

> > **-50 0 50**

**0 200**

> **0 5 10**

> > **0 2**

**-5000 0 5000**

**0 2 4 6 8 10**

**0 2 4 6 8 10**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> -200**

**0 10 20 30 40 50 60**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> -2**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> -1000**

**0 2 4 6 8 10**

*5.2.4. Soft motion trajectory planning* 

actuator torque of joint 6 is the lowest.

**<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -200**

**0 5 10 15 20**

**<sup>0</sup> <sup>5</sup> <sup>10</sup> <sup>15</sup> <sup>20</sup> -10**

**0 1 2 3 4 5**

**<sup>0</sup> <sup>5</sup> <sup>10</sup> <sup>15</sup> <sup>20</sup> -4000**

**-200 -100 0 100 200**

**-5000 0 5000**

planning

**Figure 30.** The orientation, angular velocity and angular acceleration for six joint micro-robot using soft motion trajectory planning

From Figures 28 and 29 we can select the optimum final time required to complete the process for the robot. By inspection of Figure 28 we find the trajectory planning three segments they are maximum jerk, maximum acceleration and maximum velocity. The maximum acceleration and maximum velocity segments were very important segments because the velocity in the maximum velocity segment is constant and the acceleration was zero i.e. no inertia of the link of the robot in this segment of time and the acceleration in the maximum acceleration segment is constant and the jerk of the link of the robot was zero. It is therefore better to have a larger period for this segment. It is seen from figures that the segments were released from time 60s but the the maximum velocity segment only was released from time 10s. Where the times (10 and 60 s) is omitted from selected i.e. the times (10 and 60 s) have properties were not satisfactory for trajectory of robot. And by inspection of Figure 29 for the torque history in the times (5 and 20 s) we find for 5 *<sup>f</sup> t* s, the dominant part in the torque history is the inertia matrix. Increasing the final time to 20s, shift the dominant term from inertia matrix to Centrifugal and Coriolis matrices since the effect of angular velocity will be obviously high. This is due to the vanishing of the acceleration at most of the joint trajectory. Another consequence is of increasing the final time is the dramatic change in the peak value of the joint torque which requires big actuator size for the same task. So we can select the time 5s to complete the results of the robot because the torque history curve was affected by the inertia and it has the important segment i.e. maximum acceleration and maximum velocity segments.

Micro-Robot Management 315

**Torque history**

**Torque history**

**Torque history**

**Torque history**

**Torque history**

**Torque history**

**0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5**

**time (S)**

**0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5**

**time (S)**

**<sup>0</sup> 0.5 <sup>1</sup> 1.5 <sup>2</sup> 2.5 <sup>3</sup> 3.5 <sup>4</sup> 4.5 <sup>5</sup> -100**

**time (S)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> <sup>0</sup>**

**time (S)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> <sup>0</sup>**

**time (S)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> <sup>0</sup>**

**time (S)**

*5.3.2. The dynamic analysis results using Fifth order Polynomial trajectory planning* 

**-200 -100 0 100 200**

**-100 0 100**

**Torque T6 (Nmm)**

**Torque T4 (Nmm)**

**Torque T2 (Nmm)**

**Torque history**

(a) first joint (b) second joint

**Torque history**

**Torque history**

**<sup>0</sup> 0.5 <sup>1</sup> 1.5 <sup>2</sup> 2.5 <sup>3</sup> 3.5 <sup>4</sup> 4.5 <sup>5</sup> -500**

**<sup>0</sup> 0.5 <sup>1</sup> 1.5 <sup>2</sup> 2.5 <sup>3</sup> 3.5 <sup>4</sup> 4.5 <sup>5</sup> -200**

**time (S)**

**0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5**

**time (S)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> <sup>0</sup>**

**time (S)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> <sup>0</sup>**

**time (S)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> <sup>0</sup>**

**time (S)**

**time (S)**

(c) third joint (d) fourth joint

(e) fifth joint (f) sixth joint

(a) first joint (b) second joint

**Torque history**

**Torque history**

(c) third joint (d) fourth joint

**Torque history**

**Figure 32.** Torque history for Fifth order Polynomial trajectory planning

*planning* 

**50 100 150**

**50 100**

**Torque T5 (Nmm)**

**Torque T3 (Nmm)**

**Torque T1 (Nmm)**

**0 500**

**-100 -50 0 50 100**

**Torque T5 (Nmm)**

**Torque T3 (Nmm)**

**Torque T1 (Nmm)**

*5.3.3. The dynamic analysis results using Linear segments with parabolic blends trajectory* 

**50 100**

**50 100**

**20 40**

**Torque T6 (Nmm)**

**Torque T4 (Nmm)**

**Torque T2 (Nmm)**

**Figure 33.** Torque history for Linear segments with parabolic blends trajectory planning

(e) fifth joint (f) sixth joint

Figures 30a, b and c show the trajectories for the six joints of the robot using soft motion trajectory planning.

## **5.3. The dynamic response analysis**

As previously stated that the dynamic analysis of the surgical robot was derived using Lagrange-Euler technique and the results of the dynamic analysis were depended on the method of trajectory planning. In the trajectory planning results were derived using four different methods. The dynamic analysis results of surgical robot are divided into four parts each part in for each special method of the four different methods which have been derived from the trajectory planning.

Figures 31 to 34 show the original torque history which clearly shown considerable fluctuations. It is clear that the highest hub torque is experienced at joint one while actuator torque of joint 6 is the lowest.

*5.3.1. The dynamic analysis results using Third order Polynomial trajectory planning* 

**Figure 31.** Torque history for Third order Polynomial trajectory planning

*5.3.2. The dynamic analysis results using Fifth order Polynomial trajectory planning* 

trajectory planning.

**5.3. The dynamic response analysis** 

from the trajectory planning.

torque of joint 6 is the lowest.

**50 100 150**

**20 40 60**

**Torque T5 (Nmm)**

**Torque T3 (Nmm)**

**Torque T1 (Nmm)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> <sup>0</sup>**

**time (S)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> <sup>0</sup>**

**time (S)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> <sup>0</sup>**

**time (S)**

and 60 s) is omitted from selected i.e. the times (10 and 60 s) have properties were not satisfactory for trajectory of robot. And by inspection of Figure 29 for the torque history in the times (5 and 20 s) we find for 5 *<sup>f</sup> t* s, the dominant part in the torque history is the inertia matrix. Increasing the final time to 20s, shift the dominant term from inertia matrix to Centrifugal and Coriolis matrices since the effect of angular velocity will be obviously high. This is due to the vanishing of the acceleration at most of the joint trajectory. Another consequence is of increasing the final time is the dramatic change in the peak value of the joint torque which requires big actuator size for the same task. So we can select the time 5s to complete the results of the robot because the torque history curve was affected by the inertia and it has the important segment i.e. maximum acceleration and maximum velocity segments. Figures 30a, b and c show the trajectories for the six joints of the robot using soft motion

As previously stated that the dynamic analysis of the surgical robot was derived using Lagrange-Euler technique and the results of the dynamic analysis were depended on the method of trajectory planning. In the trajectory planning results were derived using four different methods. The dynamic analysis results of surgical robot are divided into four parts each part in for each special method of the four different methods which have been derived

Figures 31 to 34 show the original torque history which clearly shown considerable fluctuations. It is clear that the highest hub torque is experienced at joint one while actuator

**50 100**

**20 40 60**

**Torque T6 (Nmm)**

**Torque T4 (Nmm)**

**Torque T2 (Nmm)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> <sup>0</sup>**

**Torque history**

**Torque history**

**Torque history**

**time (S)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> <sup>0</sup>**

**time (S)**

**<sup>0</sup> <sup>10</sup> <sup>20</sup> <sup>30</sup> <sup>40</sup> <sup>50</sup> <sup>60</sup> <sup>0</sup>**

**time (S)**

*5.3.1. The dynamic analysis results using Third order Polynomial trajectory planning* 

**Torque history**

**Torque history**

**Torque history**

(a) first joint (b) second joint

(c) third joint (d) fourth joint

(e) fifth joint (f) sixth joint

**Figure 31.** Torque history for Third order Polynomial trajectory planning

**Figure 32.** Torque history for Fifth order Polynomial trajectory planning

*5.3.3. The dynamic analysis results using Linear segments with parabolic blends trajectory planning* 

**Figure 33.** Torque history for Linear segments with parabolic blends trajectory planning

Micro-Robot Management 317

method was the disappearance of the shooting quite before the final time of trajectory i.e.

the steady state time. T

*Department of Mechanical Engineering Faculty of Engineering,* 

j the total number of joints i the total number of coordinates n the total number of links k and p coefficient (1, 2, 3… n) x, y, z local joint coordinates X,Y,Z global joint coordinates

Yi the Kinematics equations of the end effectors Xj the joint variables (θ1, θ2, θ3, θ4, θ5, θ6) D the end effector differential translation matrix

( )*t* , *J t*( ) the orientation, angular velocity, angular acceleration and angular

D<sup>θ</sup> the joint differential motion matrix J the robot Jacobian matrix (i x j) θ<sup>i</sup> the initial values of each joint angle θ<sup>f</sup> the final values of each joint angle

jerk respectively

q the vector of generalized joint coordinates

Taca Acceleration constant initial time

Tacb Acceleration constant final time

*q* the vector of joint velocities *q* the vector of joint accelerations

tf the time duration

, the initial conditions Tjpa Jerk positive initial time

Tjna Jerk negative initial time Tvc Velocity constant time Tjnb Jerk negative final time

Tjpb Jerk positive final time

M the inertia matrix

*Alexandria University, Alexandria, Egypt* 

**Appendix (A): Notation** 

Cj cos θ<sup>j</sup> Sj sin θ<sup>j</sup>

**Author details** 

Wael A. Al-Tabey

**Appendix** 

( )*t* , ( )*t* , 

000 , 

*5.3.4. The dynamic analysis results using Soft motion trajectory planning* 

**Figure 34.** Torque history for Soft motion trajectory planning

## **6. Conclusions**

A kinematic and dynamic analysis for a six-degree-of-freedom surgical robot were presented in this work. The kinematic model is based on Denavit-Hartenberg representation and the workspace of the end-effector is defined by solving the inverse kinematics problem. Four different methods were used to derive the trajectory planning for the six joints and were designed and employed to calculate the torque history for the six actuators. The dynamic equations of motion in symbolic form were derived using the Lagrange-Euler technique and the torque history was obtained using MATLAB for each joint. The proposed algorithm is flexible and can be extended to any robot configuration provided that the Denavit-Hartenberg presentation was available and the physical limits of joints are defined. The original torque history has considerable fluctuations. It was shown that the highest hub torque was of joint 1 while actuator torque of joint 6 was the lowest. It should be also noted that changing the final time for the joint trajectory changes the torque history considerably. The final time required to complete the process was selected depending on the method used to derive the trajectory planning as previously stated.

It was clearly shown in this work that the best method of trajectory planning that gives the smooth set trajectory planning and best performance of the robot under investigation was the soft motion trajectory planning because the most important reason for this selection was the torque history that has the lowest number ever of shooting and the shooting was distributed regularly over the period of time unlike the other methods which have a long number of shootings and were distributed randomly. Also the reason for selecting this method was the disappearance of the shooting quite before the final time of trajectory i.e. the steady state time. T

## **Author details**

316 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

*5.3.4. The dynamic analysis results using Soft motion trajectory planning* 

**Torque history**

**-4000 -2000 0 2000 4000**

**-1000 0 1000**

> **-500 0 500**

**Torque T6 (Nmm)**

**Torque T4 (Nmm)**

**Torque T2 (Nmm)**

**0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5**

**Torque history**

**Torque history**

**Torque history**

**time (S)**

**0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5**

**time (S)**

**<sup>0</sup> 0.5 <sup>1</sup> 1.5 <sup>2</sup> 2.5 <sup>3</sup> 3.5 <sup>4</sup> 4.5 <sup>5</sup> -1000**

**time (S)**

(a) first joint (b) second joint

**Torque history**

**Torque history**

(c) third joint (d) fourth joint

(e) fifth joint (f) sixth joint

**Figure 34.** Torque history for Soft motion trajectory planning

**0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5**

**time (S)**

**0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5**

**time (S)**

**0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5**

**time (S)**

to derive the trajectory planning as previously stated.

A kinematic and dynamic analysis for a six-degree-of-freedom surgical robot were presented in this work. The kinematic model is based on Denavit-Hartenberg representation and the workspace of the end-effector is defined by solving the inverse kinematics problem. Four different methods were used to derive the trajectory planning for the six joints and were designed and employed to calculate the torque history for the six actuators. The dynamic equations of motion in symbolic form were derived using the Lagrange-Euler technique and the torque history was obtained using MATLAB for each joint. The proposed algorithm is flexible and can be extended to any robot configuration provided that the Denavit-Hartenberg presentation was available and the physical limits of joints are defined. The original torque history has considerable fluctuations. It was shown that the highest hub torque was of joint 1 while actuator torque of joint 6 was the lowest. It should be also noted that changing the final time for the joint trajectory changes the torque history considerably. The final time required to complete the process was selected depending on the method used

It was clearly shown in this work that the best method of trajectory planning that gives the smooth set trajectory planning and best performance of the robot under investigation was the soft motion trajectory planning because the most important reason for this selection was the torque history that has the lowest number ever of shooting and the shooting was distributed regularly over the period of time unlike the other methods which have a long number of shootings and were distributed randomly. Also the reason for selecting this

**6. Conclusions** 

**-5000 0 5000**

**-2000 -1000 0 1000 2000**

**-1000 0 1000**

**Torque T5 (Nmm)**

**Torque T3 (Nmm)**

**Torque T1 (Nmm)**

Wael A. Al-Tabey *Department of Mechanical Engineering Faculty of Engineering, Alexandria University, Alexandria, Egypt* 

## **Appendix**

## **Appendix (A): Notation**



Micro-Robot Management 319

c1=cos(th1);c2=cos(th2);c3=cos(th3);c4=cos(th4);c5=cos(th5);c6=cos(th6); s1=sin(th1);s2=sin(th2);s3=sin(th3);s4=sin(th4);s5=sin(th5);s6=sin(th6);

A06=A1\*A2\*A3\*A4\*A5\*A6;

subplot(1,3,1);plot(xa,ya); xlabel('Px');ylabel('Py');grid on subplot(1,3,2);plot(xa,z); xlabel('Px');ylabel('Pz');grid on subplot(1,3,3);plot(ya,z); xlabel('Py');ylabel('Pz');grid on

**7. References** 

px= A06(4,1),py= A06(4,2),pz=A06(4,3)

in Pediatric Surgery, Volume 14, pp. 267– 275.

2, pp. 2262, 14-19 Sept. 2003.

A3=[c3,0,-s3,0;s3,0,c3,0;0,-1,0,0;0,0,0,1];A4=[c4,0,-s4,0;s4,0,c4,0;0,-1,0,L3;0,0,0,1]; A5=[c5,0,-s5,0;s5,0,c5,0;0,-1,0,0;0,0,0,1];A6=[c6,-s6,0,0;s6,c6,0,0;0,0,1,L4;0,0,0,1]; A01=A1;A02=A1\*A2;A03=A1\*A2\*A3;A04=A1\*A2\*A3\*A4;A05=A1\*A2\*A3\*A4\*A5;

%\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*D.H matrix\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* A1=[c1,-s1,0,L1\*c1;s1,c1,0,L1\*s1;0,0,1,0;0,0,0,1];A2=[c2,0,s2,L2\*c2;s2,0,-c2,L2\*s2;0,1,0,0;0,0,0,1];

%\*\*\*\*\*\*\*\*\*\*\*\*\*The Kinematics equations of the end effectors\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

%\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*THE end\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* %\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*CREATED BY DR/WAEL A. AL-TABEY\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

[1] Frumento, C. (2005). Development of micro tools for surgical applications. A Ph. D. Co-Tutorship Thesis, University' Degli Studi De Genova/ Uiversite Piere et Marie Currie Paris. [2] Venita, C. Sanjeev, D. and Craig, T. (2006). Surgical robotics and image guided therapy in pediatric surgery: Emerging and converging minimal access technologies, Seminars

[3] Tsai, T. and Hsu, Y. (2004). Development of a parallel surgical robot with automatic bone drilling carriage for stereotactic neurosurgery, IEEE SMC, International Conference on

[4] Miller, A. and Christensen, H. (2003). Implementation of Multi-rigid-body Dynamics within a Robotic Grasping Simulator, Proceedings of International Conference, Volume

[5] Featherstone, R. and Orin, D. (2000). Robot Dynamics: Equations and Algorithms, Proc.

[6] Wang, S. (2008). Conceptual design and dimensional synthesis of Micro-Hand,

[7] Alc, G. and Shirinzadeh, B. (2004). Loci of singular configurations of 3-DOF spherical parallel manipulator, Robotics and Autonomous Systems, Volume 48, pp. 77–91. [8] Ben-Horin, R. (1998). kinematics, dynamics and construction of a planarly actuated parallel robot, Robotics and computer –integrated Manufacturing, Volume 14, pp. 163–172. [9] Bonnifait, P. and Garcia, G. (1999). 6-DOF dynamic localization of an outdoor mobile

Systems, Man and Cybernetics, Hague, Netherlands, October 10-13, 2004.

Mechanism and Machine Theory, Volume 43, Issue 9, pp. 1186-1197.

IEEE Int. Conf. on Robotics and Automation, pp. 826-834.

robot, Control Engineering Practice, Volume 7, pp. 383–390.

## **Appendix (B): MATLAB Code**


```
c1=cos(th1);c2=cos(th2);c3=cos(th3);c4=cos(th4);c5=cos(th5);c6=cos(th6); 
s1=sin(th1);s2=sin(th2);s3=sin(th3);s4=sin(th4);s5=sin(th5);s6=sin(th6); 
%*************************D.H matrix***************************************************************** 
A1=[c1,-s1,0,L1*c1;s1,c1,0,L1*s1;0,0,1,0;0,0,0,1];A2=[c2,0,s2,L2*c2;s2,0,-c2,L2*s2;0,1,0,0;0,0,0,1]; 
A3=[c3,0,-s3,0;s3,0,c3,0;0,-1,0,0;0,0,0,1];A4=[c4,0,-s4,0;s4,0,c4,0;0,-1,0,L3;0,0,0,1]; 
A5=[c5,0,-s5,0;s5,0,c5,0;0,-1,0,0;0,0,0,1];A6=[c6,-s6,0,0;s6,c6,0,0;0,0,1,L4;0,0,0,1]; 
A01=A1;A02=A1*A2;A03=A1*A2*A3;A04=A1*A2*A3*A4;A05=A1*A2*A3*A4*A5; 
A06=A1*A2*A3*A4*A5*A6; 
%*************The Kinematics equations of the end effectors************************************** 
px= A06(4,1),py= A06(4,2),pz=A06(4,3) 
subplot(1,3,1);plot(xa,ya); 
xlabel('Px');ylabel('Py');grid on
subplot(1,3,2);plot(xa,z); 
xlabel('Px');ylabel('Pz');grid on
subplot(1,3,3);plot(ya,z); 
xlabel('Py');ylabel('Pz');grid on
%*********************************************THE end*********************************************** 
%**********************CREATED BY DR/WAEL A. AL-TABEY***********************************
```
## **7. References**

318 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

*<sup>x</sup> g* , *<sup>y</sup> g* and *<sup>z</sup> g* the gravity components in x, y and z direction respectively *jr* the location of the center of mass of link relative to the frame

%\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

%\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

%\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*THE INPUTS OF ROBOT \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

%\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

%\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

the distance between the X, Y and Z axis to the center of the link

C the Coriolis and centrifugal matrix

Q the vector of generalized force associated

representing the link

*XX I* , *YY I* and *ZZ I* the principal moments of inertia for the link *XY I* , *XZ I* and *YZ I* the parallel moments of inertia for the link

mass respectively

% Micro-Robot Management % Complete MATLAB Code for kinematic

L1=input('please enter The length of Link NO(1) (mm)='); L2=input('please enter The length of Link NO(2) (mm)='); L3=input('please enter The length of Link NO(3) (mm)='); L4=input('please enter The length of Link NO(4) (mm)=');

th1=th1min:2:th1max;th2=th2min:th2max;th3=th3min:th3max; th4=th4min:2:th4max;th5=th5min:th5max;th6=th6min:2:th6max;

G the gravity matrix

*Tg* he gravity matrix (1x4)

Tj the torque on joint (j) *iJ* the inertia matrix

*mi* the mass of the link

**Appendix (B): MATLAB Code** 

syms th1 th2 th3 th4 th5 th6 L1 L2 L3 L4

th1min=input('please enter minth1 (degree)='); th1max=input('please enter maxth1 (degree)='); th2min=input('please enter minth2 (degree)='); th2max=input('please enter maxth2 (degree)='); th3min=input('please enter minth3 (degree)='); th3max=input('please enter maxth3 (degree)='); th4min=input('please enter minth4 (degree)='); th4max=input('please enter maxth4 (degree)='); th5min=input('please enter minth5 (degree)='); th5max=input('please enter maxth5 (degree)='); th6min=input('please enter minth6 (degree)='); th6max=input('please enter maxth6 (degree)=');

*Xi* , *Yi* and *Zi*

	- [10] Abdellatif, H. and Heimann, B. (2008). Computational efficient inverse dynamics of 6- DOF fully parallel manipulators by using the Lagrangian formalism, Mechanism and Machine Theory, Volume 7, pp. 383–390.

**Chapter 13** 

© 2012 Vajnberger et al., licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

© 2012 Vajnberger et al., licensee InTech. This is a paper distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

**Remote Process Control** 

**and Monitoring Using Matlab** 

Additional information is available at the end of the chapter

http://dx.doi.org/10.5772/46464

papers form references [5-7].

fast response [8-12].

**1. Introduction** 

Vedran Vajnberger, Semir Silajdžić and Nedim Osmić

Remote control is one of the best solutions for managing inaccessible systems. Many researches have been made in the field of the remote control [1-4]. These researches have improved certain aspects of industry, medicine, military, etc. The benefits of remote control are numerous such as: operating in hazard environment, telemedicine, missile guidance, etc. The most important characteristic of remote control is operating in real-time as shown in

Many applications in the field of medicine and industry use different kind of motor-based systems especially stepper motors because of their wide-range of sufficient characteristics like the fact that they can be used as constant power devices with accurate positioning and

In today's society, robots are used in various areas especially in those where high precision is required. Some of the examples where robotic arms found their appliance are: in vehicle construction where efficiency and reliability are required, in chemical industry where environment is not suitable for human, in medicine where robotic arm precision is used in operations, etc [13]. Robots have improved life standards and we are upgrading their

This chapter describes implementation of the proposed remote control of the stepper motor and robotic arm with five DOF via web server and VNC server [14, 15]. VNC server was used to receive visual feedback from robotic arm. The quality of image was important and it couldn't be sent via MATLAB server because real time characteristic would be lost. The decision to use microcontroller was based on its characteristics. Developing such system is

performances in order to make our lives easier and more comfortable.

cheaper than developing on other platforms such as PLC or FPGA.


## **Remote Process Control and Monitoring Using Matlab**

Vedran Vajnberger, Semir Silajdžić and Nedim Osmić

Additional information is available at the end of the chapter

http://dx.doi.org/10.5772/46464

## **1. Introduction**

320 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

robot, Mechanism and Machine Theory, Volume 40, pp. 1051–1067.

manipulator, Journal of Sound and vibration, Volume 243(4), pp. 641-65.

Machine Theory, Volume 7, pp. 383–390.

Computers in Simulation, Volume 41, pp. 485–508.

Research Communications, Volume 32, pp. 636–644.

Journal of Mechanics A/Solids, Volume 23, pp. 703-715.

Engineering Science and Technology, Volume 2, No. 1, pp. 32-54.

Computing, Volume 7, pp. 659– 667.

International (UK) Limited, pp. 147-159.

International (UK) Limited, pp. 128-138.

1, pp. 22-29, ISSN 1 746-7233.

Prefectural University, Japan, October 4-6, 2010.

Magazine, 3(1):pp.24–32.

[10] Abdellatif, H. and Heimann, B. (2008). Computational efficient inverse dynamics of 6- DOF fully parallel manipulators by using the Lagrangian formalism, Mechanism and

[11] Zhu, Z. (2005). Kinematic and dynamic modelling for real-time control of Tau parallel

[12] Gouliaev, V. and Zavrazhina, T. (2001). Dynamics of a flexible multi-link cosmic robot-

[13] Carrera, E. and Serna, M. (1996). Inverse dynamics of flexible robots, Mathematics and

[14] Martins, F. (2008). An adaptive dynamic controller for autonomous mobile robot trajectory tracking, Control Engineering Practice, Volume 16, pp. 1354– 1363. [15]Valero, F. (2006). Trajectory planning in workspaces with obstacles taking into account the dynamic robot behaviour, Mechanism and Machine Theory, Volume 41, pp. 525– 536. [16] Geng, T. (2005). Dynamics and trajectory planning of a planar flipping robot, Mechanics

[17]Alessandro, G and Vanni, Z. (2008). A technique for time-jerk optimal planning of robot trajectories, Robotics and Computer-Integrated Manufacturing, Volume 24, pp. 415– 426. [18] Pires, S. (2007). Manipulator trajectory planning using a MOEA, Applied Soft

[19] Chettibi, T. (2004). Minimum cost trajectory planning for industrial robots, European

[20] Alessandro, G. and Vanni, Z. (2007). A new method for smooth trajectory planning of robot manipulators, Mechanism and Machine Theory, Volume 42, pp. 455– 471, 2007. [21] Corke, P. (1996). A Robotics Toolbox for MATLAB, IEEE Robotics and Automation

[22] Ata, A. (2007). Optimal Trajectory Planning for Manipulators: A Review, Journal of

[23] Niku, S. (2001). Introduction to Robotics Analysis, Systems, Applications, London,

[24] Herrera, I. and Sidobre, D. (2006). Soft Motion and Visual Control of Service Robot, The Fifth International Symposium in Robotics and Automation, August 2006. [25] Niku, S. (2001). Introduction to Robotics Analysis, Systems, Applications, London,

[26] Al-Tabey, W. (2010). Effect of Trajectory Planning on Dynamic Response of Micro-Robot for Surgical Application, 9th WSEAS International Conference on System Science and Simulation in Engineering (ICOSSSE '10), ISBN: 978-960-474-230-1, Iwate

[27] Tawfik, K. Ata, A. Al-Tabey, W. (2009). Kinematics and dynamics analysis of microrobot for surgical applications, World Journal of Modelling and Simulation, Vol. 5, No. Remote control is one of the best solutions for managing inaccessible systems. Many researches have been made in the field of the remote control [1-4]. These researches have improved certain aspects of industry, medicine, military, etc. The benefits of remote control are numerous such as: operating in hazard environment, telemedicine, missile guidance, etc. The most important characteristic of remote control is operating in real-time as shown in papers form references [5-7].

Many applications in the field of medicine and industry use different kind of motor-based systems especially stepper motors because of their wide-range of sufficient characteristics like the fact that they can be used as constant power devices with accurate positioning and fast response [8-12].

In today's society, robots are used in various areas especially in those where high precision is required. Some of the examples where robotic arms found their appliance are: in vehicle construction where efficiency and reliability are required, in chemical industry where environment is not suitable for human, in medicine where robotic arm precision is used in operations, etc [13]. Robots have improved life standards and we are upgrading their performances in order to make our lives easier and more comfortable.

This chapter describes implementation of the proposed remote control of the stepper motor and robotic arm with five DOF via web server and VNC server [14, 15]. VNC server was used to receive visual feedback from robotic arm. The quality of image was important and it couldn't be sent via MATLAB server because real time characteristic would be lost. The decision to use microcontroller was based on its characteristics. Developing such system is cheaper than developing on other platforms such as PLC or FPGA.

© 2012 Vajnberger et al., licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. © 2012 Vajnberger et al., licensee InTech. This is a paper distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

The realized system exhibits the following:

	- a. of the velocity, number of steps and rotation direction of the stepper motor,
	- b. of the rotation direction of the DC motors inside each joint of the robotic arm
	- a. data acquisition and transmission to confirm the proper operation of the stepper motor

Remote Process Control and Monitoring Using Matlab 323

**Figure 1.** a) Interconnected units of stepper motor system; b) Interconnected units of robotic arm

If triggering impulses are reversed (U4÷U1) movement of the motor is in the opposite direction. The length of the triggering impulses depends on desired velocity. The width

system

**Figure 2.** Triggering impulses and gear response


Both systems consist of all previously mentioned characteristics, where character 'a)' refers to stepper motor and character 'b)' to robotic arm.

This chapter is structured as follows: In section 2. whole data analysis of the realization of the system in accordance with previously specified requirements is described. Section 3. provides hardware description that was realized manually. Section 4. explains hardware programming.

## **2. Problem analysis**

The problem of realizied systems that remotely control stepper motor and robotic arm can be divided into several interconnected units, as it will be described in the following text and shown on Figure 1. and Figure 2. To understand the problem and its solution, a brief description of each part will be provided in the rest of this section.

a. Control via microcontroller

The Microchip microcontroller PIC16F877a © generates impulses on four pins that are used to stimulate the movement of the stepper motor gear as shown in Figure 2. Stepper motor consists of multiple "toothed" electromagnets ranged around a coil of iron. Those electromagnets need to be stimulated by some kind of external control unit, in our case a microcontroller. The microcontroller provides electrical impulses which stimulate the gear's teeth to magnetically be attracted to electromagnet's teeth. When the gear's teeth are thus aligned to the first electromagnet, they are slightly offset from the next electromagnet. When the next electromagnet is turned on and the first is turned off, the gear rotates slightly to align with the next one, and from there the process is repeated. Each of those slight rotations is called a "step," with an integer number of steps making a full rotation. In that way, the motor can be turned by a precise angle [16].

The impulses (U1÷U4) and response on Figure 2. show the movement of the stepper in one direction by four steps. Each step corresponds with one triggering impulse.

Remote Process Control and Monitoring Using Matlab 323

**Figure 1.** a) Interconnected units of stepper motor system; b) Interconnected units of robotic arm system

**Figure 2.** Triggering impulses and gear response

a. of the velocity, number of steps and rotation direction of the stepper motor, b. of the rotation direction of the DC motors inside each joint of the robotic arm

a. data acquisition and transmission to confirm the proper operation of the stepper

b. visual feedback and contact sensors to confirm the proper operation of the robotic

Both systems consist of all previously mentioned characteristics, where character 'a)' refers

This chapter is structured as follows: In section 2. whole data analysis of the realization of the system in accordance with previously specified requirements is described. Section 3. provides hardware description that was realized manually. Section 4. explains hardware

The problem of realizied systems that remotely control stepper motor and robotic arm can be divided into several interconnected units, as it will be described in the following text and shown on Figure 1. and Figure 2. To understand the problem and its solution, a brief

The Microchip microcontroller PIC16F877a © generates impulses on four pins that are used to stimulate the movement of the stepper motor gear as shown in Figure 2. Stepper motor consists of multiple "toothed" electromagnets ranged around a coil of iron. Those electromagnets need to be stimulated by some kind of external control unit, in our case a microcontroller. The microcontroller provides electrical impulses which stimulate the gear's teeth to magnetically be attracted to electromagnet's teeth. When the gear's teeth are thus aligned to the first electromagnet, they are slightly offset from the next electromagnet. When the next electromagnet is turned on and the first is turned off, the gear rotates slightly to align with the next one, and from there the process is repeated. Each of those slight rotations is called a "step," with an integer number of steps making a full rotation. In that way, the

The impulses (U1÷U4) and response on Figure 2. show the movement of the stepper in one

direction by four steps. Each step corresponds with one triggering impulse.

description of each part will be provided in the rest of this section.

The realized system exhibits the following:

2. adjustment

5. feedback

programming.

**2. Problem analysis** 

a. Control via microcontroller

motor can be turned by a precise angle [16].

motor

arm 6. realized GUI.

1. implementation based on PIC16F877a microcontroller,

3. precise control over RS-232 serial communication, 4. extension to remote control the whole system,

to stepper motor and character 'b)' to robotic arm.

If triggering impulses are reversed (U4÷U1) movement of the motor is in the opposite direction. The length of the triggering impulses depends on desired velocity. The width

between those impulses is infinitesimal. The shorter the length of the triggering impulses is, the higher velocity becomes; i.e. to reach 60 [rpm], the length of each triggering impulse needs to be 5 [ms], to reach 120 [rpm] length should be 2.5 [ms]. As earlier mentioned, besides velocity control, there was the urge for exact positioning. This task was realized by sending a certain amount of triggering impulses in the correct order.

Remote Process Control and Monitoring Using Matlab 325

rotation and 0 for stop). The second bit represents desired mode of operation (1 for velocity and 0 for positional mode). The third bit determines direction of rotation. The last five bits of message1, together with message2, represent desired velocity (13 bits for velocity). Message3 and message4 are low and high bytes of desired number of steps. The last m-file

ends the serial port session.

**Figure 3.** Movement description of robotic arm

**Figure 4.** Conversion TTL logic level into RS232 logic level

Even though stepper motors are used in open-looped systems because of their characteristics, in this case an additional encoder was installed on the system. Its purpose is to check if the stepper responses accurately to the given commands i.e. combination of impulses.

Similar to the robotic arm (Figure 1.b), Microchip microcontroller PIC16F877A© generates impulses on ten pins (PORT D and two pins from PORT C) which are triggering relays. Signals from relays are used to stimulate the movement of the DC motors implemented inside joins of the robotic arm.

For every degree of freedom (DOF) two pins of microcontroller and two relays are assigned (pins RD0 and RD1 for base, RD2 and RD3 for shoulder, RD4 and RD5 for elbow, RD6 and RD7 for wrist and RC0 and RC1 for fist).

Depending on the state of two pins, there are four situations:


Figure 3. explains the movement of robotic arm.

b. Control via RS-232

In this chapter, the advantages of a microcontroller were used to establish a communication with the server PC. The used communication is the serial communication RS-232. Serial communication is the most common low-level protocol for communicating between two or more devices [17, 18]. Texas Instruments' MAX232 is used to make adjustment between microcontroller's TTL logic level (5V÷0V) and logic level for RS232 standard (-12V÷12V). An example of the conversion is shown in Figure 4.

The communication was established through MATLAB using three m-files. One m-file was written to create serial port object and to configure its properties. The communication between the server PC and the microcontroller is realized by using second m-function called "send". It has five input arguments: *send(s1, message1, message2, message3, message4)*. The first input argument is the name of a created serial port object. Other arguments are one-byte values that are sent to the microcontroller. Those values represent desired mode of operation (velocity or positional mode), direction of rotation, velocity and number of steps (available only in positional mode). The first bit of message1 is start bit (1 for start of rotation and 0 for stop). The second bit represents desired mode of operation (1 for velocity and 0 for positional mode). The third bit determines direction of rotation. The last five bits of message1, together with message2, represent desired velocity (13 bits for velocity). Message3 and message4 are low and high bytes of desired number of steps. The last m-file ends the serial port session.

**Figure 3.** Movement description of robotic arm

324 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

stepper responses accurately to the given commands i.e. combination of impulses.

sending a certain amount of triggering impulses in the correct order.

inside joins of the robotic arm.

RD7 for wrist and RC0 and RC1 for fist).

appropriate DOF is not running,

running in appropriate direction,

Figure 3. explains the movement of robotic arm.

example of the conversion is shown in Figure 4.

and source is short circuited.

b. Control via RS-232

Depending on the state of two pins, there are four situations:


between those impulses is infinitesimal. The shorter the length of the triggering impulses is, the higher velocity becomes; i.e. to reach 60 [rpm], the length of each triggering impulse needs to be 5 [ms], to reach 120 [rpm] length should be 2.5 [ms]. As earlier mentioned, besides velocity control, there was the urge for exact positioning. This task was realized by

Even though stepper motors are used in open-looped systems because of their characteristics, in this case an additional encoder was installed on the system. Its purpose is to check if the

Similar to the robotic arm (Figure 1.b), Microchip microcontroller PIC16F877A© generates impulses on ten pins (PORT D and two pins from PORT C) which are triggering relays. Signals from relays are used to stimulate the movement of the DC motors implemented

For every degree of freedom (DOF) two pins of microcontroller and two relays are assigned (pins RD0 and RD1 for base, RD2 and RD3 for shoulder, RD4 and RD5 for elbow, RD6 and




In this chapter, the advantages of a microcontroller were used to establish a communication with the server PC. The used communication is the serial communication RS-232. Serial communication is the most common low-level protocol for communicating between two or more devices [17, 18]. Texas Instruments' MAX232 is used to make adjustment between microcontroller's TTL logic level (5V÷0V) and logic level for RS232 standard (-12V÷12V). An

The communication was established through MATLAB using three m-files. One m-file was written to create serial port object and to configure its properties. The communication between the server PC and the microcontroller is realized by using second m-function called "send". It has five input arguments: *send(s1, message1, message2, message3, message4)*. The first input argument is the name of a created serial port object. Other arguments are one-byte values that are sent to the microcontroller. Those values represent desired mode of operation (velocity or positional mode), direction of rotation, velocity and number of steps (available only in positional mode). The first bit of message1 is start bit (1 for start of

**Figure 4.** Conversion TTL logic level into RS232 logic level

For the robotic arm system, communication was established through MATLAB using two m-files. First m-file creates serial port and configures its properties. The communication between the server PC and the microcontroller is realized using second m-file. In this m-file, function was created to collect data set by user inside GUI.

Remote Process Control and Monitoring Using Matlab 327

Two m-files were created (for host and client) using previously mentioned m-files. The required toolbox can be found in the references along with all explanations for each m-file [19].

Figure 6. shows detailed hardware structure of the implemented distributed systems. It is a

**Figure 6.** a) Block structure of stepper motor system; b) Block structure of robotic arm system

important components used in this hardware realization.

Production implied the implementation of the entire hardware circuit and construction of work algorithm. The structure consists of a microcontroller and controlling elements for

**a) b)**

The stepper motor system is operated with commands from host PC which are sent through serial connection. Microcontroller interpretates those commands and generates trigger impulses on PORT D. These impulses are sent to unipolar transistors which are combined to form a power amplifier. This power amplifier is directly connected to the step motor. The step motor has an encoder disc mounted to its shaft. The encoder recognizes alterations from encoder disc and sends them as impulses to the analog input on PIC. These impulses are used to determine proper work of the stepper motor. Figure 7. shows the most

The robotic arm, shown in Figure 3., has five degrees of freedom modeled after the human arm. The controlling element consists of ten relays (Figure 8.), all assembled in accordance

**3. Hardware structure** 

both systems.

with scheme on Figure 9.

product of fully independent work.

c. Remote control via web server

Because MATLAB was used to send control commands to the microcontroller, an additional toolbox called TCP/UDP/IP was installed. This toolbox establishes a connection between two computers (server and client) using the TCP/IP protocol as shown in Figure 5.

**Figure 5.** Established connection

One of the computers is used as the server, while the other one is used as a client. The web server is established on the server computer. All commands that control the stepper and robotic arm are sent from the client computer. On the other hand, all feedback needed for acknowledgment of the proper remote control, i.e. did the stepper reached the desired velocity or did robotic arm reached assigned position, is send from the server to the client via established connection. All that was needed to establish a connection was provided in the additional toolbox using the created m-files such as pnet, pnet\_putvar and pnet\_getvar. Using the pnet m-file a handler called 'con' was created. This handler was used in combination with m-files pnet\_putvar and pnet\_getvar to send the necessary data to the connection and to collect that data from connection respectively. To access the visual information of the robotic arm acquired by the camera, VNC server was used. The camera is connected to the server computer and by using VNC server we can gain access to the server from a remote desktop.

Two m-files were created (for host and client) using previously mentioned m-files. The required toolbox can be found in the references along with all explanations for each m-file [19].

## **3. Hardware structure**

326 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

computers (server and client) using the TCP/IP protocol as shown in Figure 5.

function was created to collect data set by user inside GUI.

c. Remote control via web server

**Figure 5.** Established connection

from a remote desktop.

For the robotic arm system, communication was established through MATLAB using two m-files. First m-file creates serial port and configures its properties. The communication between the server PC and the microcontroller is realized using second m-file. In this m-file,

Because MATLAB was used to send control commands to the microcontroller, an additional toolbox called TCP/UDP/IP was installed. This toolbox establishes a connection between two

One of the computers is used as the server, while the other one is used as a client. The web server is established on the server computer. All commands that control the stepper and robotic arm are sent from the client computer. On the other hand, all feedback needed for acknowledgment of the proper remote control, i.e. did the stepper reached the desired velocity or did robotic arm reached assigned position, is send from the server to the client via established connection. All that was needed to establish a connection was provided in the additional toolbox using the created m-files such as pnet, pnet\_putvar and pnet\_getvar. Using the pnet m-file a handler called 'con' was created. This handler was used in combination with m-files pnet\_putvar and pnet\_getvar to send the necessary data to the connection and to collect that data from connection respectively. To access the visual information of the robotic arm acquired by the camera, VNC server was used. The camera is connected to the server computer and by using VNC server we can gain access to the server Figure 6. shows detailed hardware structure of the implemented distributed systems. It is a product of fully independent work.

**Figure 6.** a) Block structure of stepper motor system; b) Block structure of robotic arm system

Production implied the implementation of the entire hardware circuit and construction of work algorithm. The structure consists of a microcontroller and controlling elements for both systems.

The stepper motor system is operated with commands from host PC which are sent through serial connection. Microcontroller interpretates those commands and generates trigger impulses on PORT D. These impulses are sent to unipolar transistors which are combined to form a power amplifier. This power amplifier is directly connected to the step motor. The step motor has an encoder disc mounted to its shaft. The encoder recognizes alterations from encoder disc and sends them as impulses to the analog input on PIC. These impulses are used to determine proper work of the stepper motor. Figure 7. shows the most important components used in this hardware realization.

The robotic arm, shown in Figure 3., has five degrees of freedom modeled after the human arm. The controlling element consists of ten relays (Figure 8.), all assembled in accordance with scheme on Figure 9.

Remote Process Control and Monitoring Using Matlab 329

The operating princip of the relay is simple. When current flows between pins X and Y, it leads to the creation of a magentic field. The influence of the magnetic field causes a change in the position of the switch inside the relay. Control signals from microcontroller are sent to the controlling element. Those control signals need to enable the flow of current which is necessary to trigger the DC motors placed inside the joints of the robotic arm. The system is operated from the client's computer GUI. The commands from server are sent through serial connection. Microcontroller interpretates those commands and generates the control signals. These signals are sent to the controlling element made of relays. The controlling element is directly connected to the robotic arm. The proper work of the robotic arm is monitored via camera. There are also contact sensors on each joint of the arm used to prevent movements that could cause a malfunction. Those signals are transmitted back to the microcontroller and, in the case of a possible malfunction, the movement of the affected joint will be stopped immediately. Figure 9. shows the individual parts of the realized

After making the hardware, the next step was to program the circuit itself. The code is written in CCSC Compiler, version 4, from manufacturer Custom Computer Services Inc. [20]. The user chooses mode of operation, desired direction of rotation, velocity and number of steps using GUI. That information is collected into four 8-bits values and sent to server PC via ETHERNET. Server PC forwards those messages to microcontroller using RS-232. Microcontroller analyses received messages and sets/resets appropriate bits according to chosen mode, direction, velocity and number of steps. In the main program, if START bit is

structure and Figure 10. shows the final structure.

**Figure 10.** Final structure of the robotic arm system

**4. Hardware programming** 

a. Stepper motor

**Figure 7.** Realized system for stepper motor control

**Figure 9.** Microcontroller sheme and controlling elements – relays

The operating princip of the relay is simple. When current flows between pins X and Y, it leads to the creation of a magentic field. The influence of the magnetic field causes a change in the position of the switch inside the relay. Control signals from microcontroller are sent to the controlling element. Those control signals need to enable the flow of current which is necessary to trigger the DC motors placed inside the joints of the robotic arm. The system is operated from the client's computer GUI. The commands from server are sent through serial connection. Microcontroller interpretates those commands and generates the control signals. These signals are sent to the controlling element made of relays. The controlling element is directly connected to the robotic arm. The proper work of the robotic arm is monitored via camera. There are also contact sensors on each joint of the arm used to prevent movements that could cause a malfunction. Those signals are transmitted back to the microcontroller and, in the case of a possible malfunction, the movement of the affected joint will be stopped immediately. Figure 9. shows the individual parts of the realized structure and Figure 10. shows the final structure.

**Figure 10.** Final structure of the robotic arm system

## **4. Hardware programming**

#### a. Stepper motor

328 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

**Figure 7.** Realized system for stepper motor control

**Figure 9.** Microcontroller sheme and controlling elements – relays

**Figure 8.** Relay scheme

After making the hardware, the next step was to program the circuit itself. The code is written in CCSC Compiler, version 4, from manufacturer Custom Computer Services Inc. [20]. The user chooses mode of operation, desired direction of rotation, velocity and number of steps using GUI. That information is collected into four 8-bits values and sent to server PC via ETHERNET. Server PC forwards those messages to microcontroller using RS-232. Microcontroller analyses received messages and sets/resets appropriate bits according to chosen mode, direction, velocity and number of steps. In the main program, if START bit is

set, microcontroller generates appropriate sequence of triggering impulses based on chosen direction and velocity. The width of one impulse is given by:

$$T\_{\text{Width}} = \frac{^{60\text{ }000}}{^{RPM\text{ }200}} [\text{ms}] \tag{1}$$

Remote Process Control and Monitoring Using Matlab 331

**Figure 12.** Schematic display of the software for hardware structure with stepper motor

Timer1 is set to appropriate value so it overflows every 100 ms and an interrupt is generated. In Timer1 Interrupt Service Routine microcontroller sends number of steps made in last 100 ms to server PC via RS-232. Timer0 is used as counter. Output of encoder is led to pin RA4/T0CKI. Timer0 increments on every step. Client PC uses received information about number of steps made, calculate the velocity and shows it in GUI (Figure 11.).

**Figure 11.** Graphical User Interface for stepper motor system

How hardware is programmed for stepper motor is shown on Figure 12.

b. Robotic arm

After making the hardware, the next step was to program the circuit itself. The code is written in MPLAB IDE v7.5 [21]. Figure 13. shows how hardware is programmed.

To establish communication via ETHERNET, Real VNC program [22] and MATLAB Server are used. Real VNC program is used to obtain visual feedback by camera, and MATLAB Server is used for transmission of control messages from client PC to server PC. VNC Server was installed on server PC (PC connected to realized hardware structure), while VNC Viewer was used by client PC. By running the VNC Viewer and entering IP address of server PC, connection between two computers is established.

direction and velocity. The width of one impulse is given by:

 ������ <sup>=</sup> �� ���

**Figure 11.** Graphical User Interface for stepper motor system

server PC, connection between two computers is established.

b. Robotic arm

How hardware is programmed for stepper motor is shown on Figure 12.

After making the hardware, the next step was to program the circuit itself. The code is

To establish communication via ETHERNET, Real VNC program [22] and MATLAB Server are used. Real VNC program is used to obtain visual feedback by camera, and MATLAB Server is used for transmission of control messages from client PC to server PC. VNC Server was installed on server PC (PC connected to realized hardware structure), while VNC Viewer was used by client PC. By running the VNC Viewer and entering IP address of

written in MPLAB IDE v7.5 [21]. Figure 13. shows how hardware is programmed.

set, microcontroller generates appropriate sequence of triggering impulses based on chosen

Timer1 is set to appropriate value so it overflows every 100 ms and an interrupt is generated. In Timer1 Interrupt Service Routine microcontroller sends number of steps made in last 100 ms to server PC via RS-232. Timer0 is used as counter. Output of encoder is led to pin RA4/T0CKI. Timer0 increments on every step. Client PC uses received information

about number of steps made, calculate the velocity and shows it in GUI (Figure 11.).

������� ���� (1)

**Figure 12.** Schematic display of the software for hardware structure with stepper motor

Remote Process Control and Monitoring Using Matlab 333

Using the GUI (Figure 14.) the user chooses degree of freedom to manipulate with and the

The user monitor movement of robot arm by camera. Beside this visual feedback, for every DOF contact micro-sensor is implemented to avoid possible damage of the arm. When DOF reaches its final position, the micro-sensor becomes active and further

The effectiveness of a stepper motor is rated by the response of a single phase to the provided trigger impulse. The experimental results obtained by applying one impulse are shown on Figure 15., Figure 17. and Figure 19. The responses to certain defined velocities

The responses are almost instant as shown on Figure 15., Figure 17. and Figure 19. The small deviation is the result of mechanical characteristics of stepper motor. The noise seen in those figures is caused by imperfection of the encoder and its disc. The response signal collected from encoder is raised by 0.5 (V) because of the encoder's saturation, which represents a

Figure 16., Figure 18. and Figure 20. show various measurements of desired and actual velocity. It can be seen that the actual velocity follows the desired one. At certain moments there are deviations of actual velocity. These deviations are caused by restrictions of the

direction of movement.

movement is stopped.

**5. Testing results** 

nonlinear acting.

**Figure 14.** Graphical User Interface for robotic arm system

are shown on Figure 16., Figure 18. and Figure 20.

**Figure 13.** Schematic display of the software for hardware structure with robotic arm

When user chose degree of freedom and direction of movement, function from MATLAB is called. This function codes user's requirement into a short message which is sent to server and then to microcontroller via RS-232. Depending on the content of received message, microcontroller generates appropriate value to the PORT C or PORTD which is described in subchapter 2. section A.

Using the GUI (Figure 14.) the user chooses degree of freedom to manipulate with and the direction of movement.

**Figure 14.** Graphical User Interface for robotic arm system

The user monitor movement of robot arm by camera. Beside this visual feedback, for every DOF contact micro-sensor is implemented to avoid possible damage of the arm. When DOF reaches its final position, the micro-sensor becomes active and further movement is stopped.

## **5. Testing results**

332 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

**Figure 13.** Schematic display of the software for hardware structure with robotic arm

subchapter 2. section A.

When user chose degree of freedom and direction of movement, function from MATLAB is called. This function codes user's requirement into a short message which is sent to server and then to microcontroller via RS-232. Depending on the content of received message, microcontroller generates appropriate value to the PORT C or PORTD which is described in The effectiveness of a stepper motor is rated by the response of a single phase to the provided trigger impulse. The experimental results obtained by applying one impulse are shown on Figure 15., Figure 17. and Figure 19. The responses to certain defined velocities are shown on Figure 16., Figure 18. and Figure 20.

The responses are almost instant as shown on Figure 15., Figure 17. and Figure 19. The small deviation is the result of mechanical characteristics of stepper motor. The noise seen in those figures is caused by imperfection of the encoder and its disc. The response signal collected from encoder is raised by 0.5 (V) because of the encoder's saturation, which represents a nonlinear acting.

Figure 16., Figure 18. and Figure 20. show various measurements of desired and actual velocity. It can be seen that the actual velocity follows the desired one. At certain moments there are deviations of actual velocity. These deviations are caused by restrictions of the

used encoder. The shape of those deviations is the result of linear approximation of the characteristic.

Remote Process Control and Monitoring Using Matlab 335

**Figure 17.** Response to one step for velocity of 60 RPM

**Figure 18.** Desired and actual velocity of 60 RPM

**Figure 15.** Response to one step for velocity of 30 RPM

**Figure 16.** Desired and actual velocity of 30 RPM

**Figure 17.** Response to one step for velocity of 60 RPM

**Figure 15.** Response to one step for velocity of 30 RPM

**Figure 16.** Desired and actual velocity of 30 RPM

characteristic.

used encoder. The shape of those deviations is the result of linear approximation of the

**Figure 18.** Desired and actual velocity of 60 RPM

Remote Process Control and Monitoring Using Matlab 337

This paper presented the design of a remotely controlled stepper motor and robotic arm via web server. Operating algorithms and GUI were realized for both systems. Through the GUI for the stepper motor user can operate the motor in two modes: velocity and positional. The feedback received from the encoder is sent through the established connection from server to the client. Experimental results demonstrate the effectiveness of the remotely controlled stepper motor. Using the GUI for the robotic arm, user can operate each joint of robotic arm separately. The feedback received from the camera is sent through the established connection from server to the client. Experimental results are not shown in this paper, because as stated before, this model of robotic arm does not possess encoders. That is the reason why camera was used as visual feedback. The system operates in real time and visual feedback provides us information about current state of robotic arm. System is based on microcontroller and its development is not expensive, unlike the systems which are based on other technologies i.e. PLC. These systems are used in environments which are

**6. Conclusion** 

dangerous for humans.

*Faculty of Electrical Engineering,* 

Vedran Vajnberger, Semir Silajdžić and Nedim Osmić

September 13-15, Aachen, Germany, pp. 841-846

LAN Applicability for Real-time Control"

Conference on Image and Graphics

monitoring system with SC12"

*Department of Automatic Control and Electronics, Sarajevo, Bosnia and Herzegovina* 

*IEEE Transaction on Robotics and Automation*, vol. 9, pp. 592-606. [2] C. Sayers (1996) Remote Control Robotics, New York: Springer Verlag.

[1] T. B. Sheridan (1993) Space teleoperation through time delay review and prognosis,

[3] Velagic, J., Coralic, M. and Hebibovic, M. (2004) The Remote Control of Robot Manipulator for Precise Time-Limited Complex Path Tracking, Proceedings of the IEEE International Conference on Mechatronics and Robotics (MechRob2004), Volume 2,

[4] D. Lee, and M.W. Spong (2006) Passive Bilateral Teleoperation with Constant Time Delay, *IEEE Transactions on Robotics and Automation*, vol. 22, no.2, pp. 269-281. [5] Vladimir Lucan, Petr Simacek, Jari Seppälä, Hannu Koivisto, "Bluetooth and Wireless

[6] Xin Liu , Yongtian Wang , Yue Liu , Dongdong Weng, Xiaoming Hu (2009) A Remote Control System Based on Real-Time Image Processing, 2009 Fifth International

[7] Chui Yew Leong and Abdul Rahman Ramli, Intelligent Systems and Robotics Laboratory (ISRL), Institute Of Advanced Technology, Universiti Putra Malaysia. 43400 Serdang, Selangor. "Development of a real-time embedded remote triggering and

**Author details** 

**7. References** 

**Figure 19.** Response to one step for velocity of 120 RPM

**Figure 20.** Desired and actual velocity of 120 RPM

## **6. Conclusion**

336 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

**Figure 19.** Response to one step for velocity of 120 RPM

**Figure 20.** Desired and actual velocity of 120 RPM

This paper presented the design of a remotely controlled stepper motor and robotic arm via web server. Operating algorithms and GUI were realized for both systems. Through the GUI for the stepper motor user can operate the motor in two modes: velocity and positional. The feedback received from the encoder is sent through the established connection from server to the client. Experimental results demonstrate the effectiveness of the remotely controlled stepper motor. Using the GUI for the robotic arm, user can operate each joint of robotic arm separately. The feedback received from the camera is sent through the established connection from server to the client. Experimental results are not shown in this paper, because as stated before, this model of robotic arm does not possess encoders. That is the reason why camera was used as visual feedback. The system operates in real time and visual feedback provides us information about current state of robotic arm. System is based on microcontroller and its development is not expensive, unlike the systems which are based on other technologies i.e. PLC. These systems are used in environments which are dangerous for humans.

## **Author details**

Vedran Vajnberger, Semir Silajdžić and Nedim Osmić *Faculty of Electrical Engineering, Department of Automatic Control and Electronics, Sarajevo, Bosnia and Herzegovina* 

## **7. References**

	- [8] G.Srinivasarao, S.Sao, "Security system based on stepper motor control using microcontroller"

**Section 3** 

**MATLAB for Educational Purposes** 


**MATLAB for Educational Purposes** 

338 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

and Computational Applications, Vol. 14, No. 2

Cuffies , , Industrial Electronics, IEEE, Jun 2000.

*Journal of Translational Medicine*

Croatia

CRC Press. pp. 2464.

by Moxa Technologies)

by Moxa Technologies)

[20] htttp://www.ccsinfo.com, User guidance

[22] Personal Edition VNC Server 4.4 User Guide, 2008.,

microcontroller"

[8] G.Srinivasarao, S.Sao, "Security system based on stepper motor control using

[9] Ahmet Altintas, Department of Electrical Education Dumlupinar University, Faculty of Technical Education, 43500 Simav, Kütahya, Turkey, "A graphical user interface for programming stepper motors used at different kinds of applications", Mathematical

[10] Betin, F. Pinchon, D. Capolino, (2000) "Fuzzy logic applied to speed control of a stepping motor drive", G.-A. Dept. of Electr. Eng., Univ. of Picardie Jules Verne,

[11] Jan B.A. Habraken, Kora de Bruin, Morgan Shehata, Jan Booij, Roel Bennink, Berthe L.F. van Eck Smit and Ellinor Busemann Sokole, "Evaluation of High-Resolution Pinhole SPECT Using a Small Rotating Animal", Departments of Nuclear Medicine, Radiology, and Medical Technological Development, Academic Medical Center, University of

[12] Fang Liu, Zhenlin Hu, Lei Qiu, Chun Hui, Chao Li, Pei Zhong and Junping Zhang (2010) "Boosting high-intensity focused ultrasound-induced anti-tumor immunity using a sparse-scan strategy that can more effectively promote dendritic cell maturation",

[13] Salcudean, S. E., Ku, S., and Bell, G., 1997, "Performance Measurement in Scaled Teleoperation for Microsurgery," Proceedings of the First Joint Conference in Computer Vision, Virtual Reality and Robotics in Medicine and Medial Robotics and Computer-

[14] Jasmin Velagić, Nedim Osmić, Semir Silajdžić, Tarik Terzimehić and Vedran Vajnberger (2010) Remote Control of Stepper Motor via Web Server, Conference on Control and

[15] Vedran Vajnberger, Tarik Terzimehić, Semir Silajdžić and Nedim Osmić (2011) Remote Control of Robot Arm with Five DOF, International symposium for information and communication technologies, electronics and microelectronics – MIPRO 2011, Opatija,

[16] Liptak, Bela G. (2005)*. Instrument Engineers' Handbook: Process Control and Optimization*.

[17] Yidong Wang, Kaiguo Yan, Guozi Sun, Peihuang Lou, "Serial Communication in DNC Information Systems", The CIMS Center of NUAA, Nanjing 210016, China, Published

[18] Yidong Wang, Kaiguo Yan, Guozi Sun, Peihuang Lou, "Serial Communication in DNC Information Systems", The CIMS Center of NUAA, Nanjing 210016, China, Published

Amsterdam, Amsterdam, The Netherlands, , Basic Science Investigations.

Assisted Surgery (CVRMed-MRCA '97), Grenoble, France, pp. 789–798.

Fault – Tolerant Systems (SysTol'10), Nice, France, 10/2010.

[19] Peter Rydesaeter, TCP/UDP/IP toolbox 2.0.6. user guide, March 2001.

[21] MPLAB® IDE USER'S GUIDE, 2005 Microchip Technology Inc.,

**Chapter 14** 

© 2012 Blaho et al., licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

© 2012 Blaho et al., licensee InTech. This is a paper distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

**Education of Future Advanced Matlab Users** 

Technology surrounds us in every step we take. Computers, mobile phones or cars would not exist without smart researchers and innovators. We need more and more engineers and scientists to sustain technological growth. The current state of technology and technological growth is facing two problems. The first problem is population declining in many countries. Germany is a country with least population growth in Europe, for example. The second problem is that many industrial and research centres demand high quality engineers (Blau, 2011). These two problems come hand in hand as you can imagine. Society can affect both of them in some way but providing high quality engineers is what we can affect at fastest. Learning is an important process in our lives. Educational institutions prepare students to fulfil requirements from the society. There are many modern methods and technologies for

Computer aided learning has found a way in learning process from primary schools to universities (Abdullah et al., 2010, Bertrand, 1989). Computers are also significantly involved in teaching technology serving sciences like mathematics, physics and information technology. Technical computing plays an important role in these specializations. Many software applications are accessible for teaching as Matlab, Octave, Scilab and Mathematica, for example. Other specialized programs exist as well, but they are often used to solve specialized problems and tasks. Therefore we are not going to mention them. The worldwide most spread applications at educational institutions used by is Matlab, which is considered as standard in technical computing and science (The MathWorks, 2012a). Matlab is a very powerful tool for computing and simulation. Basic mathematical core provides functions for high performance computing. On top of that, Matlab provides add-ons (toolboxes) to enhance its usage via adding more functions in specialized fields of technology, economics, medicine or biology. Matlab is also applied in many publications in different fields. Matlab is not only exploited in computations but also in the process of teaching and learning. In the Matlab environment there are small GUI applications that can

Michal Blaho, Martin Foltin, Peter Fodrek and Ján Murgaš

learning but most of them have one in common today – computers.

be created to improve learning (Andreatos & Zagorianos, 2009).

Additional information is available at the end of the chapter

http://dx.doi.org/10.5772/46465

**1. Introduction** 

## **Education of Future Advanced Matlab Users**

Michal Blaho, Martin Foltin, Peter Fodrek and Ján Murgaš

Additional information is available at the end of the chapter

http://dx.doi.org/10.5772/46465

## **1. Introduction**

Technology surrounds us in every step we take. Computers, mobile phones or cars would not exist without smart researchers and innovators. We need more and more engineers and scientists to sustain technological growth. The current state of technology and technological growth is facing two problems. The first problem is population declining in many countries. Germany is a country with least population growth in Europe, for example. The second problem is that many industrial and research centres demand high quality engineers (Blau, 2011). These two problems come hand in hand as you can imagine. Society can affect both of them in some way but providing high quality engineers is what we can affect at fastest. Learning is an important process in our lives. Educational institutions prepare students to fulfil requirements from the society. There are many modern methods and technologies for learning but most of them have one in common today – computers.

Computer aided learning has found a way in learning process from primary schools to universities (Abdullah et al., 2010, Bertrand, 1989). Computers are also significantly involved in teaching technology serving sciences like mathematics, physics and information technology. Technical computing plays an important role in these specializations. Many software applications are accessible for teaching as Matlab, Octave, Scilab and Mathematica, for example. Other specialized programs exist as well, but they are often used to solve specialized problems and tasks. Therefore we are not going to mention them. The worldwide most spread applications at educational institutions used by is Matlab, which is considered as standard in technical computing and science (The MathWorks, 2012a). Matlab is a very powerful tool for computing and simulation. Basic mathematical core provides functions for high performance computing. On top of that, Matlab provides add-ons (toolboxes) to enhance its usage via adding more functions in specialized fields of technology, economics, medicine or biology. Matlab is also applied in many publications in different fields. Matlab is not only exploited in computations but also in the process of teaching and learning. In the Matlab environment there are small GUI applications that can be created to improve learning (Andreatos & Zagorianos, 2009).

© 2012 Blaho et al., licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. © 2012 Blaho et al., licensee InTech. This is a paper distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Extensive usage of Matlab demands high quality courses at educational institutions (Dogan, 2011). In fact multiple courses for different topics can be taught with the use of Matlab. To provide students with solid background for these topics, an introductory course for Matlab can be created. At our faculty we create such a course. The aim of this course is to gain basic skills that students can use in more advanced courses. Our course is divided into two parts. In the first part there are Matlab basics that every student must to know (Matlab basics, graphics and Simulink). At top of the basic specialized topics a more advanced courses are introduced to help during teaching topics that students will need later. Although we teach the Matlab course at our faculty we believe that Matlab can be used at secondary schools as supporting tool for the teachers. Matlab basics and graphics can be also taught to students at secondary school level (M. Varga & Z. Varga, 2010).

Education of Future Advanced Matlab Users 343

us when we lack of real world system in the education. Matlab contains many add-ons that are very useful in many fields of science. Matlab usage is a very popular in many science projects, bachelor, master and dissertation theses in the university environment. The basic Matlab course was established at the Faculty of Electrical Engineering and Information Technology in Bratislava to teach students to use Matlab and its add-ons. Matlab is a basic tool for every student at our faculty. We try to move this course into the first year of study for this reason. The knowledge, which students take from this course is a very useful in the

As we mentioned before at the Faculty of Electrical Engineering and Information Technology Bratislava there is Matlab used in many mathematical and technical courses. Students use Matlab for their computations and solutions in their bachelor, diploma or dissertation theses. Matlab course is introductory course to Matlab, Simulink and Matlab toolboxes. The faculty has two terms per year. Each term lasts twelve weeks. Course can be taken in second term of the first year of undergraduate study. It consists of one lecture (100 minutes) and practice (100 minutes) per week. The lectures are not compulsory, but practices are. Count of the attendance at lectures is more than a half of all students. The lectures are combination of explanation of the current topic, solving of basic tasks and discussion. All of tasks are solved directly on the computer using Matlab. The students are allowed to see how to solve the concrete problem and can write the notes into their handout. The full preprint of lecture is available a week ahead on the web pages of the course. The students can print this hand-out before the lecture. The hand-out with notes are useful source of the information for the practices. For this reason there are usually students who attend the lectures more successful than students who do not have the notes from the lectures. The aim of the Matlab course is to introduce students to the Matlab, to learn basic principles, syntax and solutions of some common problems. We focus on the most common problems which students may use in their future study or on the others courses. We cover

As you can see, there are many topics for just one course. But with the lecture time we just cover a simple introduction to these topics. That is not a big problem because they will have

other technical courses.

**2.1. Lectures**

these topics:

Simulink

Graphics and GUI

 Non-linear systems Identification Fuzzy logic Virtual reality Stateflow

Neural networks

Real-time

Matlab basics and programming

LTI continuous and discrete systems

Students have different types learning capabilities. We cannot satisfy all of them, but we could motivate them to achieve the best possible performance. One of the proper motivator is their evaluation (Blaho et al. 2010a, 2010b). If students can see that the hard effort is rewarded than they want to learn more and more. The other motivator is collaboration. Many students are competitive by nature and they want to achieve better performance than others. On the other hand the collaboration can help them to solve problems that they are not able to solve for hours or days. Therefore collaborative learning is a very important for them because students learn to work in the team as well.

The Internet is popular among the students. Students search more and more for information on the Internet. Studies show that many students consider the Internet as a great source of information and using it during learning process. The Internet is full of e-learning projects, documents, presentations and multimedia content that students may find useful for their learning process (Foltin 2012b, 2012c). It is necessary that all our contents for courses are available online as well. Courses can be also supported with custom video tutorials where topics are explained and shown. Mathworks also provide online content like the documentation, webinars and events on their official web site. Conferences are also good events for students to exchange their knowledge among each other (MathWorks 2012a, 2012b, 2012c). Learning and teaching process is often high cost. Free software and open source applications are possible solution (Foltin et al. 2011).

In this chapter we will describe possibilities for an introductory Matlab course. We will show how to divide lectures and practices into several topics necessary and helpful for the students. Weekly task evaluations are proposed to motivate students to achieve better results. We will described how to find an interesting resources for the course or how to create own one. Collaboration among students is described within the Internet with the Facebook, articles or forums. Over all we focused on the educational use of Matlab, concepts for lecturers and the course improvements.

## **2. Matlab course**

Matlab is a very powerful tool for technical computing and simulation. It is time saving tool for high performance computations. Matlab is optimized for this kind of tasks. It supports us when we lack of real world system in the education. Matlab contains many add-ons that are very useful in many fields of science. Matlab usage is a very popular in many science projects, bachelor, master and dissertation theses in the university environment. The basic Matlab course was established at the Faculty of Electrical Engineering and Information Technology in Bratislava to teach students to use Matlab and its add-ons. Matlab is a basic tool for every student at our faculty. We try to move this course into the first year of study for this reason. The knowledge, which students take from this course is a very useful in the other technical courses.

#### **2.1. Lectures**

342 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

secondary school level (M. Varga & Z. Varga, 2010).

them because students learn to work in the team as well.

source applications are possible solution (Foltin et al. 2011).

for lecturers and the course improvements.

**2. Matlab course** 

Extensive usage of Matlab demands high quality courses at educational institutions (Dogan, 2011). In fact multiple courses for different topics can be taught with the use of Matlab. To provide students with solid background for these topics, an introductory course for Matlab can be created. At our faculty we create such a course. The aim of this course is to gain basic skills that students can use in more advanced courses. Our course is divided into two parts. In the first part there are Matlab basics that every student must to know (Matlab basics, graphics and Simulink). At top of the basic specialized topics a more advanced courses are introduced to help during teaching topics that students will need later. Although we teach the Matlab course at our faculty we believe that Matlab can be used at secondary schools as supporting tool for the teachers. Matlab basics and graphics can be also taught to students at

Students have different types learning capabilities. We cannot satisfy all of them, but we could motivate them to achieve the best possible performance. One of the proper motivator is their evaluation (Blaho et al. 2010a, 2010b). If students can see that the hard effort is rewarded than they want to learn more and more. The other motivator is collaboration. Many students are competitive by nature and they want to achieve better performance than others. On the other hand the collaboration can help them to solve problems that they are not able to solve for hours or days. Therefore collaborative learning is a very important for

The Internet is popular among the students. Students search more and more for information on the Internet. Studies show that many students consider the Internet as a great source of information and using it during learning process. The Internet is full of e-learning projects, documents, presentations and multimedia content that students may find useful for their learning process (Foltin 2012b, 2012c). It is necessary that all our contents for courses are available online as well. Courses can be also supported with custom video tutorials where topics are explained and shown. Mathworks also provide online content like the documentation, webinars and events on their official web site. Conferences are also good events for students to exchange their knowledge among each other (MathWorks 2012a, 2012b, 2012c). Learning and teaching process is often high cost. Free software and open

In this chapter we will describe possibilities for an introductory Matlab course. We will show how to divide lectures and practices into several topics necessary and helpful for the students. Weekly task evaluations are proposed to motivate students to achieve better results. We will described how to find an interesting resources for the course or how to create own one. Collaboration among students is described within the Internet with the Facebook, articles or forums. Over all we focused on the educational use of Matlab, concepts

Matlab is a very powerful tool for technical computing and simulation. It is time saving tool for high performance computations. Matlab is optimized for this kind of tasks. It supports As we mentioned before at the Faculty of Electrical Engineering and Information Technology Bratislava there is Matlab used in many mathematical and technical courses. Students use Matlab for their computations and solutions in their bachelor, diploma or dissertation theses. Matlab course is introductory course to Matlab, Simulink and Matlab toolboxes. The faculty has two terms per year. Each term lasts twelve weeks. Course can be taken in second term of the first year of undergraduate study. It consists of one lecture (100 minutes) and practice (100 minutes) per week. The lectures are not compulsory, but practices are. Count of the attendance at lectures is more than a half of all students. The lectures are combination of explanation of the current topic, solving of basic tasks and discussion. All of tasks are solved directly on the computer using Matlab. The students are allowed to see how to solve the concrete problem and can write the notes into their handout. The full preprint of lecture is available a week ahead on the web pages of the course. The students can print this hand-out before the lecture. The hand-out with notes are useful source of the information for the practices. For this reason there are usually students who attend the lectures more successful than students who do not have the notes from the lectures. The aim of the Matlab course is to introduce students to the Matlab, to learn basic principles, syntax and solutions of some common problems. We focus on the most common problems which students may use in their future study or on the others courses. We cover these topics:


As you can see, there are many topics for just one course. But with the lecture time we just cover a simple introduction to these topics. That is not a big problem because they will have detailed courses for most of the mentioned topics in the future. The main idea is to show basic principles and solutions to students that Matlab could provide. They can extend knowledge gained from the Matlab course on the other courses.

## **2.2. Practices**

The practices are related to the lectures. Students are solving some problems similar to the topic on the actual lecture. Problem is at the first solved verbally and using the board. Students then try to find out solutions in the Matlab environment. This is a time for notes from the lecture. Practices are set up in the way that students have not much time to learn the topic on the exercise and they have to always come prepared. Every student has his computer and work alone. They can use the computers with Microsoft Windows, GNU/Linux or Mac OS X operating systems. Students can also use their own notebooks. These facts improve the environment in the class. There are two lessons that take hour and forty minutes together. Teacher checks and rate every students work about ten minutes before end of the practice. The tasks are prepared for students that they should finish the given tasks before hour and half without problem. Many of students can solve given problems successfully in time.

### **2.3. Matlab at secondary schools**

Although we teach Matlab course at university the question is if we could find usage of Matlab at lower levels of education. The answer to this question is of course yes. We think that Matlab is great supportive program for secondary schools teachers and it should be used in mathematics and physics courses. For example let us look at this two equations:

$$\mathbf{x} = \mathbf{x}\mathbf{0} + \mathbf{v}\mathbf{0} \text{ \(\alpha\)}\tag{1}$$

Education of Future Advanced Matlab Users 345

**Figure 1.** Trajectories of thrown object

In previous chapter we generally talked about the Matlab practices and lectures at the universities. We briefly showed how you could use the Matlab benefits in secondary schools also. This chapter will discus topics suitable for basic Matlab course. We divided topics into three categories. Essential topics are parts of Matlab that every student should know because they provide strong platform for advanced topics and other Matlab toolboxes. Advanced topics should cover additional parts of the Matlab necessary for later student courses. We will describe topics that we cover in our course but other interesting parts of the

With Matlab core components come several add-ons as well. It is necessary to know all about basic Matlab concepts before we start to use specializes toolboxes suitable for our needs. In our opinion the essential topic for advanced Matlab users should be Matlab basics, graphics, Graphical User Interface and Simulink. Next we will talk in the detail about each

Understanding of the Matlab basic principles is key to be successful advanced Matlab user. Students should know how to use Matlab windows (Command Window, Workspace, History) and the benefits of each of them. Effective usage of Matlab help system is also necessary to solve Matlab warnings and errors. It is our choice if we use fast help command or Matlab Product help where user can find detailed information. Basic computations can be made in the Command Window through statements or in scripts (M-files) for example area of the circle. For additional support we can use the built-in Matlab functions for complex numbers or trigonometry functions. What makes Matlab powerful tool are vectors and

Matlab suitable for other study programs are described in other interesting topics.

**3. Matlab course topics** 

**3.1. Essential topics** 

*3.1.1. Matlab basics* 

of them and on what we should focus at most.

$$\mathbf{y} = \mathbf{y}\_0 + \mathbf{v}\_0 \mathbf{t} \sin(\alpha) \text{ - 0.5 g t}^2 \tag{2}$$

Equations represents trajectory of an object thrown in 2D plane from start point (x0, y0) with speed (v0) at some angle (α). With given acceleration due to gravity (g) we can compute distance (x) and height (y) of objects trajectory at certain time (t). In the next figure you can see trajectories for different angles with same start point, speed and gravity.

In the most of the secondary schools teachers and students compute results on the table or the paper. Matlab can be used to visualize different trajectories in just few lines of code for better understanding and imagination of the problem. With additional commands we could animate whole movement. This is one of the examples how to use Matlab in secondary schools physics classes. Another question is if Matlab should be considered only as a supporting program for the teachers or if students should also learned know how to create own scripts and programs. We think that we should consider both. Benefits of the first part of the question were answered with our example before. Writing Matlab scripts and programs should not be a problem for the students also because of its simplicity. We think that for students it would be also interesting. They would also learn some basic concepts of algorithm writing.

**Figure 1.** Trajectories of thrown object

## **3. Matlab course topics**

344 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

knowledge gained from the Matlab course on the other courses.

**2.2. Practices** 

**2.3. Matlab at secondary schools**

algorithm writing.

detailed courses for most of the mentioned topics in the future. The main idea is to show basic principles and solutions to students that Matlab could provide. They can extend

The practices are related to the lectures. Students are solving some problems similar to the topic on the actual lecture. Problem is at the first solved verbally and using the board. Students then try to find out solutions in the Matlab environment. This is a time for notes from the lecture. Practices are set up in the way that students have not much time to learn the topic on the exercise and they have to always come prepared. Every student has his computer and work alone. They can use the computers with Microsoft Windows, GNU/Linux or Mac OS X operating systems. Students can also use their own notebooks. These facts improve the environment in the class. There are two lessons that take hour and forty minutes together. Teacher checks and rate every students work about ten minutes before end of the practice. The tasks are prepared for students that they should finish the given tasks before hour and half

without problem. Many of students can solve given problems successfully in time.

Although we teach Matlab course at university the question is if we could find usage of Matlab at lower levels of education. The answer to this question is of course yes. We think that Matlab is great supportive program for secondary schools teachers and it should be used in mathematics and physics courses. For example let us look at this two equations:

Equations represents trajectory of an object thrown in 2D plane from start point (x0, y0) with speed (v0) at some angle (α). With given acceleration due to gravity (g) we can compute distance (x) and height (y) of objects trajectory at certain time (t). In the next figure you can

In the most of the secondary schools teachers and students compute results on the table or the paper. Matlab can be used to visualize different trajectories in just few lines of code for better understanding and imagination of the problem. With additional commands we could animate whole movement. This is one of the examples how to use Matlab in secondary schools physics classes. Another question is if Matlab should be considered only as a supporting program for the teachers or if students should also learned know how to create own scripts and programs. We think that we should consider both. Benefits of the first part of the question were answered with our example before. Writing Matlab scripts and programs should not be a problem for the students also because of its simplicity. We think that for students it would be also interesting. They would also learn some basic concepts of

see trajectories for different angles with same start point, speed and gravity.

x = x0 + v0 t cos(α) (1)

y = y0 + v0 t sin(α) - 0.5 g t2 (2)

In previous chapter we generally talked about the Matlab practices and lectures at the universities. We briefly showed how you could use the Matlab benefits in secondary schools also. This chapter will discus topics suitable for basic Matlab course. We divided topics into three categories. Essential topics are parts of Matlab that every student should know because they provide strong platform for advanced topics and other Matlab toolboxes. Advanced topics should cover additional parts of the Matlab necessary for later student courses. We will describe topics that we cover in our course but other interesting parts of the Matlab suitable for other study programs are described in other interesting topics.

## **3.1. Essential topics**

With Matlab core components come several add-ons as well. It is necessary to know all about basic Matlab concepts before we start to use specializes toolboxes suitable for our needs. In our opinion the essential topic for advanced Matlab users should be Matlab basics, graphics, Graphical User Interface and Simulink. Next we will talk in the detail about each of them and on what we should focus at most.

### *3.1.1. Matlab basics*

Understanding of the Matlab basic principles is key to be successful advanced Matlab user. Students should know how to use Matlab windows (Command Window, Workspace, History) and the benefits of each of them. Effective usage of Matlab help system is also necessary to solve Matlab warnings and errors. It is our choice if we use fast help command or Matlab Product help where user can find detailed information. Basic computations can be made in the Command Window through statements or in scripts (M-files) for example area of the circle. For additional support we can use the built-in Matlab functions for complex numbers or trigonometry functions. What makes Matlab powerful tool are vectors and matrices. There are several ways to create and manipulate them. Working with indexes of matrix is a very important and challenging parts in the Matlab for students, even harder with indexes range. Programing in the Matlab with functions, loops or conditions is one of the highlights of Matlab basics. In our course we are creating simple sorting algorithms. Students must then use almost every part of Matlab basics that we mentioned in this section. We are also teaching advanced data types – structures and cells. Data types are often used as types for output or input arguments to several Matlab functions.

## *3.1.2. Graphics and graphical user interface*

Functions and scripts provide sets of commands necessary for computing output data. Reading plain data is hard and we need some mechanism to represent them. Matlab contains several plotting commands for 2D and 3D figures. In 3D plotting we need to create grid for 3D space through meshgrid command. Some students have a hard time to understand this concept. Changing plot properties is another important knowledge. We must create handler to plot and using get and set commands we can change line colour or type. We can also use standard Matlab handles like current axis (gca), current figure (gcf) or current object (gco). Matlab enable creating graphical user interface. With objects like buttons, labels, inputs or check box we can create interactive experience for users with no prior Matlab knowledge. Students like creating user interfaces, but concept of the handles structure and callbacks can be sometimes difficult for them. We are trying explained this concept clearly and showed them how to call callback from another to reduce necessary commands.

#### *3.1.3. Simulink basics*

We can start model dynamical systems after Matlab basics lectures and practices. Dynamics of any system can be expressed with differential equations and computed by ode solvers. With Matlab ode solvers users must write functions with differential equations. More natural way provides the Matlab extension Simulink. In Simulink we building simulation schema from graphical blocks, signals and then customizing parameters in the blocks. Simulation can be continuous or discrete. After Simulink basics we create simple DC motor model schema from differential equations of the mechanical and electrical parts. Critical part for the students is relation between variable and variables differential, how this is modelled through integrator block and how to set initial conditions. On the practice students are modelling following equations:

$$\mathbf{x}\mathbf{i}' = \mathbf{x}\mathbf{2} \tag{3}$$

Education of Future Advanced Matlab Users 347

**Figure 2.** Simulink schema of simple pendulum

In this session we are describing some of them next.

basic principles of both methods for the system identification.

**3.2. Advanced topics** 

*3.2.1. Identification* 

*3.2.2. Virtual reality* 

Students can change system parameters to simulate how motion of the pendulum change.

After the essential topics lectures and practices it is time to choose advanced topics. Advanced topics depend on a study program of the students. Because our students studying cybernetics and robotics we focused after basic topics to topics related to their curriculum.

In real world we often do not know structure of the systems (gain, constants, etc.). Systems can be identified through regression methods with input and output data. Regressions methods are part of the Matlab in System Identification Toolbox. Widely used model estimations are ARX and ARMAX models. Another possibility to achieve approximation of the system is with neural networks. In our course there we use both of them to introduce

Signal values from the Simulink models can be plotted into charts. These signals can be also used for animation of models and Simulink 3D Animation provides this capability. Virtual Reality Mark-up Language represents 3D models using basic shapes and properties like geometry, appearance or translation. Virtual reality worlds can be built using several programs but the Simulink 3D Animation includes V-Realm Builder. Build 3D world is saved as \*wrl file and with VR Sink Simulink block we can interact with our simulation. Building 3D animations is one of the interesting topics of our course for students and they are really enjoying it. With the differential equations from previous practices we are

Standard simulation is with no input (T) and 90 degrees as initial pendulum position.

$$\mathbf{x}\mathbf{z}' = \mathbf{-g}\,\mathrm{l}\,\mathrm{l}\,\mathrm{sin}(\mathbf{x}\mathbf{i}) - \mathbf{k}\,\mathrm{/m}\,\mathrm{x}\,\mathrm{z} + \mathbf{1}\,\mathrm{/}\mathrm{l}\,\mathrm{^2m}\,\mathrm{/}\,\mathrm{T}\tag{4}$$

Equations represent simple pendulum differential equations where variables can be mass (m), length of the pendulum (l), acceleration due to gravity (g) and k is representative of the amount of damping present. Simulation schema for these equations is in the next figure.

**Figure 2.** Simulink schema of simple pendulum

Students can change system parameters to simulate how motion of the pendulum change. Standard simulation is with no input (T) and 90 degrees as initial pendulum position.

### **3.2. Advanced topics**

346 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

types for output or input arguments to several Matlab functions.

*3.1.2. Graphics and graphical user interface* 

students are modelling following equations:

commands.

*3.1.3. Simulink basics* 

matrices. There are several ways to create and manipulate them. Working with indexes of matrix is a very important and challenging parts in the Matlab for students, even harder with indexes range. Programing in the Matlab with functions, loops or conditions is one of the highlights of Matlab basics. In our course we are creating simple sorting algorithms. Students must then use almost every part of Matlab basics that we mentioned in this section. We are also teaching advanced data types – structures and cells. Data types are often used as

Functions and scripts provide sets of commands necessary for computing output data. Reading plain data is hard and we need some mechanism to represent them. Matlab contains several plotting commands for 2D and 3D figures. In 3D plotting we need to create grid for 3D space through meshgrid command. Some students have a hard time to understand this concept. Changing plot properties is another important knowledge. We must create handler to plot and using get and set commands we can change line colour or type. We can also use standard Matlab handles like current axis (gca), current figure (gcf) or current object (gco). Matlab enable creating graphical user interface. With objects like buttons, labels, inputs or check box we can create interactive experience for users with no prior Matlab knowledge. Students like creating user interfaces, but concept of the handles structure and callbacks can be sometimes difficult for them. We are trying explained this concept clearly and showed them how to call callback from another to reduce necessary

We can start model dynamical systems after Matlab basics lectures and practices. Dynamics of any system can be expressed with differential equations and computed by ode solvers. With Matlab ode solvers users must write functions with differential equations. More natural way provides the Matlab extension Simulink. In Simulink we building simulation schema from graphical blocks, signals and then customizing parameters in the blocks. Simulation can be continuous or discrete. After Simulink basics we create simple DC motor model schema from differential equations of the mechanical and electrical parts. Critical part for the students is relation between variable and variables differential, how this is modelled through integrator block and how to set initial conditions. On the practice

x1' = x2 (3)

x2' = -g/l sin(x1) – k/m x2 + 1/(l2m) T (4)

Equations represent simple pendulum differential equations where variables can be mass (m), length of the pendulum (l), acceleration due to gravity (g) and k is representative of the amount of damping present. Simulation schema for these equations is in the next figure.

After the essential topics lectures and practices it is time to choose advanced topics. Advanced topics depend on a study program of the students. Because our students studying cybernetics and robotics we focused after basic topics to topics related to their curriculum. In this session we are describing some of them next.

## *3.2.1. Identification*

In real world we often do not know structure of the systems (gain, constants, etc.). Systems can be identified through regression methods with input and output data. Regressions methods are part of the Matlab in System Identification Toolbox. Widely used model estimations are ARX and ARMAX models. Another possibility to achieve approximation of the system is with neural networks. In our course there we use both of them to introduce basic principles of both methods for the system identification.

## *3.2.2. Virtual reality*

Signal values from the Simulink models can be plotted into charts. These signals can be also used for animation of models and Simulink 3D Animation provides this capability. Virtual Reality Mark-up Language represents 3D models using basic shapes and properties like geometry, appearance or translation. Virtual reality worlds can be built using several programs but the Simulink 3D Animation includes V-Realm Builder. Build 3D world is saved as \*wrl file and with VR Sink Simulink block we can interact with our simulation. Building 3D animations is one of the interesting topics of our course for students and they are really enjoying it. With the differential equations from previous practices we are

animating simple pendulum that oscillates from right angle to equilibrium. Visualization of this system is in the next figure.

Education of Future Advanced Matlab Users 349

transportations which all react to the human touch. We are choosing and modelling one

Simulation in the Simulink does not respect real time. If the Simulink schema is simple to the simulation it will be faster than in real time and if schema is complex simulation will be slower than in real time. If we interact with real systems though the Simulink we must ensure precise timing. Interaction with the real time systems is necessary for the measuring physical values (inputs) and reaction to them through outputs. Port of computers can be used to do that with sound card, USB, parallel or serial port even with specialized measuring cards. Real Time Toolbox that is not part of the Matlab can provide real time in

Real Time toolbox is only available for the 32 bit Microsoft Windows operating systems and can provide precise timing (standard usage is around 0.1s). Another real time communication can be made by OPC toolbox. With OPC toolbox we can connect, read and write data to OPC server. With large amount of OPC server distributors we can communicate with almost every Programmable logic controller widely used in praxis. For the educational purposes OPC server simulators can be used for example from the company named Matricon (MatriconOPC 2012). This server generates signal that we can read and draw in the Matlab/Simulink. We can also write our data to provided space of the server

In the advanced topics there we described topics that are useful for students at our faculty. There are many toolboxes suitable not only for engineering study programs but also for other like economics (Financial Toolbox, Fixed-Income Toolbox, Financial Derivatives Toolbox) or natural sciences (Bioinformatics Toolbox, SimBiology). Toolboxes that we did not mention in this session can be introduced in other courses, bachelor or master theses. We think that future is in code generation for various devices (FPGA, Embedded devices), or hardware in the loop simulation but variety of the Matlab toolboxes specialised for other

Results of the students are evaluated through point assigning for each course independently at the Faculty of Electrical Engineering and Information Technology Bratislava (Blaho et al. 2010a, 2010b). Students can achieve 100 points at most. Most times points are divided into two parts. The first amount of the points can student achieved for their activity at practices or tests through term. The second part they can achieve on the exam test. In the most cases it is 30/70 (practice/exam) or 40/60. Weight is on the exam as you can see. Maximum amount

of the points allowed during term is 50 for the undergraduate courses.

system into the Stateflow together.

Simulink (Humusoft s.r.o., 2012).

and then to the process or controller.

**3.3. Other interesting topics** 

topics are popular as well.

**4. Tasks evaluation** 

*3.2.5. Real time* 

**Figure 3.** Trajectories of thrown object

## *3.2.3. Fuzzy logic*

Describing behaviour of real world systems with differential equations is often very challenging. Humans can control cars without knowing its precise description. Fuzzy logic can model systems in the terms of If-Then rules natural to our thinking. Inputs and outputs to the fuzzy system are modelled through fuzzy membership functions. In our course there we introduce students into the basic concepts of fuzzy logic and then they modelling some decision problem. One of the problems is student own grading system where there are two tests, one exam and they must write rules based on the point gain for each one of them. Some interesting grade scales came often as result.

## *3.2.4. Stateflow*

Most of the systems can be described as continuous (variables depends on time) or discrete (variables are time-sampled). Some systems react to events and we do not know exactly when system change happens. These systems are called event-driven. Event-driven systems are important to know because they can be found in the industrial applications. They can be modelled by several methods like Petri nets or Statecharts. Matlab prefers Statecharts through Stateflow, which is design environment for developing them. The states and transitions between states are represented graphically. Graphical representation is very useful within simulation where user can see which states are active and when system reacts to event through the transitions. For the Stateflow practise we are asking students to observe real word and look for examples of event-driven systems. They came out with interesting observations like the elevators, intelligent traffic light sensors or door openers in public transportations which all react to the human touch. We are choosing and modelling one system into the Stateflow together.

## *3.2.5. Real time*

348 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

this system is in the next figure.

**Figure 3.** Trajectories of thrown object

Some interesting grade scales came often as result.

*3.2.3. Fuzzy logic* 

*3.2.4. Stateflow* 

animating simple pendulum that oscillates from right angle to equilibrium. Visualization of

Describing behaviour of real world systems with differential equations is often very challenging. Humans can control cars without knowing its precise description. Fuzzy logic can model systems in the terms of If-Then rules natural to our thinking. Inputs and outputs to the fuzzy system are modelled through fuzzy membership functions. In our course there we introduce students into the basic concepts of fuzzy logic and then they modelling some decision problem. One of the problems is student own grading system where there are two tests, one exam and they must write rules based on the point gain for each one of them.

Most of the systems can be described as continuous (variables depends on time) or discrete (variables are time-sampled). Some systems react to events and we do not know exactly when system change happens. These systems are called event-driven. Event-driven systems are important to know because they can be found in the industrial applications. They can be modelled by several methods like Petri nets or Statecharts. Matlab prefers Statecharts through Stateflow, which is design environment for developing them. The states and transitions between states are represented graphically. Graphical representation is very useful within simulation where user can see which states are active and when system reacts to event through the transitions. For the Stateflow practise we are asking students to observe real word and look for examples of event-driven systems. They came out with interesting observations like the elevators, intelligent traffic light sensors or door openers in public Simulation in the Simulink does not respect real time. If the Simulink schema is simple to the simulation it will be faster than in real time and if schema is complex simulation will be slower than in real time. If we interact with real systems though the Simulink we must ensure precise timing. Interaction with the real time systems is necessary for the measuring physical values (inputs) and reaction to them through outputs. Port of computers can be used to do that with sound card, USB, parallel or serial port even with specialized measuring cards. Real Time Toolbox that is not part of the Matlab can provide real time in Simulink (Humusoft s.r.o., 2012).

Real Time toolbox is only available for the 32 bit Microsoft Windows operating systems and can provide precise timing (standard usage is around 0.1s). Another real time communication can be made by OPC toolbox. With OPC toolbox we can connect, read and write data to OPC server. With large amount of OPC server distributors we can communicate with almost every Programmable logic controller widely used in praxis. For the educational purposes OPC server simulators can be used for example from the company named Matricon (MatriconOPC 2012). This server generates signal that we can read and draw in the Matlab/Simulink. We can also write our data to provided space of the server and then to the process or controller.

## **3.3. Other interesting topics**

In the advanced topics there we described topics that are useful for students at our faculty. There are many toolboxes suitable not only for engineering study programs but also for other like economics (Financial Toolbox, Fixed-Income Toolbox, Financial Derivatives Toolbox) or natural sciences (Bioinformatics Toolbox, SimBiology). Toolboxes that we did not mention in this session can be introduced in other courses, bachelor or master theses. We think that future is in code generation for various devices (FPGA, Embedded devices), or hardware in the loop simulation but variety of the Matlab toolboxes specialised for other topics are popular as well.

## **4. Tasks evaluation**

Results of the students are evaluated through point assigning for each course independently at the Faculty of Electrical Engineering and Information Technology Bratislava (Blaho et al. 2010a, 2010b). Students can achieve 100 points at most. Most times points are divided into two parts. The first amount of the points can student achieved for their activity at practices or tests through term. The second part they can achieve on the exam test. In the most cases it is 30/70 (practice/exam) or 40/60. Weight is on the exam as you can see. Maximum amount of the points allowed during term is 50 for the undergraduate courses.

## **4.1. Week task**

There are two main evaluation (or result classification) systems. The first system classifies students via two or three checkpoints through term. All comes to these tests at the end. Point results depends on how successful are students to answer the test tasks. It is a little bit problematic when students doing great at the practices, but they vacillate on the tests at the end of course. They also do not have to learn until a test is in sight. This problem had been observed long time ago at the mathematics teaching. Students came from high schools and they were not used to learn so much or they had different knowledge background of the mathematics. Many of them fail some of the basics mathematics courses.

Education of Future Advanced Matlab Users 351

evaluation is kind of motivation factor. Reachable classifications are motivators for being excellently prepared for practices. Now it is time to talk about advantages and

disadvantages of our method. We think of these advantages:

Students will also learn work under time limit and stress

this system works for students and if it is acceptable for them.

Student are evaluated for what they learned on the lectures last week

Of course every method has some disadvantages. We think of these disadvantages:

Problem with student absence on practice (small ability of repeat the same practice)

This method has also some advantages and disadvantages as you can see. The question is if

Computers really changed our lives and today are almost impossible to imagine life without them. We often use them without knowing it. Computer by itself is a really powerful tool for computing, but for many years also for communication and sharing information. In fact, the basic idea for the Internet was collaboration across the continents with other researchers. We significantly use this tool today not only for sharing information but also in the teaching process. E-learning is most popular and modern activity in this process. We are also using web technologies for improving our student's results. Although possible we do not use any

For some student education can be expensive even if it is for free (like in our country). Reduction of the costs is our priority too and we try to be supportive for them. We are trying to work with open source technologies that are comparable to commercial technologies. We support students to use free UNIX-based operating systems (Linux distributions). For creation of lectures and practices we use Open source productivity suites like OpenOffice.org or LibreOffice. They are used to exchange documents and spread sheets. All

Internet is great source for information exchange as we mentioned before. Modern student's first choice for material search is Internet at the moment as well. For this fact we build web page for the course to make it easy for them to find materials. On our web page students can

Students must come prepared for practice

Limited time for educating outside of exercises

 Collision with other courses tests Limited time for finishing tasks

Learning management system (LMS).

presentations are created using these office suites.

**5.2. Course online study materials**

**5.1. Open source technologies**

No homework

Work under stress

**5. Study materials** 

Mathematicians try another pointing system that "forces" students to learn more often than just before the tests. Students were evaluated at the every exercise. On the next exercise they had small test on previous topic. The results of the student grow significantly. We also used this schema. We had two reasons for that. One reason was that we had many topics covered in our course. It would be not useful to test student on topics they forget long time ago. Another was that we want to "force" students to do something more. We choose to give more points during the term, so we give 40 points maximum for the practices. There were 10 practices for 4 points each. The first and the last were not evaluated. You can see results from year 2011 course classification distribution in the next figure.

With weekly tasks evaluation students gained good amount of point that they carry to the exam. This type of evaluation does not fit everyone and in the next part of this session we will be talking about its advantages and disadvantages.

**Figure 4.** Point distribution for practices

### **4.2. Advantages and disadvantages**

Every student has different capability to learn. We cannot choose unified methodology to learn them all that we know. But with proper motivation they will be willing to learn by themself more within their free time outside the university campus. Our week task evaluation is kind of motivation factor. Reachable classifications are motivators for being excellently prepared for practices. Now it is time to talk about advantages and disadvantages of our method. We think of these advantages:


350 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

mathematics. Many of them fail some of the basics mathematics courses.

from year 2011 course classification distribution in the next figure.

will be talking about its advantages and disadvantages.

**Figure 4.** Point distribution for practices

**4.2. Advantages and disadvantages**

There are two main evaluation (or result classification) systems. The first system classifies students via two or three checkpoints through term. All comes to these tests at the end. Point results depends on how successful are students to answer the test tasks. It is a little bit problematic when students doing great at the practices, but they vacillate on the tests at the end of course. They also do not have to learn until a test is in sight. This problem had been observed long time ago at the mathematics teaching. Students came from high schools and they were not used to learn so much or they had different knowledge background of the

Mathematicians try another pointing system that "forces" students to learn more often than just before the tests. Students were evaluated at the every exercise. On the next exercise they had small test on previous topic. The results of the student grow significantly. We also used this schema. We had two reasons for that. One reason was that we had many topics covered in our course. It would be not useful to test student on topics they forget long time ago. Another was that we want to "force" students to do something more. We choose to give more points during the term, so we give 40 points maximum for the practices. There were 10 practices for 4 points each. The first and the last were not evaluated. You can see results

With weekly tasks evaluation students gained good amount of point that they carry to the exam. This type of evaluation does not fit everyone and in the next part of this session we

Every student has different capability to learn. We cannot choose unified methodology to learn them all that we know. But with proper motivation they will be willing to learn by themself more within their free time outside the university campus. Our week task

**4.1. Week task**

Students will also learn work under time limit and stress

Of course every method has some disadvantages. We think of these disadvantages:


This method has also some advantages and disadvantages as you can see. The question is if this system works for students and if it is acceptable for them.

## **5. Study materials**

Computers really changed our lives and today are almost impossible to imagine life without them. We often use them without knowing it. Computer by itself is a really powerful tool for computing, but for many years also for communication and sharing information. In fact, the basic idea for the Internet was collaboration across the continents with other researchers. We significantly use this tool today not only for sharing information but also in the teaching process. E-learning is most popular and modern activity in this process. We are also using web technologies for improving our student's results. Although possible we do not use any Learning management system (LMS).

## **5.1. Open source technologies**

For some student education can be expensive even if it is for free (like in our country). Reduction of the costs is our priority too and we try to be supportive for them. We are trying to work with open source technologies that are comparable to commercial technologies. We support students to use free UNIX-based operating systems (Linux distributions). For creation of lectures and practices we use Open source productivity suites like OpenOffice.org or LibreOffice. They are used to exchange documents and spread sheets. All presentations are created using these office suites.

### **5.2. Course online study materials**

Internet is great source for information exchange as we mentioned before. Modern student's first choice for material search is Internet at the moment as well. For this fact we build web page for the course to make it easy for them to find materials. On our web page students can

find all about the course. They can find contacts to us in case they forgot them, some news for the course and another useful page links. Our web pages are prepared using iWeb software. This is WYSIWYG editor for doing web pages. The advantage of this software is they provide very good graphical user interface. It is not a problem to add the new lectures and important information for students by several clicks. For this reason it is possible to update the web page as often as possible. Web pages are divided into sections. The most wanted sections are about the lectures and practices. Students can find lectures and exercises materials there in electronic form. Also detailed information about both is available from there. A few topics have own video tutorials and students are able to view them at home and they can be better prepared for the practices. Video tutorials have main advantage. Students can directly see what the teacher is doing and therefore that is easier to then to understand topic. Some of the video tutorials are mentioned in references. We would like to publish these free video tutorials in Apple Store iTunes U in the future.

Education of Future Advanced Matlab Users 353

*5.4.1. Conferences for students* 

**6. Interaction of students** 

**6.1. Matlab forum**

*5.4.2. Conferences for scientist and educators*

Conferences for the students are great place to present their results. At our faculty students can present their work at two conferences. SVOC conference is for the students from bachelor and master level of study. On this conferences student can also gain some presentation skill that will help them at the final exams later. ELITECH conference is for the students from postgraduate level of study. This conference is more scientific oriented and

The Humusoft Company organizes conference focus on the technical computing every autumn. Past events were hosted at the Congress Center of the Czech Technical University in Prague. Conferences were dedicated to presentations of the MATLAB / Simulink, dSPACE and COMSOL Multiphysics users. Program of the conference also included the latest information on these products and seminar for COMSOL Multiphysics. We participate at this conference and present out results in the education and science. We also motivate students to participate on the conference. Many of them have bachelor or master thesis in Matlab. We try to direct them to work on interesting topics that are worth to present on the

conference. One or two papers at the conference come from our student every year.

booths to talk with MathWorks experts about topics that we are interested in.

individual learning type students to achieve better results.

Every year Mathworks is hosting global event. MathWorks Academic Virtual Conference is joining professors, educators and Matlab users from the praxis. The aim of the conference is to bridge the gap between theory and practice. Participants are learning how to incorporate latest MathWorks technologies into the classrooms and laboratories. Conference is divided into the three regions (Asia-Pacific, Europe, America) for people from the different time zones. Between the presentations it is the time to visit the exhibition hall. At the hall participants could visit booths to chat with staff, view products demonstrations and download literature. Two kinds of booths are available – MathWorks booths and Participating partners booths. We actively are participating on this conference. After presentations we discussed the topics and try to ask the questions online to the speakers. In the exhibition hall time we joined some

Collaborative learning is a very interesting area. Students are helping each other to better understand some topics. Main advantage of this method is that student did not stuck and some part of topic that he did not understand. This is much more times efficient and students can learn much more. This helps collaborative learning type students as well as

To support collaborative learning we founded Matlab forum. Students can ask any Matlab related questions on the forum. It is not forum just for our course. The questions can be

can be as start conference for other local or international conferences.

Computers connected to the Internet access are present at the practice room. Students can find their problems solutions on the web pages. On our webpage at which we publish student's articles we decided to write small papers about Matlab in Slovak language. Papers slowly cover the Matlab topics so the students have many tutorials. Beyond the articles discussion to the paper is available. We also publish some experiences on our publishing portal named Posterus (Systémy priemyselnej informatiky s.r.o. [SPR] 2012a).

## **5.3. Mathworks online study materials**

The lectures are not only source of the materials. Students use many different materials at the practices. The main material for Matlab study could be the Matlab reference manual that covers all topics and functions that students can use. Matlab reference manual is also accessible online. Student can search the Matlab topics and functions help without installing Matlab tools. Mathworks support education of all parts of Matlab through various online content (The Mathworks 2012a, 2012b, 2012c). Online events called webinars are recorded regularly and they are available for later use. Webinars are categorized by date of the recording, application, product and industry. This helps users to fast find necessary contents. Many languages are supported as well and that helps overcome language barrier for the novice users. We also contributed by creating webinar for Stateflow introduction.

## **5.4. Seminars and conferences**

Online content is very useful but human interaction is important as well. This can be done on events like seminars and conferences. Seminars take place regularly by local Matlab providers just like webinars. Participants from other institutions come to seminars to learn and discus about related topics. Another types of interactions are conferences where students or scientists can present their work. We are trying to participate at Matlab conferences to extend our knowledge and trying to incorporate student in them as well.

## *5.4.1. Conferences for students*

352 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

like to publish these free video tutorials in Apple Store iTunes U in the future.

portal named Posterus (Systémy priemyselnej informatiky s.r.o. [SPR] 2012a).

**5.3. Mathworks online study materials** 

introduction.

as well.

**5.4. Seminars and conferences**

Computers connected to the Internet access are present at the practice room. Students can find their problems solutions on the web pages. On our webpage at which we publish student's articles we decided to write small papers about Matlab in Slovak language. Papers slowly cover the Matlab topics so the students have many tutorials. Beyond the articles discussion to the paper is available. We also publish some experiences on our publishing

The lectures are not only source of the materials. Students use many different materials at the practices. The main material for Matlab study could be the Matlab reference manual that covers all topics and functions that students can use. Matlab reference manual is also accessible online. Student can search the Matlab topics and functions help without installing Matlab tools. Mathworks support education of all parts of Matlab through various online content (The Mathworks 2012a, 2012b, 2012c). Online events called webinars are recorded regularly and they are available for later use. Webinars are categorized by date of the recording, application, product and industry. This helps users to fast find necessary contents. Many languages are supported as well and that helps overcome language barrier for the novice users. We also contributed by creating webinar for Stateflow

Online content is very useful but human interaction is important as well. This can be done on events like seminars and conferences. Seminars take place regularly by local Matlab providers just like webinars. Participants from other institutions come to seminars to learn and discus about related topics. Another types of interactions are conferences where students or scientists can present their work. We are trying to participate at Matlab conferences to extend our knowledge and trying to incorporate student in them

find all about the course. They can find contacts to us in case they forgot them, some news for the course and another useful page links. Our web pages are prepared using iWeb software. This is WYSIWYG editor for doing web pages. The advantage of this software is they provide very good graphical user interface. It is not a problem to add the new lectures and important information for students by several clicks. For this reason it is possible to update the web page as often as possible. Web pages are divided into sections. The most wanted sections are about the lectures and practices. Students can find lectures and exercises materials there in electronic form. Also detailed information about both is available from there. A few topics have own video tutorials and students are able to view them at home and they can be better prepared for the practices. Video tutorials have main advantage. Students can directly see what the teacher is doing and therefore that is easier to then to understand topic. Some of the video tutorials are mentioned in references. We would

Conferences for the students are great place to present their results. At our faculty students can present their work at two conferences. SVOC conference is for the students from bachelor and master level of study. On this conferences student can also gain some presentation skill that will help them at the final exams later. ELITECH conference is for the students from postgraduate level of study. This conference is more scientific oriented and can be as start conference for other local or international conferences.

## *5.4.2. Conferences for scientist and educators*

The Humusoft Company organizes conference focus on the technical computing every autumn. Past events were hosted at the Congress Center of the Czech Technical University in Prague. Conferences were dedicated to presentations of the MATLAB / Simulink, dSPACE and COMSOL Multiphysics users. Program of the conference also included the latest information on these products and seminar for COMSOL Multiphysics. We participate at this conference and present out results in the education and science. We also motivate students to participate on the conference. Many of them have bachelor or master thesis in Matlab. We try to direct them to work on interesting topics that are worth to present on the conference. One or two papers at the conference come from our student every year.

Every year Mathworks is hosting global event. MathWorks Academic Virtual Conference is joining professors, educators and Matlab users from the praxis. The aim of the conference is to bridge the gap between theory and practice. Participants are learning how to incorporate latest MathWorks technologies into the classrooms and laboratories. Conference is divided into the three regions (Asia-Pacific, Europe, America) for people from the different time zones. Between the presentations it is the time to visit the exhibition hall. At the hall participants could visit booths to chat with staff, view products demonstrations and download literature. Two kinds of booths are available – MathWorks booths and Participating partners booths. We actively are participating on this conference. After presentations we discussed the topics and try to ask the questions online to the speakers. In the exhibition hall time we joined some booths to talk with MathWorks experts about topics that we are interested in.

## **6. Interaction of students**

Collaborative learning is a very interesting area. Students are helping each other to better understand some topics. Main advantage of this method is that student did not stuck and some part of topic that he did not understand. This is much more times efficient and students can learn much more. This helps collaborative learning type students as well as individual learning type students to achieve better results.

## **6.1. Matlab forum**

To support collaborative learning we founded Matlab forum. Students can ask any Matlab related questions on the forum. It is not forum just for our course. The questions can be

related to various problems at which students came through on their study in every course and are about Matlab. We answer most of the questions, but there are some others responders that can easily support us when we have not enough time. They include local Matlab software distributor employers. Now students from different faculties around Slovak Republic and Czech Republic come to our forum and ask questions about Matlab. Foreign students are also welcomed as they can ask us in English as well (SPR 2012b).

Education of Future Advanced Matlab Users 355

FX – insufficient results, completing of the course expect more efforts and knowledge

Points are sum of points acquired during term and exam. Next figure shows final grade for

As you can see there is a change between graphs at exercises and at exam. From the first graph we would expect more students with better grades. We have to ask our-self, what could cause such difference. The first reason could be exam itself. On exam students can acquired up to 60 points. It is a lot education classification so they have to be divided into several questions. The questions have to reflect whole course knowledge so students have to repeat and learn more at the exam. The second reason could be psychological. The good educating result from the exercises could not motivate students enough. Student with high quality result probably thought that they have enough grade of result to pass exam and did not needed to get better grade. Maybe they concentrate elsewhere to pass on the other

Most valuable information in control comes from the feedback. Such data comes from student responses to the anonymous survey. Our university information system supports

such surveys for each course. Most interesting answers are for listed questions:

Do you like the system of work evaluation on every exercise?

form student (less than 56 points) FN -student did not come to the exams test.

our students.

**Figure 5.** Grade distribution

courses more.

**7.2. Opinions of the students**

 How would you rate the lectures? How would you rate the practices? Were the topics explained clearly? How do you rate the course difficulty?

## **6.2. Facebook**

Speaking of the Internet and collaborative learning we must also mentioned social networking. Social networks are very popular today. Majority of people are present at least at one social network. Most favourite social network is the Facebook today. Like the Internet, Facebook also started on the academic field. The website's membership was initially limited by the founders to the Harvard university students at Cambridge, Massachusetts, but was expanded to other colleges in the greater Boston area. Facebook enables to create groups. Groups can be created by topics like interests or activities. We established new Facebook group for the students of the Matlab course (Foltin 2012a). This group has several active members who are mainly students of our course. We use this group for quick and short information about the course. Every member can comment tasks from the practices and lectures. It is very useful feedback from students to teachers. Lot of students use this group for publicity their works. They want to show results of their work to other students and share the algorithm. It can be a platform for new projects in the future. It can be also used as a sort of learning management and e- learning system.

## **7. Results and opinions of the students**

To improve our course even more we study the students study results and their feedback every term. First of all we compare distributions from practices and grade results. Then we are giving some questions to the students at the end of the term. Some information and feedback we have already gained through the Facebook and Matlab forum during the term.

### **7.1. Results**

The figure 4 shows that students did very well in tasks during term. Almost half of them gained maximum points. But the question is: How well did students at exam succeeded? Firstly we must look at the exam grades and the relevant points for that grade:


Points are sum of points acquired during term and exam. Next figure shows final grade for our students.

**Figure 5.** Grade distribution

354 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

can be also used as a sort of learning management and e- learning system.

**7. Results and opinions of the students** 

(SPR 2012b).

the term.

**7.1. Results**

**6.2. Facebook** 

related to various problems at which students came through on their study in every course and are about Matlab. We answer most of the questions, but there are some others responders that can easily support us when we have not enough time. They include local Matlab software distributor employers. Now students from different faculties around Slovak Republic and Czech Republic come to our forum and ask questions about Matlab. Foreign students are also welcomed as they can ask us in English as well

Speaking of the Internet and collaborative learning we must also mentioned social networking. Social networks are very popular today. Majority of people are present at least at one social network. Most favourite social network is the Facebook today. Like the Internet, Facebook also started on the academic field. The website's membership was initially limited by the founders to the Harvard university students at Cambridge, Massachusetts, but was expanded to other colleges in the greater Boston area. Facebook enables to create groups. Groups can be created by topics like interests or activities. We established new Facebook group for the students of the Matlab course (Foltin 2012a). This group has several active members who are mainly students of our course. We use this group for quick and short information about the course. Every member can comment tasks from the practices and lectures. It is very useful feedback from students to teachers. Lot of students use this group for publicity their works. They want to show results of their work to other students and share the algorithm. It can be a platform for new projects in the future. It

To improve our course even more we study the students study results and their feedback every term. First of all we compare distributions from practices and grade results. Then we are giving some questions to the students at the end of the term. Some information and feedback we have already gained through the Facebook and Matlab forum during

The figure 4 shows that students did very well in tasks during term. Almost half of them gained maximum points. But the question is: How well did students at exam succeeded?

Firstly we must look at the exam grades and the relevant points for that grade:

 A – excellent results with minimal errors (100 – 92 points) B – above-average results with less errors (83 – 91 points)

 D – satisfactory results but with significant errors (65 – 73 points) E – sufficient results that satisfactory minimal criteria (64 – 56 points)

C – fairly well, average results (74 – 82 points)

As you can see there is a change between graphs at exercises and at exam. From the first graph we would expect more students with better grades. We have to ask our-self, what could cause such difference. The first reason could be exam itself. On exam students can acquired up to 60 points. It is a lot education classification so they have to be divided into several questions. The questions have to reflect whole course knowledge so students have to repeat and learn more at the exam. The second reason could be psychological. The good educating result from the exercises could not motivate students enough. Student with high quality result probably thought that they have enough grade of result to pass exam and did not needed to get better grade. Maybe they concentrate elsewhere to pass on the other courses more.

### **7.2. Opinions of the students**

Most valuable information in control comes from the feedback. Such data comes from student responses to the anonymous survey. Our university information system supports such surveys for each course. Most interesting answers are for listed questions:


The answers depend on the individual students, but most of them agreed at some points. The lectures and practices were rated positive. Explanation was clear, but they want more practical examples. Most of the students answered that course difficulty was normal or course was easy. In the comparison with other courses was that the Matlab course difficult same or easier. The last question was about the evaluation system. Almost everyone thought that this system was suitable. This quiz was taken before exam and therefore the results were not affected by exam results.

Education of Future Advanced Matlab Users 357

Andreatos, A. S. & Zagorianos, A. D. (2009) Matlab GUI Application for Teaching Control Systems, In: *Proceedings of the 6th WSEAS International Conference on ENGINEERING* 

Bertrand, I. (1989). Software engineering techniques for computer-aided learning, In:

Blaho, M. & Foltin, M. & Fodrek, P. & Poliačik, M. (2010a). Preparing Advanced Matlab Users, *WSEAS Transactions on Advances in Engineering Education*, Vol. 7, Iss. 7, (2010), pp.

Blaho, M. & Foltin, M. & Fodrek, P. & Murgaš, J. (2010b). Research on Preparing Control Engineers and Advanced Matlab Users, *Latest Trends on Engineering Education: 7th WSEAS International Conference on Engineering Education*, pp. 211-214, ISBN 978-960-474-

Blau, J. (September 2011). Germany Faces a Shortage of Engineers, In: *IEEE Spectrum*, 2012, Available from <http://spectrum.ieee.org/at-work/tech-careers/germany-faces-a-

Dogan, I. (2011). Engineering simulation with MATLAB: improving teaching and learning effectiveness, In: *Procedia Computer Science*, 2011, Vol. 3, pp. 853-858, ISSN: 1877-0509 Foltin, M. & Fodrek, P. & Blaho, M. & Murgaš, J. (2011). Open Source Technologies in Education, *Recent Researches in Educational Technologies: Proceedings of the 8th WSEAS International Conference on Engineering Education (EDUCATION'11) and 2nd International Conference on Education and Educational Technologies (WORLD-EDU'11)*, pp. 131-135,

Foltin, M. (March 2012a) Modelovanie a simulácie In: *Facebook*, 2012, Available from

Foltin, M. (March 2012b). Vlastnosti grafických objektov In: *Posterus.sk*, 2012, ISSN 1338- 0087, Available from <http://www.posterus.sk/wpcontent/ uploads/ML018.mov> Foltin, M. (Match 2012c). Fuzzy logic toolbox In: *Posterus.sk*, 2012, ISSN 1338-0087, Available

Humusoft s.r.o. (2012). Real Time Toolbox, In: *Humusoft.cz*, 2012, Available from <

MatriconOPC (2012). Introduction to OPC – Tutorial, In: *MatriconOPC.com*, 2012, Available

Systémy priemyselnej informatiky s.r.o. (March 2012a). Posterus.sk, In: *Posterus.sk*, 2012,

Systémy priemyselnej informatiky s.r.o. (March 2012b). Matlab.sk, In: *Matlab.sk*, 2012,

The Matworks (March 2012a). R2012a Documentation, In: *The Matworks*, 2012, Available

The Matworks (March 2012b). Mathworks Events, In: *The Matworks*, 2012, Available from

The Matworks (March 2012c). MATLAB Virtual Conference 2012, In: *The Matworks*, 2012,

from <https://www.matrikonopc.com/downloads/549/software/index.aspx>

*Education and Computing*, Vol. 5, Iss. 4, (1989), pp. 215–222

*EDUCATION*, 2009, pp. 208-211

234-243, ISSN 1790-1979

202-8, Corfu, Greece

shortage-of-engineers>

ISBN 978-1-61804-021-3, Corfu Island, Greece

http://www.humusoft.cz/produkty/rtt/>

Available from <http://www.matlab.sk >

Available from

<http://www.facebook.com/#!/group.php?gid=313543668309>

from <http://www.posterus.sk/modsim/fuzzy\_tbx.mov>

ISSN 1338-0087, Available from <http://www.posterus.sk >

<http://www.mathworks.com/company/events/index.html>

<http://events.unisfair.com/index.jsp?eid=1128&seid=23&code=ConfLstng>

from <http://www.mathworks.com/help/index.html>

## **8. Conclusion**

In this chapter we described the educational side of Matlab usage. Different specializations can benefit from many Matlab products in high quality education. We described how we teach Matlab at our faculty and how are dividing lectures into several topics. We also talked about how to incorporate Matlab into secondary schools education. Topic for future engineers was divided into three categories as well. Basic topics should every engineer to be able to pass, advanced topics depend on study program specialization and other topics are suitable for the research or student thesis. Evaluation of student's performance is a difficult process. In the most cases students are evaluated few times a term. With our proposed evaluation student are forced to study before every practice. Internet is first choice for seeking information for students. It is necessary that we adapt to this fact. We are preparing much online content for students like articles or videos. Collaboration between students is beneficial and we should use social networking. Events like conferences and seminars are helping with education as well. Student's opinion showed that proposed evaluation strategy for the practices suits almost every one of them. Our novel approach to the Matlab teaching process is recommended to copy for another universities as well. We hope that this chapter will helped create high quality courses.

## **Author details**

Michal Blaho, Martin Foltin, Peter Fodrek and Ján Murgaš *Slovak University of Technology, Slovak Republic* 

## **Acknowledgement**

We would like to thank Slovak Cultural and Educational Grant Agency KEGA under contract number 032STU-4/2011 and Slovak Scientific Grant Agency VEGA under contract number 1/1256/12 for their support of this paper.

## **9. References**

Abdullah, K.A. & Hashim, N. & Yusof, Z. (2010). The development of computer-aided learning for computer numerical control machine: A pilot study, In: *2nd International Congress on Engineering Education (ICEED)*, pp. 94-99, ISBN: 978-1-4244-7308-3

Andreatos, A. S. & Zagorianos, A. D. (2009) Matlab GUI Application for Teaching Control Systems, In: *Proceedings of the 6th WSEAS International Conference on ENGINEERING EDUCATION*, 2009, pp. 208-211

356 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

were not affected by exam results.

will helped create high quality courses.

*Slovak University of Technology, Slovak Republic* 

number 1/1256/12 for their support of this paper.

Michal Blaho, Martin Foltin, Peter Fodrek and Ján Murgaš

**Author details** 

**Acknowledgement** 

**9. References** 

**8. Conclusion** 

The answers depend on the individual students, but most of them agreed at some points. The lectures and practices were rated positive. Explanation was clear, but they want more practical examples. Most of the students answered that course difficulty was normal or course was easy. In the comparison with other courses was that the Matlab course difficult same or easier. The last question was about the evaluation system. Almost everyone thought that this system was suitable. This quiz was taken before exam and therefore the results

In this chapter we described the educational side of Matlab usage. Different specializations can benefit from many Matlab products in high quality education. We described how we teach Matlab at our faculty and how are dividing lectures into several topics. We also talked about how to incorporate Matlab into secondary schools education. Topic for future engineers was divided into three categories as well. Basic topics should every engineer to be able to pass, advanced topics depend on study program specialization and other topics are suitable for the research or student thesis. Evaluation of student's performance is a difficult process. In the most cases students are evaluated few times a term. With our proposed evaluation student are forced to study before every practice. Internet is first choice for seeking information for students. It is necessary that we adapt to this fact. We are preparing much online content for students like articles or videos. Collaboration between students is beneficial and we should use social networking. Events like conferences and seminars are helping with education as well. Student's opinion showed that proposed evaluation strategy for the practices suits almost every one of them. Our novel approach to the Matlab teaching process is recommended to copy for another universities as well. We hope that this chapter

We would like to thank Slovak Cultural and Educational Grant Agency KEGA under contract number 032STU-4/2011 and Slovak Scientific Grant Agency VEGA under contract

Abdullah, K.A. & Hashim, N. & Yusof, Z. (2010). The development of computer-aided learning for computer numerical control machine: A pilot study, In: *2nd International* 

*Congress on Engineering Education (ICEED)*, pp. 94-99, ISBN: 978-1-4244-7308-3


<http://events.unisfair.com/index.jsp?eid=1128&seid=23&code=ConfLstng>

	- Varga, M. & Varga, Z. (2010) Utilizing Matlab in secondary technical education, In: *Proceedings of the 33rd International Convention, MIPRO*, 2010, pp. 970-974, ISBN: 978-1- 4244-7763-0

**Chapter 15** 

© 2012 Grout and Bin A'ain, licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

© 2012 Grout and Bin A'ain, licensee InTech. This is a paper distributed under the terms of the Creative Commons

**Using MATLAB in the Teaching and Learning of** 

Mathematical analysis tools provide an invaluable (and sometime essential!) tool for use within the engineering disciplines and are readily found in education, research and industrial applications. For example, within the industrial applications, mathematical analysis tools provide an essential aid at all stages of a product development from design through manufacture to test. Although there are a number of useful tools available, since its inception, MATLAB [1] has found a unique role within the engineering disciplines. Given the need to utilise this tool ultimately in both a research context and an industrial application context, there is a need to introduce students at the university level to the effective use of MATLAB, with a focus on the particular discipline area of the student.

In this chapter, the use of MATLAB is presented and discussed within a university education context and in particular the integration of MATLAB into the teaching and learning of semiconductor device fundamentals for electronic and computer engineering students. The aim is to support the student learning of semiconductor device operation, primarily diodes (silicon, germanium, Schottky barrier and Zener) and transistors (bipolar junction transistors (BJTs), junction field effect transistors (JFETs) and metal-oxide

MATLAB is primarily used as a data analysis, presentation and reporting tool in this context, but the natural integration of MATLAB into the teaching and learning environment

1. Firstly, it is an introduction to the tool for generic engineering and scientific design and

The basic idea is that experiments are undertaken on practical devices, the results obtained are then analysed in MATLAB and finally compared to the ideal device (mathematical)

2. Secondly, it is used to support the learning of semiconductor device operation.

**Semiconductor Device Fundamentals** 

Ian Grout and Abu Khari Bin A'ain

http://dx.doi.org/10.5772/46461

**1. Introduction** 

has two real purposes:

data analysis.

Additional information is available at the end of the chapter

semiconductor field effect transistors (MOSFETs)).
