1 of 34

Unit 4�Optics

UCLA Physics Department

University of California, Los Angeles

Department of Physics and Astronomy

Physics 4BL

Summer 2026

2 of 34

REMINDER: Final Project Proposal

  • The Project Proposal is due tonight, 8/19, at 11:59 pm
    • (optional:) If you would like a template document to organize your thoughts, you can use this template originally from Physics 4AL

  • Make sure to ask your TA if particular equipment is available. If equipment is not available to request, you must provide it yourself or redesign your experiment without it.

3 of 34

Outline of Unit 4

  • Optics
    • Geometric Optics
    • Double-slit Diffraction

  • Python Programming and ESP32
    • Generate a 2D diffraction simulation in Python
    • Use ESP32 to gather experimental data and confirm simulation

UCLA Physics Department

4 of 34

Announcement: Update to Pre-lab 5

  • Please use the new, updated version of the Pre-lab 5 Jupyter notebook when submitting your next assignment.

Pre_Lab_Assignment_5_Summer_26.ipynb

  • Can also be accessed from the Unit 4 page on the course website

5 of 34

Lab 4A: Snell's Law and Geometric Optics

6 of 34

Snell’s Law and Refraction

  • A ray of light changes direction, or refracts, when it travels between two different mediums

  • Snell’s Law gives the relationship between the incoming angle θ1 and outgoing angle θ2, which depends on the index of refraction, n, of both mediums.
    • Angles are measured relative to the normal to the boundary between the mediums

7 of 34

Total Internal Reflection

  • When n2 < n1, the transmitted ray bends away from the normal (i.e., θ2 > θ1)
    • When θ1 reaches a particular critical angle θc, the transmitted ray is bent as far as possible: θ2 = 90°
  • For incident angles greater than θc, there is no transmitted ray at all, and the light undergoes total internal reflection
  • We can calculate θc by setting θ2 = 90° in Snell’s Law:

8 of 34

Experiment 1: Total Internal Reflection

  • You will be calculating the critical angle in a trapezoidal prism. We will use a lamp to shine a narrow ray of light into the prism and see when total internal reflection occurs
  • There are two interfaces that the ray will pass through: (1) air to glass going into the prism, and (2) glass to air back out of the prism
    • We are interested in Interface #2, where n1 = 1.495 in the prism and n2 = 1 in air

1

2

9 of 34

Experiment 1: Total Internal Reflection

  1. Shine the ray of light into the longest side of the prism, and rotate the prism until the refracted ray is parallel to Interface #2 (i.e., θ2 = 90°).
  2. Measure the incident angle at Interface #2 with a protractor. This is your experimental value for θc.
  3. Calculate the theoretical critical angle based on the indices of refraction for the two mediums: n1 = 1.495 and n2 = 1
  4. How close is your measured angle to your theoretical prediction? Express this as a percent difference.

1

2

10 of 34

Lenses

  • A lens is an optical device that focuses or disperses light. There are many properties we can use to describe the behavior of rays when they interact with a lens.
    • Converging lenses focus incoming parallel rays to a single point, or focus
    • Diverging lenses scatter incoming rays, which can be traced backward to a virtual focus point

Images from University Physics (OpenStax)

Converging lens

Diverging lens

11 of 34

Properties of Lenses

  • Focal length (f): the distance between the center of a lens and its focus point
    • Note: f < 0 for a virtual focus point
  • Radius of curvature (R): a particular face of a lens is an arc from a circle with this radius
    • Each lens will have two different values, one for each face (R1 and R2)
    • Note: R can be positive or negative. Similar to focal length, R < 0 means that the center of the circle this arc comes from is behind the lens

12 of 34

Measuring The Radius of Curvature

  • To measure the radius of curvature, we can take advantage of the geometry of circles and the Pythagorean Theorem.
  • For each face of a lens, you should measure a and b:
    1. Drop an altitude from the highest to lowest points of the arc
    2. Measure the length of this altitude. b is half of this distance.
    3. Measure the distance between the center of the arc and your altitude. This is a.
      • For the concave lens, this will be outside the lens itself.
    4. Calculate the radius of curvature:

13 of 34

Lensmaker’s Equation

  • The Lensmaker’s Equation describes how to calculate the focal length of a lens given its physical properties:
    • Index of refraction, n
    • Radii of curvature, R1 and R2
    • Thickness, d, at its center
  • The Thin Lens Approximation neglects the third term if the thickness of a lens is small
  • If we instead measure f, both versions of the Lensmaker’s Equation can be rearranged to solve for n!

Full Lensmaker’s Equation

Thin Lens Approximation

14 of 34

Lensmaker’s Equation

  • Solving for n with the full Lensmaker’s Equation requires the quadratic equation, but you can put the final expression into Python to make it simpler to calculate.
  • Don’t forget your sign conventions for R1, R2, and f!

15 of 34

Experiment 2: Lens Focal Lengths

  • You will be measuring the physical properties of three different lenses in order to calculate their index of refraction.
    • Biconvex lens
    • Biconcave lens
    • Plano-convex lens
  • Use the provided slits on the lamp to create three or five parallel rays of light.
  • Place one lens on a sheet of paper and shine the parallel rays through it.
    • Try your best to line up the center of the lens with the central ray so that the refracted rays are symmetric.

16 of 34

Experiment 2: Lens Focal Lengths

  1. With a pencil, trace the full shape of the lens and the paths of the refracted rays on your paper.
    • If you have trouble tracing the rays accurately, you can place a few dots along each ray and join them together once the lens is not in the way.
  2. Using your tracing, measure the focal length of the lens
    • For the diverging lens, use a ruler to trace each ray backward behind the lens to find the virtual focus point
  3. Calculate the radius of curvature for each face of the lens.
    • Note: the flat edge of the plano-convex lens has R = ∞.
  4. Calculate the index of refraction of the lens using (1) the full Lensmaker’s Equation and (2) the Thin Lens Approximation
    • For the full equation, take the greater of the two roots of the quadratic equation.
  5. Compare both of your calculated values to the theoretical value of n = 1.495. Is the full equation or the thin-lens approximation more accurate?
  6. Repeat Steps 2-7 for all three lens types.

17 of 34

Lab 4B: Double-slit Diffraction

18 of 34

Double-slit Diffraction

  • Diffraction is a consequence of the wave nature of light. Light behaves differently than a straight ray when it interacts with a narrow opening or boundary in a material
  • In double-slit diffraction, the waves of light traveling through one slit interfere with the light from another slit
    • produces a pattern of constructive and destructive interference when viewed on a faraway screen

19 of 34

Double-slit Diffraction

  • Where do the bright and dark fringes occur?
    • Bright spots come from constructive interference, when the waves from both slits arrive in phase with each other
    • Dark spots come from destructive interference, when the waves are out of phase
  • To be in phase, the extra distance traveled by the light from one slit must be an integer multiple of the wavelength of light (think back to Unit 2A!):

D

20 of 34

Double-slit Diffraction

  • The locations of the bright and dark fringes are controlled by D and 𝜃, but we can also view it in terms of physical distance x across the screen
    • From similar triangles,

  • We can therefore measure the diffraction pattern on a screen (brightness vs. x) and then solve for intrinsic parameters about the slits and the incoming light

D

b

x

21 of 34

Double-slit Intensity Profile

  • In Pre-lab 5, you simulated diffraction by a single and double slit. We will use the double-slit equation to fit the data we collect:

  • The parameters that affect I(x) are
    • D = separation of slits
    • d = thickness of each slit
    • b = distance from slits to screen
    • 𝜆 = wavelength of light
  • Note: sinc(x) = sin(x)/x

22 of 34

Experiment Outline

  • In this lab, we want to record a double-slit interference pattern and compare our measurements to theoretical equations concerning diffraction. To achieve this, we will:

  1. Use an ESP32 to capture an image of a diffraction pattern
    1. Take a calibration image to determine an absolute distance scale in our images
  2. Extract brightness data from an image using Python
  3. Fit the data to a theoretical curve using Python
  4. Calculate the wavelength of light used to make the diffraction pattern, and compare with its theoretical value

23 of 34

Image Capture on ESP32

  • The ESP32 has a built-in camera module with a small resolution: 640 x 480 pixels
  • We cannot directly transfer image files from the ESP32 to our computers, so we will instead send the raw hexadecimal image data over the Serial Monitor
    • We can then load the raw data into Python and save it as a .jpg

24 of 34

Image Capture on ESP32

  • We will be using THIS CODE to take pictures with the ESP32
    • The code takes a single picture, sends the data over the Serial Monitor, and then stops
    • To take another picture, clear the Serial Monitor and then press the Reset button on your breadboard (shown at right)
  • The only circuitry required is to connect Pin 15 to Ground
    • This prevents several lines of text from being printed when you hit the Reset button

25 of 34

Image Capture on ESP32

  • Once you have captured an image, copy and paste the raw hex data from the Serial Monitor to a text file
    • Right Click > “New File” in JupyterLab to open a blank text file
  • You can save this data as a JPG and view your image using the tutorial notebook “Unit 4B Data Analysis”
    • We will also use this notebook for the rest of our analysis

26 of 34

Experiment 3: Double-slit Interference

  • You will be shining a red laser through a set of narrow slits in order to see a diffraction pattern on a piece of paper.
    • Your slits should be ~10 cm from the laser, and the screen should be 120-130 cm from the slits (see below)

27 of 34

Experiment 3: Experimental Parameters

  • You have several sets of slits to choose from when setting up your experiment. Use Pattern A for the best results:
    • D = 0.250 mm
    • d = 0.04 mm
  • You will need to measure the distance b from your slits to the screen using a ruler/meter stick.

28 of 34

Experiment 3: Setup

  1. Align the slits and laser on the magnetic track such that you can see a horizontal diffraction pattern on the metal screen.
  2. Tape a piece of blank paper onto the screen, and place it about 30 cm away from the near end of the magnetic track.
  3. Place your ESP32 10-15 cm away from the screen, making sure the camera module is facing toward the red diffraction pattern.
  4. Use the adjustment knobs on the back of the laser module to move the interference pattern 4-8 cm off of the table surface.

29 of 34

Experiment 3: Data Collection

  • You will take one “calibration” image and one “data” image
  • Take a picture with a ruler in frame, in order to know the distance scale in the image
    • You will need to shine a phone flashlight at the screen to make the image bright enough
  • Take a picture of just the interference pattern with a dark background
    • NOTE: Do not move your camera between Steps 1 and 2!

30 of 34

Experiment 3: Data Collection

  • It will likely take you multiple tries before you have a good set of images to work with. For best results:
    • Point the camera module toward the interference pattern. The camera itself is attached to a flexible ribbon, and you will need to prop it up so it looks at the part of the screen you want
    • Make sure that the camera is level. Your data analysis will be easier if the diffraction pattern is closer to horizontal.

31 of 34

Python Analysis - Outline

  • Our primary goal for this analysis is to determine the wavelength of the light that produces our observed diffraction pattern.
    • To accomplish this, we need to extract brightness vs. distance from our images and then fit that data to the theoretical curve from Pre-lab 5.
  • Follow the Unit 4B Data Analysis tutorial notebook to process your images and fit your data. When your analysis is complete, you should have:
    1. 2 JPG images showing your raw data from the ESP32 camera
    2. A plot showing (1) the intensity profile of your interference pattern and (2) the best-fit curve to these data
    3. The calculated wavelength of the laser light based on your best-fit curve

32 of 34

Unit 4 Report

33 of 34

Unit 4 Report Requirements

  • Complete a write-up summarizing your work in Unit 4 including the following:
    • Title, Authors, Abstract
    • Introduction: Scientific background, Hypothesis
    • Methods: Experimental setup, Procedure
    • Results: Data analysis with several graphs
    • Discussion, Conclusion
    • References and Python Code Appendix

34 of 34

Unit 4 Report Requirements

  • Your Unit 4 Report should include the following plots and measurements from our study of optics:
    • Lab 4A: Geometric Optics
      • Pictures of ray tracings from data collection
      • Calculated critical angle for total internal reflection
      • Calculation of index of refraction for biconvex, biconcave, and plano-convex lenses
        • Each lens should have two measured values: one using the Lensmaker’s Equation and one using the Thin Lens Approximation
    • Lab 4B: Diffraction
      • ESP32 camera images of diffraction pattern (calibration and data)
      • Plot of extracted double-slit diffraction pattern and best fit curve
      • Calculated laser wavelength λ