Team 4

Optics & Lens Calculator

Build an app that uses the lens formula and mirror formula to find image distance, magnification, and determines the nature of the image (real/virtual, inverted/upright, magnified/diminished).

🎯 Learning Goals

  • β–Ή Master the Lens and Mirror equations (1/f = 1/v Β± 1/u)
  • β–Ή Apply Sign Convention rules accurately
  • β–Ή Understand Image properties and Magnification
  • β–Ή Build multi-mode tools for different optical components

🌎 Why This Matters

Optical physics is why we have cameras, microscopes, telescopes, and corrective eyeglasses. Every time you take a photo on your phone, the device is using these exact formulas to focus the image on the sensor.

πŸ“–Understanding Optics β€” Lenses & Mirrors

Theory Masterclass
"

Optics is the branch of physics that studies light and its behavior with mirrors and lenses. Lens Formula: 1/v - 1/u = 1/f Mirror Formula: 1/v + 1/u = 1/f Where: u = Object distance (always negative for real objects in sign convention) v = Image distance f = Focal length (positive for convex lens/concave mirror, negative for concave lens/convex mirror) Sign Convention (New Cartesian): - All distances measured from the optical center/pole - Direction of incident light is positive - Object distance (u) is always negative (object is on the left) Magnification: For lens: m = v/u For mirror: m = -v/u Nature of Image: |m| > 1 β†’ Magnified (image is bigger) |m| < 1 β†’ Diminished (image is smaller) |m| = 1 β†’ Same size m > 0 β†’ Erect (upright) m < 0 β†’ Inverted v > 0 β†’ Real image (lens) / Virtual image (mirror) v < 0 β†’ Virtual image (lens) / Real image (mirror)

Mathematical Foundation

fxLens: 1/v - 1/u = 1/f
fxMirror: 1/v + 1/u = 1/f
fxMagnification (lens): m = v/u
fxMagnification (mirror): m = -v/u
fxPower of lens: P = 1/f (in diopters, f in meters)

🎨Part A β€” Designer View (UI Design)

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

1

Set up with type selector

Title: "Optics Calculator" Add HorizontalArrangement: "Lens" and "Mirror" toggle buttons. Add a sub-selector: "Convex" and "Concave" buttons.

2

Create input section

Label: "Enter any TWO values (leave one empty to find it)" TextBox: "Object distance u (cm)" β€” Hint: "e.g., -30" TextBox: "Image distance v (cm)" TextBox: "Focal length f (cm)" Note: Remind students about sign convention in a Label.

3

Add Calculate button

Big "Calculate" button. Below it, add a "Sign Convention Guide" button that shows a popup explaining the rules.

4

Create results display

Labels for: - ImageDistanceLabel: "v = __ cm" - MagnificationLabel: "m = __" - NatureLabel: "Real / Virtual" - OrientationLabel: "Inverted / Erect" - SizeLabel: "Magnified / Diminished / Same size" - PowerLabel: "Power = __ diopters"

🧩Part B β€” Blocks View (Logic & Calculation)

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

1

Determine which value to calculate

When CalculateButton.Click: Check which TextBox is empty: - If u is empty β†’ Calculate u from v and f - If v is empty β†’ Calculate v from u and f - If f is empty β†’ Calculate f from u and v

2

Lens formula calculation

If mode = "Lens": 1/v - 1/u = 1/f To find v: 1/v = 1/f + 1/u β†’ v = 1/(1/f + 1/u) To find u: 1/u = 1/v - 1/f β†’ u = 1/(1/v - 1/f) To find f: 1/f = 1/v - 1/u β†’ f = 1/(1/v - 1/u) Check for division by zero at each step!

3

Mirror formula calculation

If mode = "Mirror": 1/v + 1/u = 1/f To find v: 1/v = 1/f - 1/u β†’ v = 1/(1/f - 1/u) To find u: 1/u = 1/f - 1/v β†’ u = 1/(1/f - 1/v) To find f: 1/f = 1/v + 1/u β†’ f = 1/(1/v + 1/u)

4

Calculate magnification

If lens: m = v / u If mirror: m = -(v / u) Display the magnification value.

5

Determine image nature

For Lens: if v > 0 β†’ "Real Image" else β†’ "Virtual Image" For Mirror: if v < 0 β†’ "Real Image" else β†’ "Virtual Image" if m > 0 β†’ "Erect" else β†’ "Inverted" if abs(m) > 1 β†’ "Magnified" if abs(m) < 1 β†’ "Diminished" if abs(m) = 1 β†’ "Same Size"

6

Calculate lens power

If in lens mode: Power = 100 / f (when f is in cm, convert to meters by dividing by 100) Actually: Power = 1 / (f/100) = 100/f Display: "Power = " + P + " diopters" Positive power = converging lens Negative power = diverging lens

7

Sign Convention helper

When SignConventionButton.Click: Show Notifier with message: "SIGN CONVENTION: - Object distance (u) is always NEGATIVE - Focal length: POSITIVE for convex lens/concave mirror - Focal length: NEGATIVE for concave lens/convex mirror - Measure all distances from the center of the lens/mirror"

πŸ§ͺTesting Your App

  • βœ“Convex lens: u=-30, f=15 β†’ v=30, m=-1 (real, inverted, same size)
  • βœ“Convex lens: u=-20, f=15 β†’ v=60, m=-3 (real, inverted, magnified)
  • βœ“Convex lens: u=-10, f=15 β†’ v=-30, m=3 (virtual, erect, magnified)
  • βœ“Concave mirror: u=-20, f=-15 β†’ check the nature of image
  • βœ“Object at 2f: image at 2f, same size, real, inverted

πŸš€Bonus Challenges

Extra credit β€” impress your instructor

  • β˜…Draw a ray diagram on Canvas showing the object, lens/mirror, and image
  • β˜…Add a mode for two thin lenses in contact: 1/f = 1/f₁ + 1/fβ‚‚
  • β˜…Create a table showing image positions for objects at F, 2F, ∞, etc.
  • β˜…Add Snell's Law calculator: n₁sinθ₁ = nβ‚‚sinΞΈβ‚‚