Tip:
Highlight text to annotate it
X
Hi everybody from arduinobymyself blog
today we have another project
I will talk about
The PID control
PID is the most used controller in automation
actually is used in industry
PID control can be used in our home
to
Luminosity and temperature control
to ventilation control
and other kinds of uses
Industrial ovens, industrial and chemical proccess
etc...
so,
to get a better understanding about the matter, we have this web site
that I recommend
called project blog
"Improving the beginner's PID - Introduction
from our colleague
Brett Beauregard
This website have a lot of information of PID
Bret has developed this arduino PID library
and beyound the library
he has developed too a Grafical User Interface called FrontEnd
to PID
so, who wnats to getting a betther understanding
visit this website
and..
that has all information needed.
and...
This Link
and all Links will be posted in the youtube video description
and alternatively
it will be posted in the arduinosbymyself blog
...
http://arduinobymyselg.blogspot.com.br
furthermore
this another website called Arduino Playground
where I can download the necessary library for Arduino.
The PID library
and I can download the FronEnd GUI too, developed by Bret.
The Version is
_03
In this way I can download the Library
and the FrontEnd
To use the FrontEnd GUI, it is advisable
that you download too
one another library for Processing
that is
the ControlP5 library
That is a library
for a Graphical User Interface
for Processing
In this library I have all controls used in the GUI
so,
make the controlP5 download
and install it in your Processing Libraries Directory
and to Arduino
download the PID_FrontEnd Library
...
this will help us
in our PID's control project
And about our hardware:
It is straightforward.
My PID control wil be made by Arduino
In this case I will control an environment luminosity
the environment will be this black tube
and at the ends of the tube I will have
a LED
to control
the brightness (luminosity)
and in the other end a LDR that will be our feedback
thus it is possible as light exists in the tube.
Arduino pin 3 will be connected to the LED
through
a resistor
...
of polarization for the LED
and the LDR will be connected to
the positive +5V
through a pull-down resistor
of 10K Ohms
and will be connected to analogical 0 pin
this is our feedback
and I can check the value of luminosity that I have in the
envirinment that is our balck tube
...
So, this is our hardware that is very simple
we also have the power from arduino to the LED and LDR
What I have to do in regard of software!?
once I have installed the PID_library
and
the PID_FrontEnd for Processing
logically
with the Arduino's IDE and Processing installed
and also the ControlP5 library installed
I can open our files
here I have the interfaces
in the processing
I will open
the FrontEnd file from the FrontEnd folder
we have two folders: the FrontEnd PID version 3
that is the processing's file folder
you will open here
and there is a FrontEnd_v3 file
...
and in the Arduino's IDE
you can open
from the other folder
you will open the PID_FrontEnd _Sample_Code file
...
....
The Arduino_Sample_code
uses the PID_V1 library
that is you will found in the Arduino Playground website
The FrontEnd PID
uses
The ControlP5 and JAVA and Processing Libraries
aqui no anhembi em 2001
In the Arduino's IDE
Now I can
do a sketch upload to the Arduino's hardware
when Arduino received the sketch
it goes to receive the information from the sensors
from the LDR and begins to command the LED
trying to stabilize the luminosity in the environment
And here in the Processing interface
I will run
the application
and it will bring us a window with the FrontEnd PID
Graphical PID
...
it is a bit time consuming, has plenty GUI
here it is.
This is my FontEnd PID GUI
and which I have in this interface?
in this part of the window
it is for my
input
and for my setpoint
What is setpoint in the PID control?
it is the desired value
of luminosity
My input is the value
That I am measuring in the LDR (my feedback)
how much there really is light in the environment
the green line is the ideal value
the red line is the real value
in the botton part of the window
I have the blue line that is the PID output
PID control that will control the LED
It's start from zero, without any luminosity
and will gradually increase the LED energy supply
to get to my ideal control
as close to
the red line
(desired value)
but what is the unit used? It is luminosity. Can be Lumens, LUX or Candela....
from 0 to 1024
I would have to know:
zero
is 0 of luminosity (in my luminosity unit)
and 1024 would be my maximum brightness
eg.
inthis window I have
a setpoint of 950
950 what? Lumens, lux, etc
...
it is determined as the variable that should be controlled. In this case luminosity
in this part of the window
in my FrontEnd
I have:
Manual
or automatic control
of the system.
I can make the automatic or
manual control of the PID
I have the Setpoint configuration
I can vary this setpoint as I need. Eg. I can set as 650
and send to the Arduino.
it will drop to 650
and the PID control will act trying to keep this red line in the value of 650
and my output will also be actuated
in this field I have the real luminosity value (red line)
and the value of the output, from 0 to 255
the output voltage to the LED
for
that I reach the value of 650 (luminosity)
let's say: luminosity value
and here I have the P I D parameters
this parameters determine how will be the PID control
you can see that it varies a little bit
this
depend of how the parameter was set
here for example
my
my Porporcional constant is equal to 0.01
my Integral constant is equal 0.28 and the Derivative constant is equal to 0
como ele adotou conclusão o controle
actually
I using just a PI controller
I am not using a PID controller, just a PI controler
I can change this as I want
eg. if I put a derivative constant equal 1
and send to Arduino with this button.
look this
The control was unstable
The LED is flashing and I have a lot of noise in the red line perhaps an on-off control.
My output goes up to the maximum
The luminosity is varying a lot because the LED is blinking
flashing
and I'm totally out of desired PID luminosity control
...
The PID constants may be determined empirically
or by mathematical methods
Methods to PID control
in this case
I am using
KP equal to
KI equal to
0.28 and KD equal to 0, in this way I have a better control of my system
If I want to increase the Setpoint to 900 of luminosity
and send to Arduino
we can see that the controller begins to
increase proportionaly
and do a better control of the luminosity
till
reach my luminosity setpoint of 900
and he goes doing the control voltage of the LED
of the LED voltage
to obtain
and stay
in the setpoint
these oscillations also depend of the type of control's system
...
for examplo: first or second order system
this will determine the behavior of the curve; rise time, oscillation, over impulse, etc
rise time, oscillation, over impulse, etc
time to reach the stead state
percentage
of stead state
so
This is our PID controller
using
the Arduino
in this case a luminosity controller
could be a temperature controller
I'll make another video with another type of control,
another example, but using the same interface.
alright!
and
I can vary this parameters KP, KI
and KD
to obtain
the better control as possible
eg if I put the setpoint
to 600
we can see that the control begins to be done
it begins
to reach the value of 600
often we have oscilation
under their own control system
but
you can adjust the parameters for the oscillation decreases
...
and thus have a slower fall
and less oscillation and a fairer control
and a faster fall, etc
depend how
the parameters will be set
changing to 950
......
I cant reach 1024
to 950 we can see that the control responds better
it can make an adjustment a little better
it varies a bit but can adjust to the setpoint 950 of luminosity
this is the first test
don't forget
you can download the libraries
the links are in the description of this video
and this three important websites
and these links will be
on the arduinobymyself too
all information about
Arduino connections
.............
..............
for you can reproduce this experience that is
very nice to work with the PID
and wait for the next video where we will have another PID control situation
another project
let's see if this new project will work
and we will show it in the next video.
So, until next time