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

1. Screen Basics

β€’ In the **Properties** panel (right) for **Screen1**. β€’ Set **Title** to "Optics Solver". β€’ Set **AlignHorizontal** to Center. β€’ Set **BackgroundColor** to dark grey.

2

2. Input Fields

β€’ Drag 2 **TextBoxes** renamed: 'ObjectDistTxt' and 'FocalLenTxt'. β€’ Set each to **NumbersOnly**. β€’ Give them hints: "Object Distance (u)", "Focal Length (f)".

3

3. Action Button

β€’ Drag a **Button** renamed 'CalcBtn'. Set text to "FIND IMAGE DISTANCE". β€’ Change **BackgroundColor** to Cyan.

4

4. Result Display

β€’ Drag a **Label** to the bottom. β€’ Rename to 'ResultLbl'. β€’ Set **FontSize** to 22 and **TextColor** to White.

🧩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

β€’ Click the **Blocks** button at the top right of your screen.

2

2. The Lens Calculation

β€’ Formula: v = (f * u) / (f + u). β€’ Click **CalcBtn** (Gold). Drag 'when CalcBtn.Click'. β€’ Click **ResultLbl**. Drag the green 'set ResultLbl.Text to' and snap it inside. β€’ From **Math** (Blue), get the '/' and '*' blocks. β€’ Logic: ([FocalLenTxt.Text] * [ObjectDistTxt.Text]) / ([FocalLenTxt.Text] + [ObjectDistTxt.Text]).

3

3. Real or Virtual Decision

β€’ Go to the **Control** drawer (Orange). Drag 'if...then...else'. β€’ If the answer is positive (v > 0), 'set ResultLbl.Text to "REAL IMAGE"'. β€’ Use a comparison block from the **Math** drawer for 'v > 0'.

πŸ§ͺ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ΞΈβ‚‚