Team 6

Pendulum Simulator

Build an app that simulates a simple pendulum — calculates time period, frequency, and angular velocity for different lengths and gravitational values.

🎯 Learning Goals

  • ▹ Understand the parameters of Simple Harmonic Motion (SHM)
  • ▹ Analyze how gravity (g) affects periodic movement
  • ▹ Perform comparative studies across different planetary gravities
  • ▹ Implement real-time physics simulators using Clock timers

🌎 Why This Matters

Pendulums were our first way to accurately tell time and move toward modern synchronicity. Today, they are used in seismometers to detect earthquakes and in sensors that keep tall buildings from swaying too much in the wind.

📖Understanding Simple Pendulum & SHM

Theory Masterclass
"

A simple pendulum is a mass (called a bob) suspended from a fixed point by a string. When displaced and released, it swings back and forth — this is called Simple Harmonic Motion (SHM). Key Terms: Time Period (T): Time for one complete swing (back and forth). Measured in seconds. Frequency (f): Number of complete swings per second. f = 1/T. Measured in Hertz (Hz). Length (L): Length of the string from pivot to center of bob. g: Gravitational acceleration (9.8 m/s² on Earth) The Formula: T = 2π√(L/g) Important Observations: • T depends on L and g only — NOT on the mass of the bob! • Longer string → slower swing (larger T) • Stronger gravity → faster swing (smaller T) • On the Moon (g = 1.62 m/s²), a pendulum swings much slower • On Jupiter (g = 24.79 m/s²), it swings much faster Angular Frequency: ω = 2π/T = √(g/L) (in rad/s) Maximum Velocity: v_max = ω × A (where A is amplitude) Restoring Force: F = -mg sin(Ξ) ≈ -mgΞ (for small angles)

Mathematical Foundation

fxTime Period: T = 2π√(L/g)
fxFrequency: f = 1/T
fxAngular Frequency: ω = 2π/T = √(g/L)
fxMax Velocity: v_max = ω × Amplitude
fxRestoring Force: F = -mg sin(Ξ)

🎚Part A — Designer View (UI Design)

Open MIT App Inventor → Switch to Designer view. Follow each step below to build the interface.

1

1. Common Setup

• Set **Screen1** title to "Pendulum Sim". • Set **AlignHorizontal** to Center.

2

2. Input Fields

• Drag 2 **TextBoxes** renamed: 'LengthTxt' and 'GravityTxt'. • Set both to **NumbersOnly**. • Give hints: "Length (meters)" and "Gravity (9.8)".

3

3. Action Button

• Drag a **Button** renamed 'CalcTBtn'. • Set text to "FIND TIME PERIOD". • Change **BackgroundColor** to Light Blue.

4

4. Result Display

• Drag a **Label** renamed 'ResultLbl'. • Set **TextColor** to Red and **FontSize** to 22.

🧩Part B — Blocks View (Logic & Calculation)

Switch to Blocks view. Now add the logic that makes your app actually work.

1

1. Switch to Blocks

• Look at the top right of your screen. • Click the **Blocks** button to leave the Designer and open the logic space.

2

2. The Pendulum Formula

• Formula: T = 2 * 3.14 * sqrt(L / g). • Click **CalcTBtn** (Gold). Drag out 'when CalcTBtn.Click'. • Click **ResultLbl**. Drag the green 'set ResultLbl.Text to' block and snap it inside. • Go to the **Math** drawer (Blue). Drag out the '*' (multiplication) and 'sqrt' (square root) blocks.

3

3. Snapping it Together

• Snap the Blue blocks together to create: 2 * 3.14 * sqrt([LengthTxt.Text] / [GravityTxt.Text]). • Use the division '/' block from **Math** (Blue) inside the square root.

4

4. Adding Units

• Go to the **Text** drawer (Bright Pink). Drag a 'join' block. • Join your math result with the text " seconds". • This makes the result display as "2.0 seconds" on your phone.

🧪Testing Your App

  • ✓L=1m on Earth → T ≈ 2.006s (the classic 1-meter pendulum)
  • ✓L=0.25m on Earth → T ≈ 1.003s (seconds pendulum)
  • ✓Moon pendulum is ~2.46× slower than Earth
  • ✓Doubling L multiplies T by √2 ≈ 1.414
  • ✓Mass should have ZERO effect on T

🚀Bonus Challenges

Extra credit — impress your instructor

  • ★Create a smooth pendulum animation using Canvas and Clock
  • ★Add a stopwatch to let students time a real pendulum and compare
  • ★Plot T vs L graph for different lengths on Canvas
  • ★Add a 'Find g' mode: enter T and L, calculate g (for lab experiments)