591 Electricity Fundamentals: Common Pitfalls
Mistake: Calculating with mixed units
Example (WRONG): - Voltage: 3.3V - Current: 150 mA - Power: P = 3.3 × 150 = 495W ❌ WRONG!
Correct approach:
Convert mA to A first: - Current: 150 mA = 0.15 A - Power: P = 3.3V × 0.15A = 0.495W ✓
Common unit conversions: - 1 A = 1000 mA - 1 V = 1000 mV - 1 kΩ = 1000 Ω - 1 MΩ = 1,000,000 Ω = 1000 kΩ
Pro tip: Always write units in calculations and convert everything to base units (A, V, Ω) before calculating.
Mistake: Ignoring LED forward voltage when calculating current-limiting resistor
Example (WRONG): - GPIO: 5V - LED resistor: R = 5V / 0.02A = 250Ω ❌ WRONG!
This assumes the LED drops 0V, which is impossible.
Correct approach:
Account for LED forward voltage (typically 2V for red): - Voltage across resistor: 5V - 2V = 3V - Resistor: R = 3V / 0.02A = 150Ω ✓
Other components with voltage drops: - Diodes: 0.7V (silicon), 0.3V (Schottky) - MOSFETs: 0.1-0.3V (drain-source voltage drop, R_DS(on)) - LDO regulators: 0.1-1V (dropout voltage) - Wires/connectors: 0.01-0.1V per connection at high currents
Mistake: Selecting resistor based on resistance value only, not power rating
Example scenario: - Voltage across resistor: 12V - Resistance: 10Ω - Current: I = 12V / 10Ω = 1.2A - Power: P = I² × R = (1.2)² × 10 = 14.4W
If you use a standard 1/4W (0.25W) resistor, it will: 1. Overheat immediately (>50× its rating!) 2. Smoke and burn 3. Potentially start a fire 🔥
Correct approach:
Calculate power dissipation and choose resistor rated ≥2× the calculated power:
\[P_{resistor} = I^2 \times R = 1.44 \times 10 = 14.4W\]
Resistor selection: Use 20W or 25W power resistor (ceramic wirewound)
Standard resistor power ratings: - 1/8 W (0.125W) - Signal circuits, LEDs - 1/4 W (0.25W) - General purpose (most common) - 1/2 W (0.5W) - Moderate power applications - 1W - Power circuits - 2W, 5W, 10W, 25W+ - High power (ceramic, wirewound, heat-sinked)
Safety rule: Choose resistor rated at least 2× the calculated power for safety margin and thermal management.
Mistake: Drawing too much current directly from microcontroller pins
Example (DANGEROUS):
Connecting a relay coil (70 mA) directly to Arduino GPIO: - Arduino pin max current: 40 mA (per pin), 200 mA (total all pins) - Relay coil: 70 mA @ 5V - Result: Pin damage, MCU brownout, unpredictable behavior ❌
Correct approaches:
Option 1: Transistor driver
Arduino GPIO → 1kΩ resistor → NPN transistor base
↓
Relay coil (collector-emitter)
+ flyback diode
GPIO supplies only 5 mA to transistor base; transistor switches the 70 mA relay current from external power.
Option 2: MOSFET driver
Arduino GPIO → 10kΩ resistor → MOSFET gate (IRLZ44N)
↓
Relay coil (drain-source)
+ flyback diode
GPIO supplies <1 µA; MOSFET handles amperes.
GPIO current limits: | Microcontroller | Max per pin | Max total | Notes | |—————-|————|———–|——-| | Arduino Uno (ATmega328P) | 40 mA | 200 mA | Never exceed 40 mA | | ESP32 | 40 mA | 1200 mA | Per I/O group limits apply | | ESP8266 | 12 mA | 80 mA | Very limited! | | Raspberry Pi | 16 mA | 50 mA total | Easily damaged | | STM32 | 25 mA | Varies | Check datasheet |
Safety rule: If load exceeds 10 mA, use a transistor/MOSFET driver. Never connect motors, relays, or high-power LEDs directly to GPIO pins.
Mistake: Using Ohm’s Law (V = I × R) directly for AC circuits with capacitors/inductors
Why it fails:
In AC circuits: - Capacitors have capacitive reactance (X_C = 1 / (2πfC)) - Inductors have inductive reactance (X_L = 2πfL) - Total opposition to current is impedance (Z), not just resistance (R)
Example (WRONG for AC): - 120V AC, 60 Hz - 10 µF capacitor - Calculating current: I = V / R ❌ Can’t use resistance for a capacitor!
Correct approach for AC:
Calculate capacitive reactance first:
\[X_C = \frac{1}{2\pi f C} = \frac{1}{2\pi \times 60 \times 10 \times 10^{-6}} = 265Ω\]
Now use Ohm’s Law with reactance:
\[I = \frac{V}{X_C} = \frac{120V}{265Ω} = 0.45A = 450mA\]
When to use DC Ohm’s Law: - ✓ DC circuits (batteries, power supplies) - ✓ Resistive loads only (resistors, heaters, incandescent bulbs) - ✓ Very low frequency AC (<1 Hz) approximates DC
When NOT to use DC Ohm’s Law: - ✗ AC circuits with capacitors or inductors - ✗ Switch-mode power supplies (use impedance and power factor) - ✗ RF circuits (requires transmission line theory)
IoT context: Most IoT devices run on DC (batteries, USB power, DC adapters), so DC Ohm’s Law is usually correct. Be careful when: - Designing AC-powered smart plugs - Working with mains voltage monitoring - Implementing wireless power transfer (AC magnetic fields)
591.1 Electric Power
Power (P) is the rate of energy transfer, measured in Watts (W).
\[P = V \times I\]
Also expressed as: - \(P = I^2 \times R\) (useful when you know current and resistance) - \(P = \frac{V^2}{R}\) (useful when you know voltage and resistance)
1 Watt = 1 Joule per second
591.2 🧮 Interactive Examples
591.2.1 Example 1: Heater Current Calculation
Problem: A heater coil has 10Ω resistance and runs on 120V. What is the current?
Solution: \[I = \frac{V}{R} = \frac{120V}{10Ω} = 12A\]
Answer: 12 Amperes
591.2.2 Example 2: Motor Resistance Design
Problem: A DC motor requires 10A to operate at full speed. The battery supplies 12V. What resistance is needed?
Solution: \[R = \frac{V}{I} = \frac{12V}{10A} = 1.2Ω\]
Answer: 1.2 Ohms
591.2.3 Example 3: Power Consumption
Problem: A vacuum cleaner has maximum power consumption of 1000W and runs on 240V. What current does it draw?
Solution: \[I = \frac{P}{V} = \frac{1000W}{240V} = 4.17A\]
Answer: 4.17 Amperes
591.3 Python Implementations
The following Python implementations demonstrate how to calculate electrical properties programmatically, useful for IoT system design and analysis.
591.3.1 Circuit Calculator
591.3.2 LED Resistor Calculator
591.3.3 Power Budget Calculator
591.3.4 Series and Parallel Resistor Calculator
591.4 💻 Try It Yourself: Ohm’s Law Calculator
591.5 Hands-On Practice
Use TinkerCAD Circuits to build and test Ohm’s Law:
- Go to TinkerCAD Circuits
- Create a simple circuit with:
- 9V battery
- Resistor (try different values: 100Ω, 330Ω, 1kΩ)
- LED
- Add a multimeter to measure voltage and current
- Calculate expected current using Ohm’s Law
- Compare with simulation results!
Expected Learning: See how changing resistance affects current in real-time.