188 lines
5.4 KiB
Markdown
188 lines
5.4 KiB
Markdown
|
|
# 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:**
|
|||
|
|
1. Solder white wire to first 2.2kΩ resistor
|
|||
|
|
2. Connect other end to junction point
|
|||
|
|
3. Solder TWO 2.2kΩ resistors in series from junction to ground
|
|||
|
|
4. 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:
|
|||
|
|
1. **Old computer power supplies** - Full of resistors
|
|||
|
|
2. **Broken LED bulbs** - Often have 1kΩ-10kΩ resistors
|
|||
|
|
3. **Old TVs/Monitors** - Tons of resistors
|
|||
|
|
4. **Broken phone chargers** - Usually have some resistors
|
|||
|
|
5. **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:
|
|||
|
|
1. Connect to 5V source (USB charger works)
|
|||
|
|
2. Measure voltage at junction
|
|||
|
|
3. Should read between 2.5V - 3.3V
|
|||
|
|
|
|||
|
|
### Test Code for D1 Mini:
|
|||
|
|
```cpp
|
|||
|
|
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:
|
|||
|
|
1. **Cut and strip servo cable** (keep female end)
|
|||
|
|
2. **Build the divider:**
|
|||
|
|
- White wire → 2.2kΩ → Junction
|
|||
|
|
- Junction → 2.2kΩ → 2.2kΩ → Black wire
|
|||
|
|
- Junction → Wire to D1 Mini D2
|
|||
|
|
3. **Connect power:**
|
|||
|
|
- Red wire → D1 Mini 5V
|
|||
|
|
- Black wire → D1 Mini GND
|
|||
|
|
4. **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
|
|||
|
|
|
|||
|
|
1. **When in doubt, measure!** Use a multimeter if you have one
|
|||
|
|
2. **2.5V is better than 5V** - Lower voltage is safe, too high will kill the D1 Mini
|
|||
|
|
3. **Test with LED first** - The onboard LED should blink when receiving PWM
|
|||
|
|
4. **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!
|