Skip to content

psunkari/edf-derby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ESP32-C3 ESC Controller for "Outlaw Class" Pinewood Derby

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.

Hardware Requirements

  • 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

Wiring / Pin Connections

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).

Common ESC Wiring Colors

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 5V pin.

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.

Common RGBIC LED Wiring Colors

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.

Usage

The controller operates on a "Release to Run" logic (Normally Closed switch behavior).

  1. Power On: LED turns Green (Idle).
  2. 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.
  3. 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.
  4. Automatic Stop (Timeout):
    • The run lasts for a maximum of 2 seconds.
    • After 2 seconds, the motor stops, and the LED turns Solid Red.
  5. Reset: Press the Trigger again to return to Idle (Green).

Updating Configuration

All configuration is located in src/main.cpp.

Changing Pins

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;  

Changing Power Limits

Look for the Pulse width limits section:

const int maxPulseWidth = 1500; // 50% throttle (Range: 1000-2000)
  • Set to 2000 for 100% power.
  • Set to 1500 for 50% power (Current Default).

Changing LED Brightness

Look in void setup():

strip.setBrightness(128); // 0 to 255 (128 is ~50%)

Flashing the Code

This project uses PlatformIO.

  1. Connect ESP32-C3 via USB.
  2. Open project in VS Code with PlatformIO extension.
  3. Click Upload (Arrow icon) in the bottom toolbar.

This code was generated by Gemini 3 Pro on Antigravity.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages