ENGR351 Lab 2020 Fall
Lab 5
Name:
Nicolas Llarena
Email: Njllarenaarias@fortlewis.edu

1. Lab 5 - PID control

2. Introduction
The purpose of this lab is to better understand a proportional-integral-derivative controller (PID controller). An LDR Resistor will be used with LEDs and pushbuttons to control the LEDs brightness by using feedback while implementing a PID controller in arduino. Python will also be used to collect and sample data as well as plot the received data to better visualize and save our findings.

3. Materials
Materials Quantity
LEDs 2
LDR Resistor
1
10k Ohm Resistor
1
330 Ohm Resistor
1
bread board
1
push button
1
arduino UNO
1
jumper wires
10

4. Results

Task 1

                            

Task 1. First image shows ambient light intensity, Second image shows LED light intensity, third image shows the osillation of the sensed light around the setpoint.


Task 2


         
Figure 2. Video shows oscillation around the set point after adding an LED with a pushbutton. we can see the oscillation going back to the setpoint.

         
Figure 3. Python was used to save our data and implement a graph where we can see the light intensity over time (spikes represent the pushbutton being pressed).

Task 3


             
Figure 4.  Setpoint tracking represented in arduino, the oscillation follows the setpoint. the setpoint is moved up by 20 points when the pushbutton is pressed.

      
Figure 5. Python was used to collect and save the data, a plot was implemented to better visualize the data.


Discussion


Overall this lab was very important. We learned and understood what a PID controller is and how it can be implemented. I can already tell they are important since it implements feedback perfectly. Working with LDR resistors is always fun, they are very useful for closed loop systems in general. The final tasks of this lab required the use of python to collect and plot data. This was an interesting hange of pace since it required us to work with two programming languages at the same time, challenging but fun. I look forward to implementing python with more projects since in the futureI know this will be the case.Looking forward to the next homework.