# Quick Flash Guide - D1 Mini Blinkin Emulator ## What You'll Build A $7 replacement for the $35 REV Blinkin LED Driver that works identically with FTC code! ## Parts List - **D1 Mini** (ESP8266) - $4 - **2.2kΩ resistor** - $0.10 - **3.3kΩ resistor** - $0.10 - **Servo extension cable** - $2 - **WS2812B LED strip** (30-60 LEDs) - $10-15 - **Soldering supplies** ## Step 1: Build the Voltage Divider ### Why It's Needed - Servo port outputs 5V signals - D1 Mini only handles 3.3V - Without this, you'll fry your D1 Mini! ### Quick Assembly 1. Cut servo cable 6" from female connector 2. Strip wires (Red=5V, Black=GND, White=PWM) 3. Solder resistors like this: ``` White wire ──[2.2kΩ]──┬── Wire to D2 │ [3.3kΩ] │ Black wire ``` 4. Heat shrink everything ## Step 2: Flash the D1 Mini ### Install Arduino IDE 1. Download from [arduino.cc](https://www.arduino.cc/en/software) 2. Open Arduino IDE 3. File → Preferences → Additional Board URLs: ``` http://arduino.esp8266.com/stable/package_esp8266com_index.json ``` 4. Tools → Board → Board Manager → Search "ESP8266" → Install ### Install Library Tools → Manage Libraries → Search "Adafruit NeoPixel" → Install ### Flash the Code 1. Open `D1Mini_Blinkin_Ready.ino` 2. **IMPORTANT: Edit line 20-21 for your setup:** ```cpp #define NUM_LEDS 60 // Change to your LED count #define BRIGHTNESS 100 // Adjust brightness (0-255) ``` 3. Tools → Board → "LOLIN(WEMOS) D1 R2 & mini" 4. Tools → Port → Select your COM port 5. Click Upload (→ button) ## Step 3: Wire Everything ### Final Connections ``` Servo Port D1 Mini LED Strip ========== ======= ========= Red ───────────────→ 5V Black ─────────────→ GND ─────────────→ GND White ─→[Divider]──→ D2 D4 ───────────────→ Data In 5V ← External Power ``` ### Power Notes - < 30 LEDs: Can use servo port power - > 30 LEDs: Need external 5V supply for LEDs ## Step 4: Test It ### With Serial Monitor 1. Open Tools → Serial Monitor 2. Set to 115200 baud 3. You should see: ``` D1 Mini Blinkin Emulator v2.0 Kraken Koders FTC Team Ready for PWM signal... ``` ### With FTC Robot 1. Configure as servo in robot config 2. Name it "blinkin" 3. Use this test code: ```java RevBlinkinLedDriver blinkin = hardwareMap.get(RevBlinkinLedDriver.class, "blinkin"); blinkin.setPattern(RevBlinkinLedDriver.BlinkinPattern.RAINBOW_RAINBOW_PALETTE); ``` ## Troubleshooting ### LEDs Don't Light - Check D4 → LED data connection - Verify LED strip arrow points away from D1 Mini - Test with simple color first ### No PWM Reading - Measure voltage divider output (should be ~3V) - Check servo port is powered - Verify resistor values ### Wrong Colors - Some strips are RGB instead of GRB - Change line in code: ```cpp // Change from: Adafruit_NeoPixel strip(NUM_LEDS, LED_DATA_PIN, NEO_GRB + NEO_KHZ800); // To: Adafruit_NeoPixel strip(NUM_LEDS, LED_DATA_PIN, NEO_RGB + NEO_KHZ800); ``` ### D1 Mini Keeps Resetting - Too many LEDs for power supply - Reduce brightness or LED count - Add external 5V power ## Quick Test Without Robot Use a servo tester or Arduino to generate PWM: ```cpp // Arduino test signal generator void setup() { pinMode(9, OUTPUT); } void loop() { // Sweep through patterns for(int pw = 1000; pw <= 2000; pw += 10) { digitalWrite(9, HIGH); delayMicroseconds(pw); digitalWrite(9, LOW); delay(20); } } ``` ## Pattern Reference | PWM (μs) | Pattern | |----------|---------| | 1005-1015 | Rainbow | | 1065 | Confetti | | 1315 | Breath Red | | 1325 | Breath Blue | | 1515 | Solid Red | | 1645 | Solid Blue | | 1595 | Solid Green | | 1675 | Solid White | | 1995 | Off | ## Success Checklist - [ ] Voltage divider outputs 3V (measured) - [ ] D1 Mini powers on - [ ] Serial monitor shows "Ready" - [ ] Green sweep on startup - [ ] Responds to PWM changes - [ ] Works with FTC code ## Total Cost - D1 Mini: $4 - Resistors: $0.20 - Cable: $2 - **Total: $6.20** (vs $35 for REV Blinkin) ## Need Help? - Check serial monitor for debug info - Onboard LED blinks = receiving PWM - Green startup = code running - No response = check voltage divider **You now have a fully functional Blinkin emulator for 1/5 the price!**