Diseño de PCB para Control Remoto

No pude continuar con la organización del layout porque se agotaron los créditos justo después de iniciar esa etapa.
Estado actual:
  • El esquemático ya está diseñado y cableado.
  • Incluye ESP32 DevKit, joystick, 4 botones, USB-C, cargador TP4056, LDO 3.3 V, conector LiPo, LEDs de carga/completo/batería baja y pasivos.
  • La revisión eléctrica anterior estaba limpia, sin errores ni advertencias.
  • Ya existen archivos de soporte:
    • Análisis de potencia
    • Firmware inicial ESP32
Pendiente:
  • Revisar dimensiones actuales de la PCB.
  • Dimensionar la placa si hace falta para formato tipo control.
  • Mantener la ESP32 donde está.
  • Mover joystick a la derecha.
  • Colocar los 4 botones a la izquierda en forma de diamante.
  • Colocar USB-C “atrás”/en el borde posterior.
  • Agrupar cargador, regulador, batería, LEDs y pasivos de forma ordenada.
  • Correr revisión DRC después de la colocación.
Organizar controles
PCB tipo control
Agrupar potencia
Revisar DRC
pero en la pcb no en el esquematico

Refine this doc
Ask about this doc
Firmware Starter - ESP32 DevKit Control Remoto
Platform & Toolchain
  • MCU: ESP32-DEVKITC
  • Framework: Arduino
  • Build system: PlatformIO
  • Board target: esp32dev
  • Purpose: Leer joystick, 4 botones, batería, USB conectado y controlar LED rojo de batería baja.
Pin Mapping

Table


FunctionGPIONetDirectionNotes
Joystick X32JOY_XADC inputADC1, compatible con WiFi
Joystick Y33JOY_YADC inputADC1, compatible con WiFi
Battery sense35BAT_SENSEADC inputADC1 input-only, divisor 100k/100k
USB sense34VBUS_SENSEADC inputADC1 input-only, divisor 100k/100k
Joystick switch25JOY_SWDigital inputPulsador a GND, usar pull-up interno
Button 118BTN1Digital inputPulsador a GND, usar pull-up interno
Button 219BTN2Digital inputPulsador a GND, usar pull-up interno
Button 321BTN3Digital inputPulsador a GND, usar pull-up interno
Button 422BTN4Digital inputPulsador a GND, usar pull-up interno
Low battery LED23LOW_BAT_LEDDigital outputHIGH enciende LED rojo D4
Notes:
  • CHRG red LED and FULL green LED are hardware-controlled by TP4056 CHRG/STDBY pins, not by firmware.
  • GPIO34 and GPIO35 are input-only, correct for ADC sensing.
  • Joystick/button signals can be sent over WiFi/BLE later; this starter prints to Serial.
platformio.ini

Ini


[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
upload_speed = 921600
Complete Firmware Source: src/main.cpp

Cpp


#include <Arduino.h>

// Pin definitions from schematic
#define JOY_X_PIN              32
#define JOY_Y_PIN              33
#define BAT_SENSE_PIN          35
#define VBUS_SENSE_PIN         34
#define JOY_SW_PIN             25
#define BTN1_PIN               18
#define BTN2_PIN               19
#define BTN3_PIN               21
#define BTN4_PIN               22
#define LOW_BAT_LED_PIN        23

// ADC scaling
// Battery and VBUS dividers are 100k/100k, so input voltage = ADC node * 2.
#define ADC_MAX_COUNTS         4095.0f
#define ADC_REF_VOLTS          3.3f
#define DIVIDER_RATIO          2.0f

// Battery thresholds for 1S LiPo
#define BAT_LOW_VOLTS          3.50f
#define BAT_CRITICAL_VOLTS     3.30f

static unsigned long lastReportMs = 0;
static const uint32_t REPORT_INTERVAL_MS = 100;

float readAdcVoltage(int pin) {
  int raw = analogRead(pin);
  return (raw / ADC_MAX_COUNTS) * ADC_REF_VOLTS;
}

float readBatteryVoltage() {
  return readAdcVoltage(BAT_SENSE_PIN) * DIVIDER_RATIO;
}

float readVbusVoltage() {
  return readAdcVoltage(VBUS_SENSE_PIN) * DIVIDER_RATIO;
}

int readButtonActiveLow(int pin) {
  return digitalRead(pin) == LOW ? 1 : 0;
}

void setup() {
  Serial.begin(115200);
  delay(300);
  Serial.println("ESP32 robot-car remote control starting");

  analogReadResolution(12);
  analogSetAttenuation(ADC_11db); // allows readings up to about 3.3V on ADC pin

  pinMode(JOY_SW_PIN, INPUT_PULLUP);
  pinMode(BTN1_PIN, INPUT_PULLUP);
  pinMode(BTN2_PIN, INPUT_PULLUP);
  pinMode(BTN3_PIN, INPUT_PULLUP);
  pinMode(BTN4_PIN, INPUT_PULLUP);

  pinMode(LOW_BAT_LED_PIN, OUTPUT);
  digitalWrite(LOW_BAT_LED_PIN, LOW);
}

void loop() {
  unsigned long now = millis();
  if (now - lastReportMs < REPORT_INTERVAL_MS) {
    return;
  }
  lastReportMs = now;

  int joyX = analogRead(JOY_X_PIN);
  int joyY = analogRead(JOY_Y_PIN);
  float batteryV = readBatteryVoltage();
  float vbusV = readVbusVoltage();

  bool lowBattery = batteryV < BAT_LOW_VOLTS;
  bool criticalBattery = batteryV < BAT_CRITICAL_VOLTS;
  bool usbConnected = vbusV > 4.0f;

  digitalWrite(LOW_BAT_LED_PIN, lowBattery ? HIGH : LOW);

  int joySw = readButtonActiveLow(JOY_SW_PIN);
  int b1 = readButtonActiveLow(BTN1_PIN);
  int b2 = readButtonActiveLow(BTN2_PIN);
  int b3 = readButtonActiveLow(BTN3_PIN);
  int b4 = readButtonActiveLow(BTN4_PIN);

  Serial.printf(
    "JOY_X=%d JOY_Y=%d JSW=%d B1=%d B2=%d B3=%d B4=%d VBAT=%.2fV VBUS=%.2fV USB=%d LOW=%d CRIT=%d\n",
    joyX, joyY, joySw, b1, b2, b3, b4, batteryV, vbusV,
    usbConnected ? 1 : 0,
    lowBattery ? 1 : 0,
    criticalBattery ? 1 : 0
  );
}
Build & Flash Instructions

Bash


pio run
pio run -t upload
pio device monitor
If upload fails, use the ESP32 DevKit BOOT/EN buttons: hold BOOT, tap EN/RESET, then start upload and release BOOT when flashing begins.
Next Firmware Step
After confirming joystick/button readings over Serial, add the wireless protocol used by the robot car receiver, for example ESP-NOW, BLE, UDP over WiFi, or classic Bluetooth serial.
  • Platform & Toolchain

  • Pin Mapping

  • platformio.ini

  • Complete Firmware Source: `src/main.cpp`

  • Build & Flash Instructions

  • Next Firmware Step

Control ESP32 para Robot Carro

Control ESP32 para Robot Carro thumbnail
PCB de control remoto ESP32 DevKit con joystick, 4 botones, batería LiPo recargable por USB y LEDs de batería/carga

Properties

Properties describe core aspects of the project.

Pricing & Availability

Distributor

Qty 1

Arrow

$5.24–$5.46

Digi-Key

$22.10–$23.40

HQonline

$1.73–$1.77

LCSC

$8.20–$8.35

Mouser

$9.14–$9.34

TME

$0.44–$0.57

Verical

$1.64–$11.80

Controls