CE351 Microcontrollers
Homework 6 - PID Control with Photocells


Connor O'Keefe
Email: cwokeefe@fortlewis.edu

Task 1 - Sensed light oscillation around a setpoint
An average ambient light sensed was generated, shown in figure 1. This was completely around 8:30 a.m. on a cloudy day.


Figure 1. Average ambient light sensed.
An average LED and ambient light sensed was generated, shown in figure 2.


Figure 2. Average ambient with LED light sensed.


Figure 3. Arduino code for light sensor work.


Figure 4. Oscillation around the setpoint.


Task 2 - Sensed light oscillation around a setpoint with pushbutton for a second LED
The second LED will cause the photo signal to increase for a short period, seen in Figure 5. Notice the jump when the button is pressed.

Figure 5. Python plot of the sensed light with pushbutton for second LED.


Task 3 - Setpoint change with pushbutton



Figure 6. Python plot of pushbutton setpoint change.


Figure 7. Python code for plotting data from the serial monitor.