1 of 13

Unit 3 - Oscillation

Lab 3A: Vertical Mass-Spring

UCLA Physics Department

1

University of California, Los Angeles

Department of Physics and Astronomy

​

Physics 4AL

Fall 2026

2 of 13

Outline of Lab 3A

  • 3A In-Lab
    • Hooke’s Law measurement of spring constant
    • Harmonic Oscillations using your ESP32

​

​

​

UCLA Physics Department

2

3 of 13

Hooke’s Law

UCLA Physics Department

3

4 of 13

Hooke’s Law

Find the spring constant of the spring.

​

  • Measure the length of your spring without any mass attached
  • Fix the spring to the small rod on the stand and hang masses from the springs and measure the new length. Do this for 3 separate masses
  • You can combine masses by using the hooks at the ends. You can use the weighing scale to find the mass values. Note the 50 g weight on its own is not enough for displacement

UCLA Physics Department

4

Mass

Spring

equilibrium position

​

​

​

​

​

​

5 of 13

TA Checkpoint 1 - Hooke’s law Plot

  • Plot relative position (y-axis) vs mass (x-axis) along with a best fit line
  • Determine Spring constant with uncertainty
    • Spring constant k = g / slope
    • Use polyfit and covariance
    • Uncertainty: error propagation for the reciprocal of slope (as for Speed of Sound in Pre-Lab Week 3)

UCLA Physics Department

5

6 of 13

Harmonic Oscillations

UCLA Physics Department

6

7 of 13

Wireless transmission of data

  • Use the multimeter to check the voltage of the batteries that you will be using.
    • If the voltages are greater than 1.37 V then use these batteries in the battery holder to power your setup.
    • If the voltages are lower than 1.37 V then use a different set of batteries.
  • On your ESP32:
    • ultrasound sensor
    • bluetooth module
    • Accelerometer
  • Verify if your ESP32 setup with ultrasound, accelerometer and bluetooth is able to send meaningful data to the ESP32 IDE wirelessly
    • The ultrasound will be the first sensor to provide meaningless values at low voltages.

UCLA Physics Department

7

8 of 13

Wiring diagram & Code

9 of 13

ESP32 setup as mass in mass-spring system

  • Requires: only one member’s setup.
  • Thread one string through both hooks on each side of the ESP32 frame. Make sure the string is of equal length on both sides
  • Tie the ends of each string together, and tie these loops together over the back end of the frame (opposite side of the sensor hole)
  • Insert your ESP32 (with ultrasonic sensor, accelerometer) and battery into the frame, weigh and record this final setup.

UCLA Physics Department

9

10 of 13

Relative Acceleration from Calibration Constants

  • Now you can find acceleration in m/s² using calibration constants from last lab:

Total acceleration = slope*analog_output + intercept

  • Total acceleration includes:
    • Gravity
    • Force from the spring
    • You can create a function to automate the task to find the relative acceleration!
  • We want to nullify the effect of the mass experiencing acceleration of g in static conditions

Relative acceleration = Total acceleration - Acceleration due to gravity (g)

Recall g is defined as -9.81 m/s² so subtracting by -9.81 is equivalent to adding +9.81

You will essentially zero out the effect of gravity (your relative acceleration will equal 0 m/s² when only gravity is acting)

  • You will plug in your analog_output data for this oscillations experiment to determine the relative acceleration of your hanging mass

​

UCLA Physics Department

10

11 of 13

Spring mass system

  • Hang your frame to your spring
    • Best to have the axis of acceleration on the accelerometer parallel to the direction of oscillation!
    • Move the setup to be fairly close the ground (½ ~⅔ up the stand length)
  • Ensure the setup is as level with the ground as possible (you may need to adjust your strings)
  • Weigh your ESP32 setup (with the battery holder)
  • Make sure that the ultrasound will reflect off the ground and not any other part of the stand

UCLA Physics Department

11

Spring

ESP32 setup

Stand

12 of 13

Harmonic Oscillations (TA Checkpoint 2)

  • Pull the mass slightly down and let go for the system to oscillate.
  • Collect data for 15 cycles.
  • Import the data into Python and plot the ultrasound data (distance in m) vs elapsed time.
  • Using your calibration function, plot final array (relative acceleration in m/s2) vs elapsed time

​

UCLA Physics Department

12

Relative acceleration should be centered close to 0 m/s^2

13 of 13

Post-Lab Requirements for lab 3A

  • Please complete the post lab assignment found in your JupyterHub Repo.
    • Physics_4AL/Assignments/Post-Labs/Post-Lab-Week-5.ipynb
  • Plot the displacement vs. mass of the mass-spring system. Include axis labels, title, units, best-fit line
  • Calculate the spring constant of your spring, including uncertainty and units. Also record the mass of your ESP32 setup here
  • Include your plot of distance vs. time oscillations obtained from the bouncing ESP32’s ultrasonic sensor. Include title, axis labels, units
  • Include your plot of relative acceleration vs. time oscillations obtained from the bouncing ESP32’s accelerometer. Include title, axis labels, units