CE351 Lab 5 2020 Fall
PID Control - Photocell
Name: Audra Benally
Email: albenally1@fortlewis.edu
1. Introduction
In this lab, we learned about coding the
closed loop PID control code. PID stands for
"proportional-integral-derivative": three different feedback
calculations
that help the LED output reach a predetermined setpoint. The PID code
was used to
control the light output of a LED light. The sensor used was a
photocell which varied resistance depending on the received light.
Three tasks were performed in this lab. The first was basic in that we
just needed the LED light to stay at a certain setpoint. In the second
task, another pushbutton LED light was used to alter the sensed light
input which forced the origial LED to change brightness to match back
up with the setpoint. In the third task, a push button was used to
change the setpoint and the LED was forced to readjust to the new
setpoint.
2. The Code and the Results
~~~~~~~ Task 1:

Figure 1.
Measurement of the ambient light in the room.

Figure 2. The
maximum output possible from the LED light.
Link: https://youtu.be/L0tqxJjB0UA
Video 1. Task
1: the photocell sensed light oscillating around the first setpoint (300) then the second setpoint(500).
~~~~~~~ Task 2:

Figure 3. The
code used to do the first and second tasks.
Link: https://youtu.be/GSa37F_0qsU
Video 2. The
LED ouput adjusting to the increase and decrease of the ambient light.
~~~~~~~ Task 3:

Figure 4. Code for the PID setpoint tracking.
Link: https://youtu.be/o_9w2zyGlCI
Video 3. The
photocell sensed light oscillating around and adjusting to the new
setpoint.
Discussion:
This lab was very fascinating in the way that it was
a tool that was implemented through the code instead of the hardware
this time. I had learned about closed loop systems in my systems and
control class and it is really impressive watching the PID Control
system in action. I did have some weird trouble in task 2 with the
output LED light dimming and brightening when I turned on the second
LED. I got rid of the issue by moving the second LED farther back from
the photocell sensor. I did skip out on the recording and transferring
to Python portion of the lab because this lab is already very late and
I don't think I can risk it being any later.