Physics 37100 Advanced Physics Laboratory I

Lab #3

(PART I:  Single measurements)

1)          Create a sketch to measure the light output of a PWM LED using pin 9.

a.      Use the brightest LED with corresponding series resistor from previous Lab.  Set the brightness of the LED to 128 using analogWrite.

b.      Use the photoresistor in series with a resistor to measure the light output on A0.  It might be useful to put the LED and photoresitor into a tube to eliminate outside light.

i.      What resistance did you use? Why?

c.      Output the value of A0 to the serial port every 1/10 of a second for 10 seconds.

2)          Repeat for brightness 0, 1, 2, 31, 32, 64, and 255.

3)          Analyze the data.

a.      Copy and paste the data from the serial monitor.

b.      Import to Matlab or other data analysis program.

c.      Find and report the mean and standard deviation (STD) for each of the 8 brightnesses.

i.      Which has the largest STD? Why?

ii.      Is 128 twice as bright as 64? Explain.

iii.      What is the smallest difference in brightness you can measure? Explain.

d.      Plot the 8 voltages verses time.

i.      Are there any trends? Explain.

e.      Repeat the measurement for brightness 128, three more times.  Are the results repeatable?

(PART II:  Time resolved measurements)

4)          Modify your sketch to measure the detailed time dependence of the light output of a PWM LED using pin 9.

a.      Create a 512 element unsigned int array Vs to hold the time series data.

b.      Acquire the data in a for loop with n running 0-511. Only use Vs[n]=analogRead(inPin) inside the loop so that we can get the data as fast as possible.

c.      Time the loop by saving the value of micros() just before and just after the loop.

d.      After the loop output all of the array values and the time of the loop to the serial port.

e.      Do all of the work in setup() so that you do not fill up your serial monitor

5)          Analyze the data.

a.      Copy and paste the data in the serial monitor to matlab or other plotting program.

b.      Assume that each acquisition took equal time and use the total time to find the time for each point.  Is this a good assumption? Explain.

c.      Plot the data versus time for analogWrite values of 0, 1, 32, 64, 128, and 255.  How does this help explain the data from 3c above?