5.4 KiB
5.4 KiB
Voltage Divider Alternatives - Using What You Have
Solution 1: Using Only 2.2kΩ Resistors (RECOMMENDED)
Option A: Two 2.2kΩ in Series for Bottom Resistor
This creates a 2.2kΩ top and 4.4kΩ bottom divider.
PWM (5V) ────[2.2kΩ]────┬──── To D1 Mini D2 (3.33V)
│
[2.2kΩ]
│
[2.2kΩ]
│
GND
Output Voltage: 5V × (4.4kΩ ÷ 6.6kΩ) = 3.33V ✓ SAFE!
How to Build:
- Solder white wire to first 2.2kΩ resistor
- Connect other end to junction point
- Solder TWO 2.2kΩ resistors in series from junction to ground
- Take output from junction to D1 Mini D2
Option B: Equal Divider (Simplest)
Uses just two 2.2kΩ resistors for a 50/50 divider.
PWM (5V) ────[2.2kΩ]────┬──── To D1 Mini D2 (2.5V)
│
[2.2kΩ]
│
GND
Output Voltage: 5V × (2.2kΩ ÷ 4.4kΩ) = 2.5V ✓ SAFE!
Pros:
- Simplest to build
- Only 2 resistors needed
- Still safe for D1 Mini
Cons:
- Lower voltage might miss some PWM pulses in noisy environments
- But should work fine in most cases
Solution 2: Common Resistor Combinations
If You Have These Resistors:
| Top Resistor | Bottom Resistor | Output | Safe? | Notes |
|---|---|---|---|---|
| 2.2kΩ | 4.7kΩ | 3.4V | ✓ Yes | Very common resistor |
| 2.2kΩ | 2.7kΩ | 2.75V | ✓ Yes | Close to ideal |
| 2.2kΩ | 3.9kΩ | 3.2V | ✓ Yes | Good alternative |
| 2.2kΩ | 2.2kΩ | 2.5V | ✓ Yes | Equal divider |
| 1kΩ | 2.2kΩ | 3.4V | ✓ Yes | If you have 1k |
| 1kΩ | 1.5kΩ | 3.0V | ✓ Yes | Perfect output |
Solution 3: No Resistors? Emergency Options
Use LEDs as Voltage Droppers (NOT RECOMMENDED)
PWM (5V) ──── Red LED ──── To D1 Mini D2 (~3.3V)
- Red LED drops ~1.7V
- Output: 5V - 1.7V = 3.3V
- WARNING: Not reliable, use only for testing!
Use Diodes (Better than LEDs)
PWM (5V) ──── 1N4148 ──── 1N4148 ──── To D1 Mini D2 (~3.6V)
- Each silicon diode drops ~0.7V
- Two diodes: 5V - 1.4V = 3.6V
- Borderline safe - D1 Mini can usually handle 3.6V
Solution 4: Find Resistors in Old Electronics
Where to Look:
- Old computer power supplies - Full of resistors
- Broken LED bulbs - Often have 1kΩ-10kΩ resistors
- Old TVs/Monitors - Tons of resistors
- Broken phone chargers - Usually have some resistors
- Old Arduino/electronics kits - Check breadboard projects
How to Identify Values:
Use online resistor color code calculator or multimeter
Solution 5: Make Your Own 3kΩ-ish Resistor
Parallel/Series Combinations:
To get ~3kΩ from 2.2kΩ resistors:
Option 1: 2.2kΩ + 1kΩ in series = 3.2kΩ Option 2: 2.2kΩ + 680Ω in series = 2.88kΩ Option 3: 2.2kΩ + 820Ω in series = 3.02kΩ
Quick Test Your Divider
With Multimeter:
- Connect to 5V source (USB charger works)
- Measure voltage at junction
- Should read between 2.5V - 3.3V
Test Code for D1 Mini:
void setup() {
Serial.begin(115200);
pinMode(D2, INPUT);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
// Read digital state
int state = digitalRead(D2);
digitalWrite(LED_BUILTIN, !state);
// Try to read PWM
unsigned long pulse = pulseIn(D2, HIGH, 50000);
if (pulse > 0) {
Serial.print("SUCCESS! PWM: ");
Serial.println(pulse);
} else {
Serial.println("Waiting for PWM...");
}
delay(100);
}
Recommended Build with 2.2kΩ Only
Materials:
- 3× 2.2kΩ resistors
- Servo cable
- Small piece of wire
Steps:
- Cut and strip servo cable (keep female end)
- Build the divider:
- White wire → 2.2kΩ → Junction
- Junction → 2.2kΩ → 2.2kΩ → Black wire
- Junction → Wire to D1 Mini D2
- Connect power:
- Red wire → D1 Mini 5V
- Black wire → D1 Mini GND
- Test it!
Visual Build:
[Servo Cable]
|
R━━━B━━━W━━━━━[2.2k]━━━━●━━━━> To D1 Mini D2
| | |
| | [2.2k]━━[2.2k]
| | |
| └────────────────────┘
|
└──> To D1 Mini 5V
Why These Work
The D1 Mini GPIO pins are rated for 3.3V but can tolerate up to 3.6V briefly. Any voltage between 2.5V and 3.3V will work reliably:
- 2.5V - Minimum reliable HIGH signal
- 3.0V - Ideal target
- 3.3V - Perfect match
- 3.6V - Maximum safe limit
- 5.0V - WILL DAMAGE THE D1 MINI!
Final Tips
- When in doubt, measure! Use a multimeter if you have one
- 2.5V is better than 5V - Lower voltage is safe, too high will kill the D1 Mini
- Test with LED first - The onboard LED should blink when receiving PWM
- Use what you have - Many combinations work, just stay under 3.6V
Shopping List (if you need to buy)
Minimum parts from Amazon/eBay:
- Resistor kit (~$5-10) - Includes hundreds of values
- 2.7kΩ resistor (5 pack ~$1) - Makes perfect 3V with 2.2kΩ
- 3kΩ resistor (5 pack ~$1) - Close enough to 3.3kΩ
- 4.7kΩ resistor (5 pack ~$1) - Common value, works great
Any of these will work perfectly with your 2.2kΩ resistor!