Skip to main content

Overview

PhysisLab experiments can be performed with varying levels of equipment depending on which measurement approach you choose. This page outlines all requirements organized by experiment type and methodology.

Software Requirements

Python Environment

All camera-based and audio-based experiments require Python with scientific computing libraries:
  • Python: Version 3.7 or higher (3.8+ recommended)
  • Operating System: Windows, macOS, or Linux

Required Python Libraries

The following libraries are used across different experiments:

Core Computer Vision

import cv2              # OpenCV for image processing and tracking
import numpy as np      # Numerical computing and arrays

Scientific Computing & Analysis

import matplotlib.pyplot as plt      # Plotting and visualization
from scipy.optimize import curve_fit # Curve fitting (sinusoidal, parabolic)
from scipy.signal import welch, find_peaks  # Signal processing and spectral analysis

Audio Processing (Sound-Based Experiments)

import sounddevice as sd  # Real-time audio I/O
import time               # High-precision timing

GUI Applications (Oscilloscope/Signal Generator)

import tkinter           # GUI framework (or PyQt/customtkinter)
import serial            # Serial communication with ESP32
import websocket         # WebSocket communication (optional)
A complete requirements.txt file will be provided in the installation guide. Install all dependencies with:
pip install opencv-python numpy scipy matplotlib sounddevice pyserial

Arduino IDE or PlatformIO

For microcontroller-based experiments:
  • Arduino IDE: Version 2.0+ (recommended) or 1.8.19+
  • Alternative: PlatformIO (for advanced users)
  • ESP32 Board Support: Arduino core for ESP32

Hardware Requirements

Minimum Hardware

For free fall, pendulum, spring-mass, projectile motion, and kinematics experiments using computer vision.

Essential Components

ComponentSpecificationPurpose
WebcamUSB webcam, 30 fps minimum (60 fps preferred), 720p or higherObject tracking and motion capture
ComputerWindows/Mac/Linux with USB port, 4GB RAM minimumRunning Python scripts and analysis
Colored ObjectsHigh-saturation colors (orange, yellow, pink, green)Easy HSV color detection and tracking
Reference MarkersTriangular or rectangular colored markersHomography calibration for pixel-to-meter conversion
Good LightingUniform lighting, avoid shadows and backlightingConsistent color detection

Experiment-Specific Hardware

Free Fall
  • Small colored ball (ping pong ball or similar)
  • Measuring tape to calibrate distance
  • Height: 1-2 meters recommended
Pendulum
  • String or fishing line (low mass, non-elastic)
  • Colored pendulum bob (20-100g mass)
  • Fixed pivot point (hook, stand)
  • Measuring tape for length calibration (0.5-1.5m lengths work well)
Spring-Mass System
  • Helical spring (k ≈ 1-10 N/m for visible oscillations)
  • Known mass (50-500g)
  • 3 colored markers forming isosceles triangle for calibration
  • Vertical support frame
Projectile Motion
  • Launcher (manual or mechanical)
  • Projectile with colored marker
  • 4 colored markers forming rectangle for homography
  • Launch angles 20-70° recommended
Kinematics (Camera)
  • Moving colored object
  • Linear track or guided motion (optional)
  • Reference markers for calibration

Camera Resolution & Frame Rate Guidelines

Higher frame rates are critical for fast-moving experiments:
  • Free fall: 30 fps minimum, 60 fps recommended
  • Projectile motion: 60 fps strongly recommended
  • Pendulum & spring-mass: 30 fps sufficient
  • Slow kinematics: 15-30 fps sufficient
The code automatically measures actual camera FPS:
# From FreeFallCam.py - automatic FPS detection
fps_from_cap = cap.get(cv2.CAP_PROP_FPS)
num_test_frames = 60
start = time.time()
for i in range(num_test_frames):
    ret, frame = cap.read()
end = time.time()
measured_fps = num_test_frames / (end - start)
real_fps = min(fps_from_cap, measured_fps)

Option 2: Microcontroller-Based Experiments

ESP32 Setup

For high-precision timing and sensor-based measurements.

Essential Components

ComponentSpecificationWhere to Buy
ESP32 Dev BoardESP32-WROOM-32 or ESP32-DevKitC, 240MHz dual-coreAmazon, AliExpress, local electronics
USB CableMicro-USB or USB-C (depending on board)Included with most boards
Breadboard830 points minimumElectronics suppliers
Jumper WiresMale-to-male and male-to-female assortmentElectronics suppliers
Power Supply5V via USB (500mA minimum)USB power adapter or computer USB

Experiment-Specific Sensors

Free Fall Timing Two approaches available:
  • 2x IR Break Beam Sensors: Transmitter + receiver pairs
  • Pins Used: GPIO 18 (start), GPIO 5 (end)
  • Resolution: Microsecond timing precision
  • Range: 5-30 cm beam distance
  • Cost: ~$5-10 per pair
Kinematics (Distance Sensors)
  • Sensor: Adafruit VL53L0X or compatible
  • Range: 5-200 cm accurate measurement
  • Interface: I2C (pins 21=SDA, 22=SCL)
  • Interrupt Pin: GPIO 27
  • Update Rate: ~5 Hz (200ms intervals)
  • Library: Adafruit_VL53L0X
  • Advantages: High accuracy, not affected by object color
  • Cost: ~$15
Both sensor approaches include advanced filtering:
  • Exponential Moving Average (EMA)
  • 2nd-order Butterworth low-pass filter
  • α-β filter for position and velocity estimation

Arduino Libraries Required

#include <Arduino.h>           // Core Arduino functions
#include <Wire.h>              // I2C communication
#include <Adafruit_VL53L0X.h> // VL53L0X sensor (if using ToF)
#include "driver/dac.h"        // ESP32 DAC (oscilloscope/generator)
Install via Arduino Library Manager:
  • Adafruit VL53L0X (for kinematics with ToF sensor)
  • ESP32 board definitions (via Boards Manager)

Option 3: Audio-Based Experiments

Sound Detection Setup

For free fall experiments using acoustic impact detection.

Required Hardware

ComponentSpecificationNotes
ComputerAny with audio inputBuilt-in mic often sufficient
Microphone3.5mm jack or USB micHeadphones with mic work well
Sound SourceBouncing ball or dropping objectShould create clear impact sounds
Quiet EnvironmentLow background noiseCritical for threshold detection

Audio Setup Parameters

SAMPLE_RATE = 44100      # Standard audio sample rate
BLOCK_SIZE = 8           # Small buffer for low latency
THRESHOLD = 0.65         # RMS threshold for event detection
DEVICE_INDEX = 0         # Audio input device
The system includes:
  • Real-time RMS level monitoring
  • Latency compensation (estimated from block size)
  • Visual feedback during measurement
  • Accept/reject interface for data quality control
Test your microphone sensitivity before experiments:
device_info = sd.query_devices(DEVICE_INDEX)
print(f"Using: {device_info['name']}")
Adjust THRESHOLD based on ambient noise levels.

Bonus: Oscilloscope & Signal Generator

Lab Instrument Setup

Build a dual-channel oscilloscope and arbitrary waveform generator.

Hardware Requirements

ComponentPin ConnectionsFunction
ESP32Standard dev boardCore processor
DAC OutputsGPIO 25 (CH1), GPIO 26 (CH2)Signal generation (0-3.3V)
ADC InputsGPIO 34 (CH1), GPIO 35 (CH2)Signal measurement
USB ConnectionVia built-in USBSerial communication at 115200 baud

Optional: WebSocket Mode

  • WiFi Connection: ESP32 connects to local network
  • Communication: WebSocket protocol for lower latency
  • Advantages: Wireless operation, potentially faster streaming

Capabilities

Signal Generator:
  • Waveforms: Sine, square, triangle, sawtooth, DC
  • Frequency range: 0.1 Hz - 10 kHz
  • Amplitude control: 0-255 (8-bit DAC)
  • Offset control: 0-255
  • Sample rate: 40 kHz
  • Independent dual channels
Oscilloscope:
  • Dual ADC channels (12-bit)
  • Sample rate: 200 samples/second (configurable)
  • Input range: 0-3.3V
  • Real-time streaming via serial
  • Python GUI with FFT analysis

Next Steps

Installation Guide

Follow step-by-step instructions to install all required software

Choose Your First Experiment

Start with a simple free fall experiment

Build docs developers (and LLMs) love