Ohm's Law & Circuit Calculator
Build an app that calculates voltage, current, and resistance using Ohm's Law. Also handles series and parallel resistance combinations and power dissipation.
🎯 Learning Goals
- ▹ Understand relationship between V, I, and R
- ▹ Master the difference between Series and Parallel circuits
- ▹ Calculate Power dissipation and energy usage
- ▹ Implement 'smart' calculators that solve for missing variables
🌎 Why This Matters
Electricity powers our world. Whether it's the charger for your phone or the wiring in your house, engineers use Ohm's Law to ensure components don't melt and circuits run efficiently. This app is a tool for every electrician and electronics engineer.
📖Understanding Ohm's Law & Circuits
Theory MasterclassOhm's Law is the most fundamental equation in electricity: V = I × R Where: V = Voltage (in Volts) — the "push" that drives current I = Current (in Amperes) — the flow of electric charge R = Resistance (in Ohms, Ω) — how much the material opposes current flow From V = IR, we can derive: I = V / R (find current given voltage and resistance) R = V / I (find resistance given voltage and current) Power: P = V × I = I²R = V²/R (in Watts) Series Resistance (resistors in a line): R_total = R₁ + R₂ + R₃ + ... Current is SAME through all, voltage DIVIDES. Parallel Resistance (resistors side by side): 1/R_total = 1/R₁ + 1/R₂ + 1/R₃ + ... Voltage is SAME across all, current DIVIDES. For 2 resistors in parallel: R_total = (R₁ × R₂) / (R₁ + R₂)
Mathematical Foundation
🎨Part A — Designer View (UI Design)
Open MIT App Inventor → Switch to Designer view. Follow each step below to build the interface.
1. Screen Basics
• In the **Properties** panel (right) for **Screen1**. • Set **Title** to "Ohm's Law Calculator". • Set **AlignHorizontal** to Center. • Set **BackgroundColor** to dark grey.
2. Input Fields
• Drag 3 **TextBoxes** renamed: 'VoltTxt', 'CurrTxt', 'ResistTxt'. • Set each to **NumbersOnly**. • Give them hints: "Voltage (V)", "Current (I)", "Resistance (R)".
3. Action Buttons
• Drag a **HorizontalArrangement**. • Drag 3 **Buttons** inside. • Rename: 'CalcVBtn', 'CalcIBtn', 'CalcRBtn'. • Set text to "Find V", "Find I", "Find R".
4. Result Display
• Drag a **Label** to the bottom. • Rename to 'ResultLbl'. • Set **FontSize** to 22 and **TextColor** to Yellow.
🧩Part B — Blocks View (Logic & Calculation)
Switch to Blocks view. Now add the logic that makes your app actually work.
1. Switch to Blocks
• Look at the top right of the Designer screen. • Click the **Blocks** button to start creating your app's logic.
2. The Ohm's Law Logic
• Click **CalcVBtn** (Gold). Drag 'when CalcVBtn.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 '*' block. • Snap [VoltTxt.Text] and [CurrTxt.Text] into the '*' slots.
3. Finding Current and Resistance
• To find Current (I), divide Voltage by Resistance. • Go to **Math** (Blue). Drag the '/' (division) block. • [set ResultLbl.Text to] [VoltTxt.Text] / [ResistTxt.Text].
4. Adding Units to the Result
• Go to the **Text** drawer (Bright Pink). Drag a 'join' block. • Connect [your answer] with a text string like " Volts" or " Ohms".
🧪Testing Your App
- ✓V=12, I=2 → R=6Ω, P=24W
- ✓V=220, R=100 → I=2.2A, P=484W (typical home appliance)
- ✓Series: 10Ω + 20Ω + 30Ω = 60Ω
- ✓Parallel: 10Ω || 10Ω = 5Ω (half of each)
- ✓Parallel: 6Ω || 3Ω = 2Ω
🚀Bonus Challenges
Extra credit — impress your instructor
- ★Draw a simple circuit diagram on Canvas (battery, resistor symbols)
- ★Add a 'Color Code Calculator' — read resistor color bands
- ★Add Kirchhoff's Voltage Law (KVL) for a simple loop
- ★Calculate cost of electricity: kWh × rate