SlideShare a Scribd company logo
1 of 12
Download to read offline
1 | P a g e
C o n t r o l L a b o r a t o r y
Experiment 11: MATLAB with Arduino
Part1: Introduction to ARDUINO/SIMULINK
Lab Objectives
• Install and verify Arduino software package for Simulink using a digital output to light a LED
• Communicate with the target board (Arduino) using external mode by changing the brightness
of an LED with PWM
Part 1: Arduino Toolbox Installation for Simulink
Objective:
• Install and verify Arduino software package for Simulink using a digital output to light a LED
Simulink Arduino Library Installation:
• Open MATLAB2013a(b)/MATLAB 2014a and type “targetinstaller” in the MATLAB command
window.
• The target installer window will appear. Select “Install from Internet”.
• Select “Arduino (Arduino Uno/Nano/Mega 2560 for Matlab 2014a)” and click “Next”
• When prompted, log in using your MathWorks credentials. If you do not have an account you
will need to create one.
• Follow the onscreen prompts to install the library.
• Once the installation processis finished, you can exit out by clicking on“Finish”.
Arduino Mega 2560 Drivers’ Setup:
• Connect your Arduino Mega board to the computer using the USB cable. Your computer will
attempt to search for the necessary drivers online.
o If your computer cannot find the right drivers do the following:
 Go to Device Manager and look for your Arduino Mega board (Arduino Mega
2560). Your Arduino board will be under Ports (COM & LPT). Otherwise, it may
be listed as “Unidentified Device” under ‘Other Devices’.
• If you find an unidentified device, unplug the Arduino to see this device
is removed from the list to verify that this unidentified device is your
Arduino board. Plug you Arduino board back in.
 Right click on Arduino Mega (or “Unidentified Device” ) and select “Update
Driver and Software”
 Select “Browse my computer for driver software”
 Set the location to :
Matlab 2014a C:MATLABSupportPackagesR2014aarduino-1.0.5drivers.
Matlab 2013a C:MATLABSupportPackagesR2013aarduino-1.0drivers.
2 | P a g e
C o n t r o l L a b o r a t o r y
 You will receive a prompt letting you know Windows cannot verify the publisher
of the driver, select “Install this driver software anyway.”
 Windows will then install the necessary drivers for the Arduino Mega from this
folder. A message will appear when the driver software has installed.
o If you are using windows 8 the driver installation might have a problem because the
driver file is not digitally signed. See http://mytechblog.com/tutorials/arduino/install-
arduino-drivers-on-windows-8/
The Arduino drivers can also be installed from the Arduino website (www.arduino.cc).
How do I find the COM port for my Arduino Board:
• Go to Device Manager and look for your Arduino Mega board (Arduino Mega 2560). Your
Arduino board will be under Ports (COM & LPT).
SimulinkSetup:
In order to ensure that your computer can properly communicate with the Arduino board, build
and run the following Simulink diagram using the steps below:
1) Open MATLAB 2013a/2014a then open a new Simulink model.
2) Find and assemble the required blocks.
• Pulse Generator is under View->Library Browser->Simulink->Sources
• Digital Output is under View->Library Browser->Simulink Support Package for Arduino Hardware
(2013b/2014a: View->Library Browser->Simulink Support Package for Arduino Hardware-
>Common)
3) Change the output pin to 13, which is connected to the onboard LED. This is done by double clicking
on the Digital Output block.
4) Double click on the Pulse Generator to change the amplitude to 1, the Period to 10, and the pulse
width to 50%.
3 | P a g e
C o n t r o l L a b o r a t o r y
5) Under the tools menu go to ‘Run on Target Hardware’ and click ‘Prepare to Run’. In the window that
pops up you will need to select Arduino Mega 2560 in the drop down for Target Hardware.
• “Set host COM port: “ should be set to “Manually” and specify the COM port your board is
connected to, clink “Apply” and “Ok”. Automatically does not work reliably on some computers.
• Right click on the background and select ‘Model Configuration Parameters’, or .
• go to ‘Solver’ on the right hand menu and type ‘inf’ into the ‘Stop time’ spot so that the model
will keep running. Make sure the solver options are set to “Fixed-step” and “discrete (no
continuous states)”. The “Fixed-step size” should be 0.05. This is how fast in seconds the
4 | P a g e
C o n t r o l L a b o r a t o r y
control loop will execute. In this case every 50 milliseconds it will execute the Simulink code.
6) Compile and download the code to the board:
• 2013a:Go to ‘Tools-Run on Target Hardware-Run’.
• 2013b/2014a: Clink “Deploy to Hardware Button” or the keystroke Ctrl+B:
At this point the on board LED connected to pin 13 should start blinking on and off. If not, check the
debugging section below.
Debugging
• If an error occurs indicating that there is no driver, follow the directions on the screen.
• If MATLAB cannot find the board find COM port number from the device manager and in
‘Configuration Parameters’ set the port manually to the correct number.
• Some errors appear on the MATLAB workspace screen - if something is not working, check here.
Part 2: Communicating with External Mode
Objective
• Communicate with the target board (Arduino) using external mode by changing the brightness
of an LED with PWM
5 | P a g e
C o n t r o l L a b o r a t o r y
Simulink
Modify your Simulink diagram to the following
• Pin 13 can also be set as a PWM instead of just an on/off digital output – replace the Digital
Output block with the PWM block
• The “Slider Gain” can be found in View->Library Browser->Simulink-> Math Operations. Change
the high value to 255 (the max value of the PWM)
• The “Manual Switch” can be found in View->Library Browser->Simulink ->Signal Routing
• The “Constant” can be found in View->Library Browser->Simulink ->“Commonly Used Blocks”
External Mode
• External mode allows bi-directional communication to/from the application board to the PC.
• When external mode is selected it downloads additional code to the board to allow this
communication so this does increase the program size.
• When you use external mode you can change parameters while the system is running
o However this has an impact on the performance:Due to the communication bandwidth,
the fastest you can run in this mode and still meet your control loop time is approximately
30 milliseconds
• The values change on the Slider Gain and the Manual Switch can be changed while the program
is running.
• The code can be run much faster (in the orders of1 or 2 milliseconds) if external mode is not
used.
Enabling External Mode:
• 2013a:“Configuration Parameters” under the “Run on Target Hardware” tab make sure to
enable external mode is enabled.
6 | P a g e
C o n t r o l L a b o r a t o r y
• 2013b/2014a: Select “External” from the drop down menu, then press the “Play” button
Run the code and experiment with the setup. Observe the effects on the Arduino LED when changing
the value of the Slider Gain, Manual Switch, and the Pulse Generator.
• While running the simulation, you can change the position of the switch by double clicking on
the switch
• You can change the gain of the Slider Gain while running the simulation by double clicking it.
• Adjusting the Pulse Generator, experiment with all three parameters. Which increases
brightness? What is the approximate range over which you can observe a difference?
[Note: These parameters will be addressed in a later lab on PWM]
Stopping the Simulation:
When you are running the simulation in external mode you are connected to the device and are sending
data and receiving data. When this is occurring do NOT use the stop button to stop the simulation:
• 2013a:
o Always use the “Connect to Target” button to connect to the board. If you use the “Run
on Target Hardware” menu then it will automatically download your code, connect to
the board and run your code.
o Use “Disconnect from Target” if to make changes to the code or to unplug the USB
cable. Do not unplug the USB cable before disconnecting from the target. Doing so will
leave the serial port open on the computer and you will not be able to connect to the
7 | P a g e
C o n t r o l L a b o r a t o r y
device without restarting Matlab or logging off your machine (to ensure the serial port
gets closed).
• 2013b/2014a:
o Use the Play button to download and run the code in external mode
o Use the square Stop button to stop
Debugging – cannot connect to device or cannot download code
• If you cannot connect to the device or there is an error when trying to download the code
usually this means external mode was enabled and the simulation was stopped with the stop
button or the USB cable was unplugged while being connected to the device. In this case you
have a couple things to try that may successfully close the serial port
o Try the following commands at the Matlab command line (find connected instruments
and close them):
 newobjs=instrfindall
 fclose(newobjs)
 delete(newobjs)
o Reset the device with the reset button or disconnect/connect the serial cable (this
sometimes works)
o Close and restart Matlab (this usually works)
o Log off your machine, log back in, then restart Matlab (this almost always works)
• Make sure the COM port is correct in the “Model Configuration Parameters”
Checkpoint:
To complete Lab 1 you will need to show the ability to control the blink of the LED in one program with
both the ‘manual switch’ and the ‘slider gain’.
1| P a g e
Part2: RC Circuit / First Order System
The purpose of this part is to demonstrate how to model a simple electrical system.
Specifically, a first principles approach based on the underlying physics of the circuit and
a black-box approach based on recorded data will be employed. The associated experiment
is employed to demonstrate the black-box approach, as well as to demonstrate the accuracy
of the resulting models. This activity also provides a physical example of the common class
of first-order systems.
I. Mathematical Modeling of System
First we will employ our understanding of the underlying physics of the RC circuit to derive
the structure of the system model. We will term this process "modeling from first
principles.
1) Write the value of resistor and Capacitor for the circuit
2) Find the transfer function 𝐺(𝑠) =
𝐸𝑜(𝑠)
𝐸𝑖(𝑠)
, and determine the value of gain and time
constant
Ω
F
Ϯ | P a g e
II. System Identification of System (Open Loop Response)
In this part we will record the output voltage of the RC circuit for a step in input voltage.
Based on the resulting time response of the output voltage, we will fit a model to the
data. This approach is sometimes referred to as black-box modeling or data-driven
modeling. After we have generated such a model, we will compare it to the first-
principles derived model we created previously.
1) Hardware setup
The Arduino board is employed to receive the input command from Simulink and to
apply the input voltage to the circuit (via a Digital Output). The board also acquires
the output voltage data from the circuit (via an Analog Input) and communicates
the data to Simulink.
ϯ | P a g e
2) Software Setup
We will employ Simulink to read the data from the board and to plot the data in real
time. In particular, we will employ the Simulink Support Package for Arduino
Hardware from the MathWorks. The Simulink model we will use is shown below
The Arduino Analog Read block reads the output voltage data via the Analog Input A0
on the board. Double-clicking on the block allows us to set the Pin to 0 from the drop-
down menu. We also will set the Sample Time to "0.1". This is 10 times faster than the
circuit's time constant and hence is sufficiently fast. The other blocks in the model can
also be set to have a Sample Time of "0.1" (or left as "-1"). In the downloadable model,
the sample time is set to the variable Ts which needs to be defined in the MATLAB
workspace by typing Ts = 0.1 before the model can be run. The Gain block on the
Analog Input is included to convert the data into units of Volts (by multiplying the data
by 5/1023). This conversion can be understood by recognizing that the Arduino Board
employs a 10-bit analog-to-digital converter, which means (for the default) that an
Analog Input channel reads a voltage between 0 and 5 V and slices that range
into pieces. Therefore, 0 corresponds to 0 V and 1023 corresponds to 5 V.
3) Parameter identification
‫ܩ‬ሺ‫ݏ‬ሻ െ◌ൗ
‫ܭ‬
‫ݏ‬
��1
1) Determine the value of parameter
Parameters Value
Gain (K)
Time Constant (�
ሻ
2) Write the Estimated transfer function.
3) Compare the value with the value in section 2 of Part I, write your comment??
ϰ | P a g e
III. Closed Loop Response
The following figure shows the Simulink block to read the closed loop response of RC
circuit
1) Determine the step specifications of closed loop system
Step Specifications Value
Overshoot (%)
Settling time (sec)
Steadystatevalueofoutput‫ݕ‬௦௦(V)
SteadyStateError( ݁
◌௦௦ሻ
IV. Design PI Controller
Build discrete PI controller using the estimated model and test the controller
experimently
Controller Parameter
‫ܭ‬�
‫ܭ‬�
Closed Loop Specifications after the addition of PI controller
Step Specifications Value
Overshoot (%)
Settling time (sec)
Steadystatevalueofoutput‫ݕ‬௦௦(V)
SteadyStateError( ݁
◌௦௦ሻ
ϱ | P a g e
V. Design PID Controller
Build discrete PID controller using the estimated model and test the controller
experimently
Controller Parameter
‫ܭ‬�
‫ܭ‬�
‫ܭ‬◌ௗ
Closed Loop Specifications after the addition of PID controller
Step Specifications Value
Overshoot (%)
Settling time (sec)
Steadystatevalueofoutput‫ݕ‬௦௦(V)
SteadyStateError( ݁
◌௦௦ሻ
** Note: Print Screen All Figures
1) The Experimental Response with Simulation Response of open loop system
2) The Experimental Response with Simulation Response of closed loop system
3) The Experimental Response with Simulation Response of PI controller
4) The Experimental Response with Simulation Response of PID controller

More Related Content

Similar to Arduino: MATLAB con Arduino

System Troubleshooting
System TroubleshootingSystem Troubleshooting
System TroubleshootingImranulHasan6
 
Lecture 3 (tool stick platform) rv01
Lecture 3 (tool stick platform) rv01Lecture 3 (tool stick platform) rv01
Lecture 3 (tool stick platform) rv01cairo university
 
Pic programming gettingstarted
Pic programming gettingstartedPic programming gettingstarted
Pic programming gettingstartedAjit Padmarajan
 
arduino
arduinoarduino
arduinomurbz
 
Drv10 lab3 pf755_pcam
Drv10 lab3 pf755_pcamDrv10 lab3 pf755_pcam
Drv10 lab3 pf755_pcamconfidencial
 
Arduino Workshop Slides
Arduino Workshop SlidesArduino Workshop Slides
Arduino Workshop Slidesmkarlin14
 
Arduino slides
Arduino slidesArduino slides
Arduino slidessdcharle
 
Computer hardware troubleshooting
Computer hardware troubleshootingComputer hardware troubleshooting
Computer hardware troubleshootingthehackerconcept .
 
Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10stemplar
 
Bluetooth quick start_guide / Controlanything India
Bluetooth quick start_guide / Controlanything IndiaBluetooth quick start_guide / Controlanything India
Bluetooth quick start_guide / Controlanything IndiaDcube Tech Ventures
 
Troubleshooting in plc
Troubleshooting in plcTroubleshooting in plc
Troubleshooting in plcNisarg Naik
 
Unit III ARM Interface and ARM Programming
Unit III ARM Interface and ARM Programming Unit III ARM Interface and ARM Programming
Unit III ARM Interface and ARM Programming Dr. Pankaj Zope
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfssusere5db05
 
Final major presentation
Final major presentationFinal major presentation
Final major presentationPalak Sinha
 
TMSLF2407 DSP Controller
TMSLF2407 DSP ControllerTMSLF2407 DSP Controller
TMSLF2407 DSP ControllerANIRUDDHMAINI1
 
CNC 3-Axis Stepper Motor Shield
CNC 3-Axis Stepper Motor ShieldCNC 3-Axis Stepper Motor Shield
CNC 3-Axis Stepper Motor Shieldhandson28
 
Acer Aspire Switch 10 Laptop - SW5-015-12KL manual PDF download (English) /...
  Acer Aspire Switch 10 Laptop - SW5-015-12KL manual PDF download (English) /...  Acer Aspire Switch 10 Laptop - SW5-015-12KL manual PDF download (English) /...
Acer Aspire Switch 10 Laptop - SW5-015-12KL manual PDF download (English) /...manualsheet
 

Similar to Arduino: MATLAB con Arduino (20)

System Troubleshooting
System TroubleshootingSystem Troubleshooting
System Troubleshooting
 
Lecture 3 (tool stick platform) rv01
Lecture 3 (tool stick platform) rv01Lecture 3 (tool stick platform) rv01
Lecture 3 (tool stick platform) rv01
 
Pic programming gettingstarted
Pic programming gettingstartedPic programming gettingstarted
Pic programming gettingstarted
 
Computer Problems
Computer ProblemsComputer Problems
Computer Problems
 
arduino
arduinoarduino
arduino
 
Drv10 lab3 pf755_pcam
Drv10 lab3 pf755_pcamDrv10 lab3 pf755_pcam
Drv10 lab3 pf755_pcam
 
Arduino Workshop Slides
Arduino Workshop SlidesArduino Workshop Slides
Arduino Workshop Slides
 
Arduino slides
Arduino slidesArduino slides
Arduino slides
 
Computer hardware troubleshooting
Computer hardware troubleshootingComputer hardware troubleshooting
Computer hardware troubleshooting
 
Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10
 
Ideapad
IdeapadIdeapad
Ideapad
 
Bluetooth quick start_guide / Controlanything India
Bluetooth quick start_guide / Controlanything IndiaBluetooth quick start_guide / Controlanything India
Bluetooth quick start_guide / Controlanything India
 
Troubleshooting in plc
Troubleshooting in plcTroubleshooting in plc
Troubleshooting in plc
 
Unit III ARM Interface and ARM Programming
Unit III ARM Interface and ARM Programming Unit III ARM Interface and ARM Programming
Unit III ARM Interface and ARM Programming
 
Arduino course
Arduino courseArduino course
Arduino course
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdf
 
Final major presentation
Final major presentationFinal major presentation
Final major presentation
 
TMSLF2407 DSP Controller
TMSLF2407 DSP ControllerTMSLF2407 DSP Controller
TMSLF2407 DSP Controller
 
CNC 3-Axis Stepper Motor Shield
CNC 3-Axis Stepper Motor ShieldCNC 3-Axis Stepper Motor Shield
CNC 3-Axis Stepper Motor Shield
 
Acer Aspire Switch 10 Laptop - SW5-015-12KL manual PDF download (English) /...
  Acer Aspire Switch 10 Laptop - SW5-015-12KL manual PDF download (English) /...  Acer Aspire Switch 10 Laptop - SW5-015-12KL manual PDF download (English) /...
Acer Aspire Switch 10 Laptop - SW5-015-12KL manual PDF download (English) /...
 

More from SANTIAGO PABLO ALBERTO

Manual de teoría y practica electroneumática avanzada
Manual de teoría y practica electroneumática avanzadaManual de teoría y practica electroneumática avanzada
Manual de teoría y practica electroneumática avanzadaSANTIAGO PABLO ALBERTO
 
Programacion de PLC basado en Rslogix 500 por Roni Domínguez
Programacion de PLC basado en Rslogix 500 por Roni Domínguez Programacion de PLC basado en Rslogix 500 por Roni Domínguez
Programacion de PLC basado en Rslogix 500 por Roni Domínguez SANTIAGO PABLO ALBERTO
 
Programación de microcontroladores PIC en C con Fabio Pereira
Programación de microcontroladores PIC en  C con Fabio PereiraProgramación de microcontroladores PIC en  C con Fabio Pereira
Programación de microcontroladores PIC en C con Fabio PereiraSANTIAGO PABLO ALBERTO
 
Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...
Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...
Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...SANTIAGO PABLO ALBERTO
 
Programación de autómatas PLC OMRON CJ/CP1
Programación de  autómatas PLC OMRON CJ/CP1Programación de  autómatas PLC OMRON CJ/CP1
Programación de autómatas PLC OMRON CJ/CP1SANTIAGO PABLO ALBERTO
 
Manual del sistema del controlador programable S7-200 SMART
Manual del sistema del controlador programable S7-200 SMARTManual del sistema del controlador programable S7-200 SMART
Manual del sistema del controlador programable S7-200 SMARTSANTIAGO PABLO ALBERTO
 
PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...
PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...
PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...SANTIAGO PABLO ALBERTO
 
PLC y Electroneumática: Electricidad y Automatismo eléctrico por Luis Miguel...
PLC y Electroneumática: Electricidad y Automatismo eléctrico por  Luis Miguel...PLC y Electroneumática: Electricidad y Automatismo eléctrico por  Luis Miguel...
PLC y Electroneumática: Electricidad y Automatismo eléctrico por Luis Miguel...SANTIAGO PABLO ALBERTO
 
Electrónica: Diseño y desarrollo de circuitos impresos con Kicad por Miguel P...
Electrónica: Diseño y desarrollo de circuitos impresos con Kicad por Miguel P...Electrónica: Diseño y desarrollo de circuitos impresos con Kicad por Miguel P...
Electrónica: Diseño y desarrollo de circuitos impresos con Kicad por Miguel P...SANTIAGO PABLO ALBERTO
 
PLC: Diseño, construcción y control de un motor doble Dahlander(cuatro veloci...
PLC: Diseño, construcción y control de un motor doble Dahlander(cuatro veloci...PLC: Diseño, construcción y control de un motor doble Dahlander(cuatro veloci...
PLC: Diseño, construcción y control de un motor doble Dahlander(cuatro veloci...SANTIAGO PABLO ALBERTO
 
Electrónica digital: Introducción a la Lógica Digital - Teoría, Problemas y ...
Electrónica digital:  Introducción a la Lógica Digital - Teoría, Problemas y ...Electrónica digital:  Introducción a la Lógica Digital - Teoría, Problemas y ...
Electrónica digital: Introducción a la Lógica Digital - Teoría, Problemas y ...SANTIAGO PABLO ALBERTO
 

More from SANTIAGO PABLO ALBERTO (20)

secuencia electroneumática parte 1
secuencia electroneumática parte 1secuencia electroneumática parte 1
secuencia electroneumática parte 1
 
secuencia electroneumática parte 2
secuencia electroneumática parte 2secuencia electroneumática parte 2
secuencia electroneumática parte 2
 
Manual de teoría y practica electroneumática avanzada
Manual de teoría y practica electroneumática avanzadaManual de teoría y practica electroneumática avanzada
Manual de teoría y practica electroneumática avanzada
 
Programacion de PLC basado en Rslogix 500 por Roni Domínguez
Programacion de PLC basado en Rslogix 500 por Roni Domínguez Programacion de PLC basado en Rslogix 500 por Roni Domínguez
Programacion de PLC basado en Rslogix 500 por Roni Domínguez
 
Programación de microcontroladores PIC en C con Fabio Pereira
Programación de microcontroladores PIC en  C con Fabio PereiraProgramación de microcontroladores PIC en  C con Fabio Pereira
Programación de microcontroladores PIC en C con Fabio Pereira
 
Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...
Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...
Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...
 
Arduino: Arduino de cero a experto
Arduino: Arduino de cero a expertoArduino: Arduino de cero a experto
Arduino: Arduino de cero a experto
 
Fisica I
Fisica IFisica I
Fisica I
 
Quimica.pdf
Quimica.pdfQuimica.pdf
Quimica.pdf
 
Manual básico PLC OMRON
Manual básico PLC OMRON Manual básico PLC OMRON
Manual básico PLC OMRON
 
Programación de autómatas PLC OMRON CJ/CP1
Programación de  autómatas PLC OMRON CJ/CP1Programación de  autómatas PLC OMRON CJ/CP1
Programación de autómatas PLC OMRON CJ/CP1
 
Manual del sistema del controlador programable S7-200 SMART
Manual del sistema del controlador programable S7-200 SMARTManual del sistema del controlador programable S7-200 SMART
Manual del sistema del controlador programable S7-200 SMART
 
Catálogo de PLC S7-200 SMART
Catálogo de PLC S7-200 SMART Catálogo de PLC S7-200 SMART
Catálogo de PLC S7-200 SMART
 
PLC: Automatismos industriales
PLC: Automatismos industrialesPLC: Automatismos industriales
PLC: Automatismos industriales
 
PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...
PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...
PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...
 
PLC y Electroneumática: Electricidad y Automatismo eléctrico por Luis Miguel...
PLC y Electroneumática: Electricidad y Automatismo eléctrico por  Luis Miguel...PLC y Electroneumática: Electricidad y Automatismo eléctrico por  Luis Miguel...
PLC y Electroneumática: Electricidad y Automatismo eléctrico por Luis Miguel...
 
Electrónica: Diseño y desarrollo de circuitos impresos con Kicad por Miguel P...
Electrónica: Diseño y desarrollo de circuitos impresos con Kicad por Miguel P...Electrónica: Diseño y desarrollo de circuitos impresos con Kicad por Miguel P...
Electrónica: Diseño y desarrollo de circuitos impresos con Kicad por Miguel P...
 
PLC: Diseño, construcción y control de un motor doble Dahlander(cuatro veloci...
PLC: Diseño, construcción y control de un motor doble Dahlander(cuatro veloci...PLC: Diseño, construcción y control de un motor doble Dahlander(cuatro veloci...
PLC: Diseño, construcción y control de un motor doble Dahlander(cuatro veloci...
 
PLC: Motor Dahlander
PLC: Motor DahlanderPLC: Motor Dahlander
PLC: Motor Dahlander
 
Electrónica digital: Introducción a la Lógica Digital - Teoría, Problemas y ...
Electrónica digital:  Introducción a la Lógica Digital - Teoría, Problemas y ...Electrónica digital:  Introducción a la Lógica Digital - Teoría, Problemas y ...
Electrónica digital: Introducción a la Lógica Digital - Teoría, Problemas y ...
 

Recently uploaded

Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 

Recently uploaded (20)

DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 

Arduino: MATLAB con Arduino

  • 1. 1 | P a g e C o n t r o l L a b o r a t o r y Experiment 11: MATLAB with Arduino Part1: Introduction to ARDUINO/SIMULINK Lab Objectives • Install and verify Arduino software package for Simulink using a digital output to light a LED • Communicate with the target board (Arduino) using external mode by changing the brightness of an LED with PWM Part 1: Arduino Toolbox Installation for Simulink Objective: • Install and verify Arduino software package for Simulink using a digital output to light a LED Simulink Arduino Library Installation: • Open MATLAB2013a(b)/MATLAB 2014a and type “targetinstaller” in the MATLAB command window. • The target installer window will appear. Select “Install from Internet”. • Select “Arduino (Arduino Uno/Nano/Mega 2560 for Matlab 2014a)” and click “Next” • When prompted, log in using your MathWorks credentials. If you do not have an account you will need to create one. • Follow the onscreen prompts to install the library. • Once the installation processis finished, you can exit out by clicking on“Finish”. Arduino Mega 2560 Drivers’ Setup: • Connect your Arduino Mega board to the computer using the USB cable. Your computer will attempt to search for the necessary drivers online. o If your computer cannot find the right drivers do the following:  Go to Device Manager and look for your Arduino Mega board (Arduino Mega 2560). Your Arduino board will be under Ports (COM & LPT). Otherwise, it may be listed as “Unidentified Device” under ‘Other Devices’. • If you find an unidentified device, unplug the Arduino to see this device is removed from the list to verify that this unidentified device is your Arduino board. Plug you Arduino board back in.  Right click on Arduino Mega (or “Unidentified Device” ) and select “Update Driver and Software”  Select “Browse my computer for driver software”  Set the location to : Matlab 2014a C:MATLABSupportPackagesR2014aarduino-1.0.5drivers. Matlab 2013a C:MATLABSupportPackagesR2013aarduino-1.0drivers.
  • 2. 2 | P a g e C o n t r o l L a b o r a t o r y  You will receive a prompt letting you know Windows cannot verify the publisher of the driver, select “Install this driver software anyway.”  Windows will then install the necessary drivers for the Arduino Mega from this folder. A message will appear when the driver software has installed. o If you are using windows 8 the driver installation might have a problem because the driver file is not digitally signed. See http://mytechblog.com/tutorials/arduino/install- arduino-drivers-on-windows-8/ The Arduino drivers can also be installed from the Arduino website (www.arduino.cc). How do I find the COM port for my Arduino Board: • Go to Device Manager and look for your Arduino Mega board (Arduino Mega 2560). Your Arduino board will be under Ports (COM & LPT). SimulinkSetup: In order to ensure that your computer can properly communicate with the Arduino board, build and run the following Simulink diagram using the steps below: 1) Open MATLAB 2013a/2014a then open a new Simulink model. 2) Find and assemble the required blocks. • Pulse Generator is under View->Library Browser->Simulink->Sources • Digital Output is under View->Library Browser->Simulink Support Package for Arduino Hardware (2013b/2014a: View->Library Browser->Simulink Support Package for Arduino Hardware- >Common) 3) Change the output pin to 13, which is connected to the onboard LED. This is done by double clicking on the Digital Output block. 4) Double click on the Pulse Generator to change the amplitude to 1, the Period to 10, and the pulse width to 50%.
  • 3. 3 | P a g e C o n t r o l L a b o r a t o r y 5) Under the tools menu go to ‘Run on Target Hardware’ and click ‘Prepare to Run’. In the window that pops up you will need to select Arduino Mega 2560 in the drop down for Target Hardware. • “Set host COM port: “ should be set to “Manually” and specify the COM port your board is connected to, clink “Apply” and “Ok”. Automatically does not work reliably on some computers. • Right click on the background and select ‘Model Configuration Parameters’, or . • go to ‘Solver’ on the right hand menu and type ‘inf’ into the ‘Stop time’ spot so that the model will keep running. Make sure the solver options are set to “Fixed-step” and “discrete (no continuous states)”. The “Fixed-step size” should be 0.05. This is how fast in seconds the
  • 4. 4 | P a g e C o n t r o l L a b o r a t o r y control loop will execute. In this case every 50 milliseconds it will execute the Simulink code. 6) Compile and download the code to the board: • 2013a:Go to ‘Tools-Run on Target Hardware-Run’. • 2013b/2014a: Clink “Deploy to Hardware Button” or the keystroke Ctrl+B: At this point the on board LED connected to pin 13 should start blinking on and off. If not, check the debugging section below. Debugging • If an error occurs indicating that there is no driver, follow the directions on the screen. • If MATLAB cannot find the board find COM port number from the device manager and in ‘Configuration Parameters’ set the port manually to the correct number. • Some errors appear on the MATLAB workspace screen - if something is not working, check here. Part 2: Communicating with External Mode Objective • Communicate with the target board (Arduino) using external mode by changing the brightness of an LED with PWM
  • 5. 5 | P a g e C o n t r o l L a b o r a t o r y Simulink Modify your Simulink diagram to the following • Pin 13 can also be set as a PWM instead of just an on/off digital output – replace the Digital Output block with the PWM block • The “Slider Gain” can be found in View->Library Browser->Simulink-> Math Operations. Change the high value to 255 (the max value of the PWM) • The “Manual Switch” can be found in View->Library Browser->Simulink ->Signal Routing • The “Constant” can be found in View->Library Browser->Simulink ->“Commonly Used Blocks” External Mode • External mode allows bi-directional communication to/from the application board to the PC. • When external mode is selected it downloads additional code to the board to allow this communication so this does increase the program size. • When you use external mode you can change parameters while the system is running o However this has an impact on the performance:Due to the communication bandwidth, the fastest you can run in this mode and still meet your control loop time is approximately 30 milliseconds • The values change on the Slider Gain and the Manual Switch can be changed while the program is running. • The code can be run much faster (in the orders of1 or 2 milliseconds) if external mode is not used. Enabling External Mode: • 2013a:“Configuration Parameters” under the “Run on Target Hardware” tab make sure to enable external mode is enabled.
  • 6. 6 | P a g e C o n t r o l L a b o r a t o r y • 2013b/2014a: Select “External” from the drop down menu, then press the “Play” button Run the code and experiment with the setup. Observe the effects on the Arduino LED when changing the value of the Slider Gain, Manual Switch, and the Pulse Generator. • While running the simulation, you can change the position of the switch by double clicking on the switch • You can change the gain of the Slider Gain while running the simulation by double clicking it. • Adjusting the Pulse Generator, experiment with all three parameters. Which increases brightness? What is the approximate range over which you can observe a difference? [Note: These parameters will be addressed in a later lab on PWM] Stopping the Simulation: When you are running the simulation in external mode you are connected to the device and are sending data and receiving data. When this is occurring do NOT use the stop button to stop the simulation: • 2013a: o Always use the “Connect to Target” button to connect to the board. If you use the “Run on Target Hardware” menu then it will automatically download your code, connect to the board and run your code. o Use “Disconnect from Target” if to make changes to the code or to unplug the USB cable. Do not unplug the USB cable before disconnecting from the target. Doing so will leave the serial port open on the computer and you will not be able to connect to the
  • 7. 7 | P a g e C o n t r o l L a b o r a t o r y device without restarting Matlab or logging off your machine (to ensure the serial port gets closed). • 2013b/2014a: o Use the Play button to download and run the code in external mode o Use the square Stop button to stop Debugging – cannot connect to device or cannot download code • If you cannot connect to the device or there is an error when trying to download the code usually this means external mode was enabled and the simulation was stopped with the stop button or the USB cable was unplugged while being connected to the device. In this case you have a couple things to try that may successfully close the serial port o Try the following commands at the Matlab command line (find connected instruments and close them):  newobjs=instrfindall  fclose(newobjs)  delete(newobjs) o Reset the device with the reset button or disconnect/connect the serial cable (this sometimes works) o Close and restart Matlab (this usually works) o Log off your machine, log back in, then restart Matlab (this almost always works) • Make sure the COM port is correct in the “Model Configuration Parameters” Checkpoint: To complete Lab 1 you will need to show the ability to control the blink of the LED in one program with both the ‘manual switch’ and the ‘slider gain’.
  • 8. 1| P a g e Part2: RC Circuit / First Order System The purpose of this part is to demonstrate how to model a simple electrical system. Specifically, a first principles approach based on the underlying physics of the circuit and a black-box approach based on recorded data will be employed. The associated experiment is employed to demonstrate the black-box approach, as well as to demonstrate the accuracy of the resulting models. This activity also provides a physical example of the common class of first-order systems. I. Mathematical Modeling of System First we will employ our understanding of the underlying physics of the RC circuit to derive the structure of the system model. We will term this process "modeling from first principles. 1) Write the value of resistor and Capacitor for the circuit 2) Find the transfer function 𝐺(𝑠) = 𝐸𝑜(𝑠) 𝐸𝑖(𝑠) , and determine the value of gain and time constant Ω F
  • 9. Ϯ | P a g e II. System Identification of System (Open Loop Response) In this part we will record the output voltage of the RC circuit for a step in input voltage. Based on the resulting time response of the output voltage, we will fit a model to the data. This approach is sometimes referred to as black-box modeling or data-driven modeling. After we have generated such a model, we will compare it to the first- principles derived model we created previously. 1) Hardware setup The Arduino board is employed to receive the input command from Simulink and to apply the input voltage to the circuit (via a Digital Output). The board also acquires the output voltage data from the circuit (via an Analog Input) and communicates the data to Simulink.
  • 10. ϯ | P a g e 2) Software Setup We will employ Simulink to read the data from the board and to plot the data in real time. In particular, we will employ the Simulink Support Package for Arduino Hardware from the MathWorks. The Simulink model we will use is shown below The Arduino Analog Read block reads the output voltage data via the Analog Input A0 on the board. Double-clicking on the block allows us to set the Pin to 0 from the drop- down menu. We also will set the Sample Time to "0.1". This is 10 times faster than the circuit's time constant and hence is sufficiently fast. The other blocks in the model can also be set to have a Sample Time of "0.1" (or left as "-1"). In the downloadable model, the sample time is set to the variable Ts which needs to be defined in the MATLAB workspace by typing Ts = 0.1 before the model can be run. The Gain block on the Analog Input is included to convert the data into units of Volts (by multiplying the data by 5/1023). This conversion can be understood by recognizing that the Arduino Board employs a 10-bit analog-to-digital converter, which means (for the default) that an Analog Input channel reads a voltage between 0 and 5 V and slices that range into pieces. Therefore, 0 corresponds to 0 V and 1023 corresponds to 5 V. 3) Parameter identification ‫ܩ‬ሺ‫ݏ‬ሻ െ◌ൗ ‫ܭ‬ ‫ݏ‬ ��1 1) Determine the value of parameter Parameters Value Gain (K) Time Constant (� ሻ 2) Write the Estimated transfer function. 3) Compare the value with the value in section 2 of Part I, write your comment??
  • 11. ϰ | P a g e III. Closed Loop Response The following figure shows the Simulink block to read the closed loop response of RC circuit 1) Determine the step specifications of closed loop system Step Specifications Value Overshoot (%) Settling time (sec) Steadystatevalueofoutput‫ݕ‬௦௦(V) SteadyStateError( ݁ ◌௦௦ሻ IV. Design PI Controller Build discrete PI controller using the estimated model and test the controller experimently Controller Parameter ‫ܭ‬� ‫ܭ‬� Closed Loop Specifications after the addition of PI controller Step Specifications Value Overshoot (%) Settling time (sec) Steadystatevalueofoutput‫ݕ‬௦௦(V) SteadyStateError( ݁ ◌௦௦ሻ
  • 12. ϱ | P a g e V. Design PID Controller Build discrete PID controller using the estimated model and test the controller experimently Controller Parameter ‫ܭ‬� ‫ܭ‬� ‫ܭ‬◌ௗ Closed Loop Specifications after the addition of PID controller Step Specifications Value Overshoot (%) Settling time (sec) Steadystatevalueofoutput‫ݕ‬௦௦(V) SteadyStateError( ݁ ◌௦௦ሻ ** Note: Print Screen All Figures 1) The Experimental Response with Simulation Response of open loop system 2) The Experimental Response with Simulation Response of closed loop system 3) The Experimental Response with Simulation Response of PI controller 4) The Experimental Response with Simulation Response of PID controller