CE-351 Microcontrollers, 2022 Spring
PID control using a photocell
Name: Mychael Garcia
Email:
mhgarcia@fortlewis.edu
Materials:
- Arduino Uno
- Photocell
- Push button
- White LED 2x
- Bread board
PID and photocell overview
In this project we developed a simple PID controller, this uses feedback from
the system to get to a resulting value and correct itself to get to the desired
value. This over all error is calculated from the P, proportional, I, Integral,
D, derivative, hence the name. The simple system we want to integrate this controller
into was a simple light sensing circuit. We have photocell which is a variable
resistor that changes relative to light level. Knowing that light level is our
variable that we can change, in the following task we will use this idea and apply
it to our PID controller to vary the overall brightness of this LED.
Task 1:
For the first task we needed to find the relative ambient light level
for the environment we are testing in. From this we increased the value a
significant amount to see that the LED attached to our system would turn on and
produce a change in current value readings. With this change the brightness was
slowly adjusted to where the current value would equal the setpoint. My ambient
light level was around 280-300 so to see a change in the LED brightness I
increased the set point to 340, as seen by the blue linear line.
Task 2:
After getting our PID controller working, and the LED brightness calibrated we
added a second LED on a button. Whenever this new LED was powered the brightness
on the original would have to be adjusted, decreased, to bring the overall
light value back to the sent point. The opposite can be said when the new LED
was powered off.
Task 3:
For the final task we wanted to adapt a changing set point value and have
the PID controller recalibrate automatically to the new value. We used the same
button as before but instead of having an LED connected each press would
increase the set point value by 20.
Conclusion:
Overall this was a very useful and interesting project. In my robotics
II class, we used a PID controller for our final
project (balancing car) this was the same idea, but it was hard to visualize
what happens. With this, it was easy to see how changing, increasing or
decreasing, one of the PID constants varies the rate at which the brightness of
the LED to the desired set value.
----------------------------------------------------------------------------------------------------
END