CE 351 2023 Spring
PID Control with Photocells
Name: Vann Montoya

Email: bvmontoya@fortlewis.edu

        PID Control with Photocells

Introduction
    The purpose of this assignment is to demonstrate a proportional - integral - derivative controller (PID controller) using a photoresistor and LEDs.

Materials and Methods
    Arduino Controller
    Photocell resistor
    LEDs

Results
  
First thing we want to do is measure the ambient light with the photoresistor before any additional LED lights.

   
    Figure 1: Ambient light readings from the photoresistor.

    Initial readings show approximately ~136.
    Now, we add an LED next to the photoresistor and measure the new value.

   
    Figure 2: Light readings from the photoresistor near an LED.

    We see that ambient readings show ~136 and with an assisted LED is ~228.
    Taking the median between the two results in a set point of 182.

   
    Figure 3: Code using the Set Point of 182, the values
oscillating around the set point.

    Now, we want to add an additional LED to the board.
   
   
    We'll write a Python script file to read from the USB and plot it.

    Here's the code from the file:
   
    Figure 4: Python code for reading from the USB and plotting.