This project controls an EDF (Electric Ducted Fan) via a standard ESC using an ESP32-C3 SuperMini. It is designed to power an "Outlaw Class" Pinewood Derby car. It features safety lockouts, LED status feedback, and a simple trigger interface.
- Microcontroller: ESP32-C3 SuperMini
- Motor Control: Standard PWM ESC (Electronic Speed Controller)
- Motor: Brushless DC Motor
- Input: Momentary Push Button (Trigger)
- Feedback: NeoPixel LED (WS2812B) - usually onboard GPIO 8 on SuperMini
- Power: Appropriate power supply for Motor/ESC and USB-C/5V for ESP32
| Component | ESP32-C3 Pin | Description |
|---|---|---|
| ESC Signal | GPIO 0 | PWM Signal to ESC |
| Reverse | GPIO 1 | Optional Signal for Reverse (Logic Level) |
| Trigger | GPIO 2 | Connect to GND when pressed (Input Pullup used) |
| LED | GPIO 3 | NeoPixel Data Pin (External Strip) |
| GND | GND | Common Ground with ESC and Power Supply |
Important
Trigger Wiring: Connect one side of the button to GPIO 2 and the other side to GND. No external resistor is needed (Internal Pullup is enabled).
1. Signal Cable (3-Wire Connector)
- Signal (PWM): White or Orange → Connect to GPIO 0 (
escPin). - Ground: Black or Brown → Connect to GND.
- +5V (BEC): Red
- Caution: This carries 5V from the ESC's internal regulator.
- If powering ESP32 via USB: Disconnect/Tape off this red wire to avoid conflict.
- If powering ESP32 via Battery: Connect to the
5Vpin.
2. Battery Input (Thick Wires)
- Red: Battery Positive (+)
- Black: Battery Negative (-)
3. Motor Output (3 Wires)
- Colors vary (often Black or Yellow/Red/Black).
- Order does not matter. Connect all three to the motor.
- To Reverse Direction: Swap any two of these three wires.
1. JST-SM Standard (Connector)
- Red: +5V
- Green: Data (DIN) → Connect to GPIO 3.
- White: GND
2. Alternate Standard (Flat Cable)
- Red: +5V
- White: Data (DIN) → Connect to GPIO 3.
- Black: GND
Note: Always verify labels on the strip (
5V,DIN,GND) as colors vary by manufacturer.
The controller operates on a "Release to Run" logic (Normally Closed switch behavior).
- Power On: LED turns Green (Idle).
- Idle / Ready State:
- Physical Action: Press and Hold the Trigger (Gate Closed).
- Feedback: LED is Solid Green.
- Requirement: You must hold the trigger for at least 2 seconds to arm the run.
- Start Run: Release the Trigger (Gate Drops).
- Condition A (Valid Run): If held for > 2s:
- Motor spins at 50% Power.
- LED spins Rainbow.
- Condition B (Early Release / Lockout): If held for < 2s:
- Motor remains STOPPED (Safety Lockout).
- LED Blinks Orange.
- Condition A (Valid Run): If held for > 2s:
- Automatic Stop (Timeout):
- The run lasts for a maximum of 2 seconds.
- After 2 seconds, the motor stops, and the LED turns Solid Red.
- Reset: Press the Trigger again to return to Idle (Green).
All configuration is located in src/main.cpp.
Look for the // ESP32-C3 SuperMini Pinout section:
const int escPin = 0; // Change 0 to your desired GPIO
const int reversePin = 1;
const int triggerPin = 2; Look for the Pulse width limits section:
const int maxPulseWidth = 1500; // 50% throttle (Range: 1000-2000)- Set to
2000for 100% power. - Set to
1500for 50% power (Current Default).
Look in void setup():
strip.setBrightness(128); // 0 to 255 (128 is ~50%)This project uses PlatformIO.
- Connect ESP32-C3 via USB.
- Open project in VS Code with PlatformIO extension.
- Click Upload (Arrow icon) in the bottom toolbar.
This code was generated by Gemini 3 Pro on Antigravity.