4  Electricity Fundamentals: Ohm’s Law

4.1 Learning Objectives

  • Master Ohm’s Law (V = I x R) and power equations (P = V x I) to analyze voltage, current, resistance, and power in IoT circuits
  • Calculate LED current-limiting resistor values, battery life estimates, fuse ratings, and voltage dividers for microcontroller interfaces
  • Derive all 12 Ohm’s Wheel formulas for calculating electrical parameters from any two known values and apply the reference in circuit troubleshooting
  • Apply electrical calculations to real-world IoT scenarios including motor control, smart home devices, and solar-powered systems
  • Evaluate critical design factors for IoT hardware including wire gauge selection, component power ratings, and thermal management
In 60 Seconds

Ohm’s Law (V = I x R) is the single most important equation in IoT hardware design. It connects voltage, current, and resistance, enabling you to calculate LED resistor values, battery life, fuse ratings, and power consumption for any IoT device.

Key Concepts
  • Ohm’s Law: V = I x R: voltage equals current times resistance; rearranges to I = V/R (current) and R = V/I (resistance); the fundamental relationship governing all resistive circuits
  • Power Law: P = V x I = I^2 x R = V^2 / R: power dissipated in a resistive element; used to select component power ratings and estimate battery consumption
  • Series Resistance: Resistors in series add directly: Rtotal = R1 + R2 + R3; current is identical through all series components; voltage divides proportionally across each resistor
  • Parallel Resistance: Resistors in parallel: 1/Rtotal = 1/R1 + 1/R2 + 1/R3; voltage is identical across all parallel branches; current divides inversely proportional to resistance
  • Kirchhoff’s Voltage Law (KVL): The sum of all voltage rises and drops around any closed loop equals zero; used to verify circuit analysis and set up equations for multi-loop circuits
  • Kirchhoff’s Current Law (KCL): The sum of all currents entering a node equals the sum leaving it; current is conserved — none is created or destroyed at any junction
  • Voltage Divider Rule: In a series resistor chain, each resistor drops a fraction of the total voltage: V_R1 = Vtotal x R1 / (R1 + R2); used to calculate bias voltages and interface signal levels
  • LED Current Limiting: An LED requires a series resistor to limit current: R = (Vsupply - Vf) / If; without this resistor, the LED draws unlimited current from the supply and burns out within milliseconds

Ohm’s Law is the single most useful equation in electronics: Voltage equals Current times Resistance (V = I x R). Think of electricity like water flowing through pipes – voltage is the water pressure, current is how much water flows, and resistance is how narrow the pipe is. With this one simple formula, you can calculate things like what size resistor to use with an LED or how long a battery will last powering your IoT device.

⏱️ ~15 min | ⭐⭐ Intermediate | 📋 P06.C04.U06

Ohm’s Law describes the fundamental relationship between voltage, current, and resistance.

4.1.1 The Basic Equation

\[I = \frac{V}{R}\]

Where: - I = Current (Amperes) - V = Voltage (Volts) - R = Resistance (Ohms)

Interpretation:

  • ⬆️ Voltage increases → ⬆️ Current increases (direct proportion)
  • ⬆️ Resistance increases → ⬇️ Current decreases (inverse proportion)

4.1.2 Derived Equations

From Ohm’s Law, we can derive:

\[V = I \times R\]

\[R = \frac{V}{I}\]

4.1.3 Ohm’s Wheel

The Ohm’s Wheel is a visual tool showing all relationships between V, I, R, and P (power). Cover the unknown variable to reveal the formula:

Circular Ohm's Wheel reference chart divided into four quadrants for Voltage, Current, Resistance, and Power, showing all 12 possible calculation formulas by covering the unknown variable to reveal the equation using the other two known values
Figure 4.1: Ohm Wheel for voltage, current, resistance relationships

4.1.4 🧪 Interactive Lab: Ohm’s Law Circuit Demonstration

🎮 Try It Yourself: Experiment with Ohm’s Law

What you’ll do: Build a simple LED circuit and see how changing voltage and resistance affects current and brightness.

What you’ll learn:

  • How voltage, current, and resistance interact in real circuits
  • Why resistors are needed to protect LEDs
  • How to calculate proper resistor values using Ohm’s Law

Estimated time: 10 minutes

🎯 Interactive Challenges:

Try these experiments to deepen your understanding:

  1. Current Measurement Challenge: Calculate the current through the LED using Ohm’s Law, then verify with the ammeter
    💡 Hint Formula: I = V / R. With 5V supply and 220Ω resistor: I = (5V - 2V LED drop) / 220Ω ≈ 13.6 mA. Check if the simulation matches!
  2. Resistor Selection Challenge: The LED datasheet says maximum current is 20 mA. Calculate the minimum resistor value needed
    💡 Hint Rearrange Ohm’s Law: R = V / I = (5V - 2V) / 0.02A = 150Ω. So use at least 150Ω to protect the LED.
  3. Brightness Control Challenge: Try different resistor values (100Ω, 330Ω, 1kΩ). What happens to LED brightness and why?
    💡 Hint Higher resistance = lower current = dimmer LED. Verify by calculating current for each resistor value using Ohm’s Law.
  4. Voltage Drop Challenge: Measure the voltage across the resistor and across the LED. Do they sum to 5V? Why?
    💡 Hint This demonstrates Kirchhoff’s Voltage Law (KVL): In any closed loop, voltages must sum to zero. V_supply = V_resistor + V_LED.

📊 What’s happening:

  • The 5V power supply provides electrical pressure
  • The 220Ω resistor limits current flow (Ohm’s Law: I = V/R)
  • The LED converts electrical energy to light (typical forward voltage ~2V)
  • Without the resistor, excessive current would destroy the LED
  • This is the fundamental circuit pattern for all LED indicators in IoT devices

Real-World Applications:

  • Every status LED on IoT devices uses this exact circuit
  • Raspberry Pi GPIO pins can only supply 16 mA safely—Ohm’s Law helps you calculate the right resistor
  • Smart home light dimmers use variable resistance (or PWM) to control brightness

4.2 Electronic Components

4.2.1 Capacitors

Variety of capacitor types including large electrolytic cylindrical capacitors with polarity markings, ceramic disc capacitors, small tantalum capacitors, film capacitors, and surface-mount capacitors showing different sizes and voltage ratings
Figure 4.2: Capacitors and their types

4.2.2 Inductors

Different inductor types including toroidal inductors with wire windings, axial inductors with color bands, surface-mount chip inductors, power inductors with ferrite cores, and variable inductors showing physical construction and pin configurations
Figure 4.3: Inductors and their applications

4.2.3 Component Comparison

Comprehensive comparison table showing resistors, capacitors, and inductors side-by-side with their electrical properties, units of measurement, schematic symbols, typical applications, and characteristic behaviors in DC and AC circuits
Figure 4.4: Comparison table of capacitors, inductors, and resistors

4.3 Ohm’s Law: Complete Reference

⏱️ ~20 min | ⭐⭐⭐ Advanced | 📋 P06.C04.OHMS-REF

The Ohm’s Wheel provides all 12 possible formulas for calculating voltage (V), current (I), resistance (R), and power (P) when any two values are known. This is the most comprehensive reference you’ll need for electrical calculations in IoT systems.

4.3.1 The Complete Formula Table

Ohm's Wheel circular reference chart divided into four quadrants for Voltage (V), Current (I), Resistance (R), and Power (P), showing all 12 possible calculation formulas by covering the unknown variable to reveal the equation using the other two known values
Figure 4.5: Ohm’s Wheel: Cover the unknown variable to reveal the formula using the two known values.

Enter any two known values to calculate all others:

All 12 Formula Derivations:

Known Values Find V Find I Find R Find P
V, I - - V/I V×I
V, R - V/R - V²/R
V, P - P/V V²/P -
I, R I×R - - I²×R
I, P P/I - P/I² -
R, P √(P×R) √(P/R) - -

Step 1: Identify which two values you know (e.g., voltage and resistance)

Step 2: Locate the quadrant for the value you want to find (e.g., current)

Step 3: “Cover” the unknown value on the wheel—the remaining symbols show the formula

Example: To find current (I) when you know voltage (V) and resistance (R): - Cover I in the wheel - You see V/R - Formula: I = V/R

4.3.2 Worked Examples with Real IoT Applications

🔌 Example 1: Electric Heater (Finding Current and Resistance)

Scenario: You’re designing a heated enclosure for an outdoor IoT sensor. The heating element needs to produce 1440W to maintain temperature in freezing conditions.

Given:

  • Supply voltage: V = 120V AC
  • Required power: P = 1440W

Find: Current draw and required resistance

Solution:

Step 1: Find current using P and V

From the Ohm’s Wheel: When you know P and V, to find I:

\[I = \frac{P}{V} = \frac{1440W}{120V} = 12A\]

Step 2: Find resistance using V and P

From the Ohm’s Wheel: When you know V and P, to find R:

\[R = \frac{V^2}{P} = \frac{(120V)^2}{1440W} = \frac{14400}{1440} = 10Ω\]

Step 3: Verify using V and I

Double-check using Ohm’s basic law:

\[R = \frac{V}{I} = \frac{120V}{12A} = 10Ω\]

Practical Implications:

  • Wire gauge: 12A continuous requires 14 AWG minimum (rated 15A)
  • Circuit protection: Use 15A circuit breaker with 20% safety margin
  • Power rating: Heating element must be rated ≥1440W (use 1500W or 2000W rated element)
  • Energy cost: At $0.12/kWh, running 24/7 = 1.44 kW × 24 h × $0.12 = $4.15/day

IoT System Design:

  • Add temperature sensor (DS18B20) to enable smart control
  • Implement duty cycling: ON 15 min, OFF 45 min → Reduce energy cost by 75%
  • Use SSR (Solid State Relay) rated ≥15A for switching
⚡ Example 2: DC Motor (Finding Power and Resistance)

Scenario: You’re selecting a DC motor for an automated pet feeder IoT device. The motor needs to operate from a 12V battery pack.

Given:

  • Supply voltage: V = 12V DC
  • Current draw at full load: I = 10A

Find: Power consumption and motor resistance

Solution:

Step 1: Find power using V and I

From the Ohm’s Wheel: When you know V and I, to find P:

\[P = V \times I = 12V \times 10A = 120W\]

Step 2: Find resistance using V and I

From the Ohm’s Wheel: When you know V and I, to find R:

\[R = \frac{V}{I} = \frac{12V}{10A} = 1.2Ω\]

Step 3: Verify using I and R

Double-check using power formula:

\[P = I^2 \times R = (10A)^2 \times 1.2Ω = 100 \times 1.2 = 120W\]

Practical Implications:

  • Battery capacity: With 12V 7Ah battery: Runtime = 7Ah / 10A = 42 minutes at full load
  • Heat dissipation: Motor generates 120W of heat at stall—ensure adequate ventilation
  • Starting current: Expect 3-5× inrush current (30-50A) for ~100ms during startup
  • Efficiency: Typical DC motor is 70-80% efficient → Mechanical power ≈ 85-96W

IoT System Design:

  • Use MOSFET (IRLZ44N rated 50A) or motor driver (L298N rated 2A per channel, dual for 4A total—insufficient, use BTS7960 rated 43A instead)
  • Add current sensing (ACS712 20A module) for fault detection
  • Implement soft-start: PWM ramping from 0% to 100% over 500ms to reduce inrush
  • Monitor motor current—if exceeds 12A, indicates mechanical jam or motor failure
🏠 Example 3: Vacuum Cleaner (Finding Current and Fuse Selection)

Scenario: You’re developing a smart home IoT plug that monitors and controls a vacuum cleaner. You need to select the appropriate fuse rating.

Given:

  • Vacuum cleaner rating: P = 500W
  • Supply voltage: V = 120V AC

Find: Current draw and minimum fuse rating

Solution:

Step 1: Find current using P and V

From the Ohm’s Wheel: When you know P and V, to find I:

\[I = \frac{P}{V} = \frac{500W}{120V} = 4.17A\]

Step 2: Select fuse rating

Fuse selection rule: Choose fuse rated ≥125% of continuous current (NEC Article 240.4)

\[I_{fuse} = I_{load} \times 1.25 = 4.17A \times 1.25 = 5.21A\]

Fuse requirement: Use 5A fuse (standard rating)

Step 3: Verify using standard fuse ratings

Standard fuse ratings: 1A, 2A, 3A, 5A, 7A, 10A, 15A, 20A…

  • 3A fuse: Too small (3A < 5.21A) → Will blow during normal operation ✗
  • 5A fuse: Adequate (5A ≥ 5.21A with minimal margin) → Acceptable for steady load ✓
  • 7A fuse: Better safety margin → Recommended for inrush current tolerance ✓
  • 10A fuse: Oversized → Won’t protect against overload conditions ✗

Practical Implications:

  • Startup surge: Vacuum motors draw 5-10× running current for 50-200ms during startup
    • Running current: 4.17A
    • Inrush current: 4.17A × 7 ≈ 29A (typical)
  • Fuse type selection:
    • Fast-blow (F) fuse: 5A rated will likely blow on startup due to 29A inrush → ✗ Not suitable
    • Slow-blow (T) fuse: 5A or 7A rated will tolerate brief inrush → ✓ Use this type
    • Recommendation: Use 7A slow-blow fuse for reliable operation

IoT Smart Plug Design:

  • Add inrush current limiter (NTC thermistor 10Ω at 25°C, surge rating 50A)
  • Monitor power consumption in real-time: P = V × I (update every 100ms)
  • Detect faults:
    • Current >10A continuous → Overload condition → Disconnect
    • Current <1A → Motor stalled or low suction → Alert user
    • Power factor <0.6 → Inefficient operation or motor failure
  • Energy reporting: Calculate kWh consumption: E = P × t = 0.5 kW × t (hours)

Real-World Calculation Example:

  • Usage: 30 minutes per day
  • Daily energy: E = 0.5 kW × 0.5 h = 0.25 kWh
  • Monthly energy: 0.25 kWh × 30 days = 7.5 kWh
  • Monthly cost: 7.5 kWh × $0.12/kWh = $0.90/month

4.3.3 Quick Reference: Common IoT Component Calculations

📊 Typical Values for IoT Devices
Component Typical Voltage Typical Current Power Notes
ESP32 (Wi-Fi active) 3.3V 160-260 mA 0.5-0.9W Peaks at 500mA during TX
Arduino Uno 5V 50 mA (idle) 0.25W Excludes external peripherals
Raspberry Pi 4 5V 600 mA (idle) - 1.2A (load) 3-6W Requires 3A rated supply
Status LED (red) 2V (forward drop) 10-20 mA 0.02-0.04W With current-limiting resistor
DHT22 (temp/humidity) 3.3-5V 1-2.5 mA 0.003-0.0125W During measurement
Servo motor (SG90) 5V 100-250 mA (idle) - 1A (stall) 0.5-5W Stall current can damage MCU pins
Relay module (5V) 5V (coil) 70-80 mA 0.35-0.4W Contact rating separate (10A/250VAC typical)
GSM module (SIM800) 3.7-4.2V (LiPo) 300 mA (idle) - 2A (TX burst) 1.1-8.4W Use dedicated power supply, not MCU

Formula to remember:

  • LED resistor calculation: R = (V_supply - V_LED) / I_LED
    • Example: 5V supply, red LED (2V drop), 20mA → R = (5V - 2V) / 0.02A = 150Ω (use 220Ω for safety margin)

4.3.4 Understanding Check

🎯 Application Problem: Smart Garden Irrigation Pump

You’re designing a solar-powered smart irrigation system for a community garden IoT project.

System Specifications:

  • Water pump: 12V DC, rated 40W
  • Solar panel: 18V (peak), 5A (peak)
  • Battery: 12V, 20Ah LiFePO4
  • Charge controller: 12V, 10A PWM

Questions:

  1. What is the pump’s current draw at rated power?
  2. What is the pump motor’s resistance?
  3. How long can the pump run on a full battery before requiring recharge?
  4. The solar panel is under partial cloud cover, producing 12V at 3A. Can it run the pump AND charge the battery simultaneously?
  5. What fuse rating should protect the pump circuit?
💡 Solution & Analysis

1. Pump current draw:

From Ohm’s Wheel (P and V known, find I):

\[I = \frac{P}{V} = \frac{40W}{12V} = 3.33A\]

Answer: The pump draws 3.33A at rated power.


2. Pump motor resistance:

From Ohm’s Wheel (P and V known, find R):

\[R = \frac{V^2}{P} = \frac{(12V)^2}{40W} = \frac{144}{40} = 3.6Ω\]

Verification using I and V:

\[R = \frac{V}{I} = \frac{12V}{3.33A} = 3.6Ω\]

Answer: Motor resistance is 3.6Ω.


3. Battery runtime:

Battery capacity: 20Ah at 12V

Runtime formula: \[t = \frac{\text{Battery Capacity (Ah)}}{\text{Current Draw (A)}} = \frac{20Ah}{3.33A} = 6.0 \text{ hours}\]

Practical adjustment: LiFePO4 batteries should not be discharged below 20% SoC for longevity.

Usable capacity: 20Ah × 0.8 = 16Ah

Practical runtime: \[t_{practical} = \frac{16Ah}{3.33A} = 4.8 \text{ hours}\]

Answer: 6 hours theoretical, 4.8 hours practical (with 20% reserve).


4. Simultaneous pump operation and charging?

Solar panel output:

  • Voltage: 12V (reduced from 18V peak due to clouds)
  • Current: 3A
  • Power: P = V × I = 12V × 3A = 36W

Pump requirement:

  • Power: 40W
  • Current: 3.33A

Analysis:

  • Solar provides: 36W
  • Pump requires: 40W
  • Deficit: 40W - 36W = 4W (must come from battery)

Answer: No, the solar panel cannot run the pump AND charge the battery. In fact, the battery must supplement the solar panel by 4W (0.33A) to keep the pump running.

Current flow:

  • Solar contribution: 3A
  • Battery supplement: 3.33A - 3A = 0.33A (discharging)
  • Net battery current: -0.33A (negative = discharging)

System behavior: The charge controller will draw 0.33A from the battery to make up the 4W shortfall.


5. Fuse rating for pump circuit:

Fuse selection criteria:

  1. Protect against sustained overcurrent
  2. Tolerate motor inrush (3-5× running current for 100-200ms)

Running current: 3.33A

Inrush current estimate: 3.33A × 4 = 13.3A (typical for DC motors)

Fuse sizing rule: 125% of continuous current (NEC guideline)

\[I_{fuse} = 3.33A \times 1.25 = 4.16A\]

Standard fuse ratings: 1A, 2A, 3A, 5A, 7A, 10A…

Selection:

  • 5A slow-blow fuse: Adequate for 3.33A continuous, tolerates 13.3A inrush ✓ Recommended
  • 7A slow-blow fuse: More margin, better for aging motors ✓ Alternative
  • 3A fuse: Too small, will blow on startup ✗

Answer: Use 5A slow-blow (T) fuse (minimum) or 7A slow-blow (recommended for safety margin).


System Design Recommendations:

  1. Solar panel sizing: For reliable operation without battery supplement:
    • Required: 40W pump + 10W charging reserve = 50W minimum
    • Recommended: 60-80W panel to handle efficiency losses (charge controller ~85% efficient)
  2. Battery protection:
    • Add low-voltage disconnect (LVD) at 11V (or charge controller built-in LVD)
    • Prevents over-discharge below 20% SoC
  3. Monitoring:
    • INA219 sensor to measure solar panel voltage/current
    • INA219 sensor to measure battery voltage/current
    • ESP32 to log data and trigger alerts
  4. Energy optimization:
    • Run pump only when solar produces >3.33A (sunlight sufficient)
    • Schedule watering for peak sun hours (10 AM - 2 PM)
    • Use soil moisture sensor to avoid unnecessary watering

4.3.5 IoT-Specific Applications and Calculations

📱 LED Current Limiting for Microcontrollers

Scenario: You’re connecting an LED indicator to an ESP32 GPIO pin. LEDs require current limiting to prevent damage.

Given:

  • ESP32 GPIO output: V_GPIO = 3.3V
  • LED forward voltage: V_LED = 2.0V (typical for red LED)
  • Desired LED current: I_LED = 20mA (standard brightness)

Find: Required resistor value

Solution:

The resistor must drop the excess voltage between the GPIO and the LED:

\[V_{resistor} = V_{GPIO} - V_{LED} = 3.3V - 2.0V = 1.3V\]

Using Ohm’s Law to find the required resistance:

\[R = \frac{V_{resistor}}{I_{LED}} = \frac{1.3V}{0.020A} = 65Ω\]

Standard resistor selection: The closest standard E12/E24 resistor value is 68Ω.

Verification:

With 68Ω, the actual current will be:

\[I_{actual} = \frac{1.3V}{68Ω} = 19.1mA\]

This is close enough to the desired 20mA (within 5%).

Practical Considerations:

LED Color Forward Voltage (V_f) Resistor for 20mA @ 3.3V Resistor for 20mA @ 5V
Red 1.8-2.2V 68Ω 150Ω
Green 2.0-2.4V 56Ω 130Ω
Blue 2.8-3.4V 10Ω-47Ω 100Ω
White 2.8-3.6V 0Ω-47Ω (use 33Ω for safety) 100Ω

Common mistake: Using 5V resistor values with 3.3V systems results in very dim LEDs!

Interactive Circuit Simulation

Practice LED current limiting with Tinkercad — no hardware needed!

Open in Tinkercad →{target=“_blank”}

What to try:

  1. Build: 5V power → 150Ω resistor → Red LED (Vf=2V) → ground
  2. Calculate expected current: \(I = \frac{5V - 2V}{150\Omega} = 20mA\)
  3. Use the multimeter in the simulator to measure actual current
  4. Try different LEDs (green, blue, white) and observe how different forward voltages affect brightness
  5. Replace the 150Ω resistor with 330Ω and observe the LED dims (current drops to ~9mA)

Tinkercad lets you drag-and-drop components onto a virtual breadboard and run the circuit in your browser. It’s free and requires no installation.

🔋 Battery Life Calculation

Scenario: Calculating how long a battery-powered IoT sensor will last.

Formula:

\[\text{Battery Life (hours)} = \frac{\text{Battery Capacity (mAh)}}{\text{Average Current Draw (mA)}}\]

Example: ESP32 deep sleep application

Given:

  • Battery: 18650 Li-Ion cell, 3000 mAh
  • Deep sleep current: 0.15 mA (ESP32 hibernation mode)
  • Wake-up every 10 minutes to read sensor and transmit
  • Active current during wake: 160 mA (Wi-Fi TX)
  • Active time per wake: 5 seconds

Find: Battery life in days

Solution:

Step 1: Calculate average current

Time breakdown per 10-minute cycle (600 seconds): - Deep sleep: 595 seconds @ 0.15 mA - Active: 5 seconds @ 160 mA

Average current using weighted average:

\[I_{avg} = \frac{(595s \times 0.15mA) + (5s \times 160mA)}{600s}\]

\[I_{avg} = \frac{89.25 + 800}{600} = \frac{889.25}{600} = 1.48 \text{ mA}\]

Step 2: Calculate battery life

\[\text{Battery Life} = \frac{3000 \text{ mAh}}{1.48 \text{ mA}} = 2027 \text{ hours} = 84.5 \text{ days}\]

Step 3: Apply practical derating (80% usable capacity, temperature effects, aging):

\[\text{Practical Life} = 84.5 \times 0.80 = 67.6 \text{ days (≈2.2 months)}\]

Answer: Approximately 67 days of operation on a single battery charge.

Optimization tip: Increasing sleep interval to 30 minutes would triple battery life to ~200 days!

🔌 Voltage Divider for Level Shifting

Scenario: Reading a 5V sensor output with a 3.3V ADC (e.g., ESP32).

Given:

  • Sensor output: 5V maximum
  • ADC maximum safe input: 3.3V
  • ADC input impedance: 100kΩ (typical)

Find: R1 and R2 values for voltage divider

Voltage divider formula:

\[V_{out} = V_{in} \times \frac{R2}{R1 + R2}\]

We need:

\[3.3V = 5V \times \frac{R2}{R1 + R2}\]

Solving for the ratio:

\[\frac{R2}{R1 + R2} = \frac{3.3}{5} = 0.66\]

This means: R2 = 0.66(R1 + R2) → R2 = 0.66R1 + 0.66R2 → 0.34R2 = 0.66R1 → R2 = 1.94R1

Choose practical values: If R1 = 10kΩ, then R2 ≈ 20kΩ

Verification:

\[V_{out} = 5V \times \frac{20kΩ}{10kΩ + 20kΩ} = 5V \times 0.667 = 3.33V\]

Power dissipation check:

\[I_{divider} = \frac{5V}{30kΩ} = 0.167mA\]

\[P_{total} = V \times I = 5V \times 0.167mA = 0.83mW\]

This is negligible—1/4W resistors are more than adequate.

Design guidelines:

  • Total resistance (R1 + R2) should be 10kΩ to 100kΩ
    • Too low: Wastes power
    • Too high: Susceptible to noise and loading effects
  • For ESP32 ADC: 10kΩ + 20kΩ = 30kΩ total is optimal
📡 I2C Pull-up Resistor Sizing

Scenario: Selecting pull-up resistors for I2C communication bus.

Given:

  • Bus voltage: V_DD = 3.3V
  • I2C bus capacitance: C_bus ≈ 100 pF (short traces, 2-3 devices)
  • Desired rise time: t_r ≤ 300 ns (Fast Mode, 400 kHz I2C)

Find: Pull-up resistor value

Solution:

I2C uses open-drain outputs, requiring pull-up resistors to restore logic HIGH.

Step 1: Calculate minimum resistance (based on I2C max sink current)

I2C devices can sink 3 mA minimum (per I2C specification). The pull-up resistor must not exceed this:

\[R_{min} = \frac{V_{DD}}{I_{sink}} = \frac{3.3V}{0.003A} = 1100Ω = 1.1kΩ\]

Any resistor below 1.1kΩ would draw more than 3 mA when pulled low, potentially damaging the I2C driver.

Step 2: Calculate maximum resistance (based on rise time)

The RC time constant of the pull-up resistor and bus capacitance limits rise time:

\[t_r = 0.8473 \times R \times C_{bus}\]

For 300 ns maximum rise time (I2C Fast Mode):

\[R_{max} = \frac{t_r}{0.8473 \times C_{bus}} = \frac{300 \times 10^{-9}}{0.8473 \times 100 \times 10^{-12}} ≈ 3.5kΩ\]

Any resistor above 3.5kΩ would cause the signal to rise too slowly, causing communication errors.

Step 3: Choose resistor value

Valid range: 1.1kΩ (minimum, sink current limit) to 3.5kΩ (maximum, rise time limit)

  • Too low (< 1.1kΩ): Excessive sink current, can damage I2C pins
  • Too high (> 3.5kΩ): Slow rise time, communication errors at 400 kHz

Recommended: Use 2.2kΩ or 4.7kΩ pull-ups (standard I2C values)

For this scenario with 100 pF bus capacitance: 2.2kΩ is optimal.

Power consumption:

When bus is HIGH (idle state):

\[I_{pullup} = \frac{3.3V}{2.2kΩ} = 1.5mA \text{ per line}\]

Total for SDA + SCL: 3 mA (negligible for most applications)

Quick reference table:

Bus Capacitance Max I2C Speed Recommended R_pullup
100 pF 400 kHz (Fast Mode) 2.2kΩ
200 pF 400 kHz 1.5kΩ
400 pF 100 kHz (Standard) 4.7kΩ
> 400 pF 100 kHz 10kΩ

Sammy the Sensor and friends discover the secret formula of electricity!

One sunny morning, Sammy the Sensor found a mystery: “Why does Lila the LED sometimes glow bright and sometimes glow dim?” Max the Microcontroller smiled. “That’s because of a magic formula called Ohm’s Law! Let me show you.”

Max drew a big triangle on the whiteboard. “There are three best friends in every circuit: Voltage, Current, and Resistance. Voltage is like the water pressure in a hose – it pushes electricity along. Current is how much electricity actually flows, like how much water comes out. And Resistance is anything that slows the flow down, like squeezing the hose.”

“The magic formula is V equals I times R,” Max continued. “That means if you know any two of the three friends, you can figure out the third one!”

Bella the Battery jumped in. “I push with 5 volts of pressure!” Sammy pointed to the 220-ohm resistor. “And this slows things down by 220 ohms.” Max did the math on his tiny screen: “So the current flowing through Lila is 5 divided by 220, which is about 23 milliamps. That’s just right for her to glow safely!”

Lila beamed. “So Ohm’s Law keeps me safe AND tells you exactly how bright I’ll be? That IS magic!” The whole Sensor Squad agreed – Ohm’s Law was the most important formula in their whole world of electronics.

4.3.6 Key Words for Kids

Word What It Means
Ohm’s Law The magic formula V = I x R that connects voltage, current, and resistance
Voltage Electrical pressure that pushes electrons through a circuit (measured in Volts)
Current The flow of electrons through a wire (measured in Amps)
Resistance Anything that slows down electron flow (measured in Ohms)
Power How much energy is used per second (measured in Watts)
Key Takeaway

Ohm’s Law (V = I x R) and its power companion (P = V x I) are the two equations you will use most in IoT hardware design. Master them to calculate LED resistor values, battery life, fuse ratings, wire gauge requirements, and thermal dissipation for any circuit.

4.4 Concept Relationships: Ohm’s Law Applications

Concept Formula Derived From Used For
Ohm’s Law V = I × R Fundamental law All resistive circuit analysis
Resistance Calculation R = V / I Ohm’s Law Finding unknown resistor value
Current Calculation I = V / R Ohm’s Law Determining current draw
Power (Voltage-Current) P = V × I Energy definition Total power consumption
Power (Current-Resistance) P = I² × R P = VI, V = IR Resistor heat dissipation
Power (Voltage-Resistance) P = V² / R P = VI, I = V/R Power from known voltage
Series Resistance R_total = R1 + R2 + … KVL + Ohm’s Law Multi-resistor circuits
Parallel Resistance 1/R_total = 1/R1 + 1/R2 + … KCL + Ohm’s Law Current-dividing circuits
Voltage Divider Vout = Vin × R2/(R1+R2) Ohm’s Law + Series Sensor level shifting
Current Divider I1 = Itotal × R2/(R1+R2) Ohm’s Law + Parallel Current sensing
Battery Life Hours = mAh / mA Energy conservation IoT deployment planning
Thermal Power Heat = I² × R Joule heating Component temperature rise

Key Insight: Every calculation starts with V = I × R. Power formulas (P = VI, P = I²R, P = V²/R) are just Ohm’s Law combined with the energy definition P = VI. For any resistive component, knowing any two quantities (V, I, R, P) allows you to calculate all others. This forms the complete toolkit for IoT circuit analysis.


4.4.1 Common Mistakes to Avoid

See Electricity Pitfalls for detailed coverage of common mistakes when working with electrical circuits.

Context: You need to power an IoT sensor node from a battery. Should you use a linear regulator (LDO) or a switching regulator (buck converter)?

Factor Linear Regulator (LDO) Switching Regulator (Buck) Winner
Efficiency 50-70% (Vout/Vin) 85-95% (independent of Vin) Switching
Battery Life 12V→3.3V wastes 72% as heat 12V→3.3V: 90% efficient Switching
Noise Ultra-clean output (<10µV ripple) 10-100mV ripple at switching frequency Linear
BOM Cost $0.50-$2 (IC + 2 capacitors) $3-$8 (IC + inductor + diode + capacitors) Linear
PCB Space Tiny (5mm² for SOT-23) Large (100mm² with inductor) Linear
Design Complexity Simple (datasheet copy-paste) Complex (PCB layout critical) Linear
Quiescent Current 1-50µA 10-100µA (older designs) Linear
Input Voltage Range Limited (dropout: 0.3-1.5V) Wide (4-40V typical) Switching
Load Current 100mA-1A typical 100mA-10A+ typical Switching

Decision Matrix:

Choose Linear (LDO) when:

  • Low-noise analog circuits (ADC reference, sensor amplifiers)
  • Small voltage drop (5V → 3.3V = 1.7V, efficiency = 66%)
  • Low cost and space constraints
  • Simple design requirements
  • Current draw <500mA

Choose Switching (Buck Converter) when:

  • Large voltage drop (12V → 3.3V = 8.7V wasted)
  • Battery-powered with long runtime requirements
  • Current draw >500mA
  • Input voltage varies widely (solar, automotive)

Hybrid Approach (BEST for IoT):

Use both in cascade: 1. Switching converter (12V → 5V at 90% efficiency) for bulk power 2. Linear regulator (5V → 3.3V at 66% efficiency) for clean analog power

Example: - Battery: 12V, 2000mAh - Load: ESP32 + sensors = 200mA @ 3.3V = 0.66W

Option A (Linear only):

  • 0.66W / 0.275 efficiency (3.3V/12V) = 2.4W from battery
  • 2.4W / 12V = 200mA from battery
  • Runtime: 2000mAh / 200mA = 10 hours

Option B (Switching only):

  • 0.66W / 0.9 efficiency = 0.73W from battery
  • 0.73W / 12V = 61mA from battery
  • Runtime: 2000mAh / 61mA = 32.8 hours (64% longer!)

Option C (Hybrid switching + linear):

  • 0.66W / 0.66 (linear efficiency) = 1.0W @ 5V
  • 1.0W / 0.9 (switching efficiency) = 1.11W @ 12V
  • 1.11W / 12V = 93mA from battery
  • Runtime: 2000mAh / 93mA = 21.5 hours
  • Benefit: Clean 3.3V for analog, acceptable battery life

Quick Selection Guide:

Application Recommended Solution Reason
USB-powered (5V) LDO (5V → 3.3V) Small drop, noise not critical
12V battery Buck converter Large drop, efficiency critical
Solar (variable V) Buck-boost converter Handles input below/above output
Precision sensors LDO always Noise kills ADC accuracy
High-current actuators Switching always >1A requires efficiency

Default Recommendation: For general IoT nodes, use a switching regulator (TPS62130, LM2596) unless you need ultra-low noise (<1mV ripple), in which case cascade switching + linear for best of both worlds.

Efficiency comparison for a real IoT weather station (ESP32 + sensors @ 200mA, 3.3V):

Power consumed by load:

\[P_{load} = V \times I = 3.3V \times 0.2A = 0.66W\]

Linear regulator (12V → 3.3V):

\[\eta_{linear} = \frac{V_{out}}{V_{in}} = \frac{3.3V}{12V} = 27.5\%\]

\[P_{input} = \frac{0.66W}{0.275} = 2.4W\]

\[P_{wasted} = 2.4W - 0.66W = 1.74W \text{ (dissipated as heat!)}\]

Switching regulator (12V → 3.3V at 90% efficiency):

\[P_{input} = \frac{0.66W}{0.90} = 0.73W\]

\[P_{wasted} = 0.73W - 0.66W = 0.07W\]

Battery life comparison (12V 2000mAh battery):

Linear: \(\frac{2000mAh}{200mA} = 10\) hours (from 12V battery: current draw = 2.4W / 12V = 200mA)

Switching: \(\frac{2000mAh}{61mA} = 32.8\) hours (from 12V battery: current draw = 0.73W / 12V = 61mA) ← 3.3× longer runtime

The switching regulator’s higher efficiency means the battery supplies only 61mA instead of 200mA, dramatically extending deployment time between recharges.

4.5 See Also

Within This Module:

Power Management:

  • Power Management Fundamentals - System-level battery optimization and energy harvesting
  • Energy Efficiency - Duty cycling, sleep modes, and power profiling
  • Battery Technologies - LiPo, NiMH, primary cells, and charging

Component Selection:

  • Resistor Selection - Material types, tolerances, and power ratings
  • Transistor Selection - Using transistors as switches with Ohm’s Law
  • Actuator Control - Motor current calculations and power driver design

External Resources:

Common Pitfalls

Ohm’s Law V = IR applies only to purely resistive elements. Capacitors, inductors, diodes, LEDs, and transistors do NOT follow Ohm’s Law — they have nonlinear or frequency-dependent V-I relationships. Using V=IR to calculate current through an LED ignores the LED’s forward voltage drop and produces wildly incorrect results.

Ideal power supplies hold voltage constant regardless of load current. Real batteries and regulators have internal resistance that causes output voltage to drop under heavy load: Vout = Vnominal - I x Rinternal. A 9V alkaline battery with 15 ohm internal resistance outputs only 6.5 V when driving 167 mA. Include supply internal resistance in circuit analysis for battery-powered IoT devices.

Voltage drop across a resistor is not ‘lost’ — it represents power being usefully (or wastefully) consumed. In an LED circuit, the resistor voltage drop represents power converted to heat; the LED voltage drop represents power converted to light. Both must sum to the supply voltage per KVL. Students sometimes try to minimize resistor voltage to ‘save power’ but this increases current and increases LED power dissipation instead.

Students often expect parallel combinations to average the resistors, but the result is always smaller than the smallest resistor. This surprises students who expect R_parallel to be between R1 and R2. Physical intuition: adding a parallel path provides additional current route, reducing total resistance. Verify calculated parallel resistance is less than the smallest individual resistor as a sanity check.

4.6 What’s Next

Next Chapter What You Will Learn
Electricity Applications Apply Ohm’s Law to real IoT circuits: passive components, power budget calculations, voltage dividers, and battery life estimation
Electricity Introduction Deepen understanding of voltage, current, and resistance with additional examples and circuit analysis techniques
Electronics: Doping and Diodes Move beyond Ohm’s Law into semiconductor devices, diodes, and transistors that form the building blocks of IoT circuits