Diseño de PCB Automotriz ESP32

Listo. Generé el esquemático y netlist completos para la PCB automotriz con ESP32 DevKitC, sensores, OLED I2C, LEDs, motor con MOSFET low-side, diodo flyback, pull-ups y tierra común GND.
Puntos importantes:
  • Todas las tierras quedaron unificadas en GND.
  • La red 3V3 alimenta sensores, OLED, pull-ups y LEDs.
  • La red 5V alimenta Vin/5V del ESP32 y el motor.
  • Cambié el potenciómetro de velocidad a 3.3 V en lugar de 5 V para proteger GPIO34, porque los ADC del ESP32 no son tolerantes a 5 V.
  • Dejé GPIO26 / PIN_MOTOR_IB como señal lógica de dirección, pero con el MOSFET IRFZ44N actual solo hay control PWM unidireccional; para dirección real se necesita puente H.
  • El ERC eléctrico quedó limpio. Los errores restantes del review completo son de layout/manufactura: airwires, cobre superpuesto por componentes aún no colocados, y MPNs faltantes en genéricos.
También creé estos archivos del proyecto:
El siguiente paso recomendado es pasar a layout: definir tamaño de PCB, colocar componentes por bloques funcionales, respetar el keepout de antena del ESP32 y luego enrutar. ¿Quieres que continúe con el layout?
Aceptar layout
Arreglar issues
Elegir puente H
Explicar antena ESP32
Seleccionar MPNs

Refine this doc
Ask about this doc
Firmware Starter — ESP32 Automotive Dashboard PCB
Platform & Toolchain
  • MCU/module: ESP32 DevKitC / ESP32-WROVER-E compatible
  • Framework: Arduino on PlatformIO
  • Monitor speed: 115200
Pin Mapping

Table


FunctionGPIONet
Speed potentiometer ADC34PIN_POT
LDR ADC35PIN_LDR
Oil level ADC33PIN_OIL
Rain sensor ADC32PIN_RAIN
DHT11 data27DHTPIN
OLED SDA21I2C_SDA
OLED SCL22I2C_SCL
Brake LED 114PIN_LED_FRENO_1
Brake LED 212PIN_LED_FRENO_2
Headlight LED13PIN_LED_FARO
Motor PWM25PIN_MOTOR_IA
Direction placeholder26PIN_MOTOR_IB
platformio.ini

Ini


[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
    adafruit/Adafruit SSD1306@^2.5.10
    adafruit/Adafruit GFX Library@^1.11.9
    adafruit/DHT sensor library@^1.4.6
src/main.cpp

Cpp


#include <Arduino.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <DHT.h>

#define PIN_POT_ADC       34
#define PIN_LDR_ADC       35
#define PIN_OIL_ADC       33
#define PIN_RAIN_ADC      32
#define DHTPIN_GPIO       27
#define PIN_LED_FRENO_1   14
#define PIN_LED_FRENO_2   12
#define PIN_LED_FARO      13
#define PIN_MOTOR_PWM     25
#define PIN_MOTOR_DIR     26
#define I2C_SDA_GPIO      21
#define I2C_SCL_GPIO      22

#define DHTTYPE DHT11
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1

DHT dht(DHTPIN_GPIO, DHTTYPE);
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

const int PWM_CH_MOTOR = 0;
const int PWM_FREQ = 20000;
const int PWM_RES_BITS = 8;

unsigned long lastUpdate = 0;

int readAdc12(int pin) {
  return analogRead(pin);
}

void setupOutputs() {
  pinMode(PIN_LED_FRENO_1, OUTPUT);
  pinMode(PIN_LED_FRENO_2, OUTPUT);
  pinMode(PIN_LED_FARO, OUTPUT);
  pinMode(PIN_MOTOR_DIR, OUTPUT);
  digitalWrite(PIN_MOTOR_DIR, LOW);
  ledcSetup(PWM_CH_MOTOR, PWM_FREQ, PWM_RES_BITS);
  ledcAttachPin(PIN_MOTOR_PWM, PWM_CH_MOTOR);
  ledcWrite(PWM_CH_MOTOR, 0);
}

void setupDisplay() {
  Wire.begin(I2C_SDA_GPIO, I2C_SCL_GPIO);
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println("OLED not found at 0x3C; continuing without display");
    return;
  }
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 0);
  display.println("DASHBOARD IRS");
  display.display();
}

void setup() {
  Serial.begin(115200);
  delay(200);
  analogReadResolution(12);
  analogSetAttenuation(ADC_11db);
  setupOutputs();
  dht.begin();
  setupDisplay();
  Serial.println("ESP32 Automotive Dashboard firmware started");
}

void loop() {
  unsigned long now = millis();
  if (now - lastUpdate < 500) return;
  lastUpdate = now;

  int pot = readAdc12(PIN_POT_ADC);
  int ldr = readAdc12(PIN_LDR_ADC);
  int oil = readAdc12(PIN_OIL_ADC);
  int rain = readAdc12(PIN_RAIN_ADC);
  float tempC = dht.readTemperature();

  float speedPct = (pot / 4095.0f) * 100.0f;
  bool brake = speedPct > 70.0f;
  bool dark = ldr < 1800;

  digitalWrite(PIN_LED_FRENO_1, brake ? HIGH : LOW);
  digitalWrite(PIN_LED_FRENO_2, brake ? HIGH : LOW);
  digitalWrite(PIN_LED_FARO, dark ? HIGH : LOW);

  uint8_t motorDuty = map(pot, 0, 4095, 0, 255);
  ledcWrite(PWM_CH_MOTOR, motorDuty);

  Serial.printf("pot=%d speed=%.1f%% ldr=%d oil=%d rain=%d temp=%.1fC brake=%d faro=%d duty=%u\n",
                pot, speedPct, ldr, oil, rain, tempC, brake, dark, motorDuty);

  if (display.width() > 0) {
    display.clearDisplay();
    display.setCursor(0, 0);
    display.println("DASHBOARD IRS");
    display.printf("Vel: %.0f%%\n", speedPct);
    display.printf("Luz: %d\n", ldr);
    display.printf("Oil: %d Rain: %d\n", oil, rain);
    if (!isnan(tempC)) display.printf("Temp: %.1f C\n", tempC);
    display.printf("Brake:%s Faro:%s\n", brake ? "ON" : "OFF", dark ? "ON" : "OFF");
    display.display();
  }
}
Build & Flash

Bash


pio run
pio run -t upload
pio device monitor
Note: GPIO12 is an ESP32 strapping pin. If boot becomes unreliable, move brake LED 2 to a non-strapping GPIO in a schematic revision.

    Platform & Toolchain

    Pin Mapping

    platformio.ini

    src/main.cpp

    Build & Flash

Documents

    Project Specification — ESP32 Automotive Dashboard PCB

    Firmware Starter — ESP32 Automotive Dashboard PCB

    Board Bring-Up Plan — ESP32 Automotive Dashboard PCB

Assets

Assets are files uploaded to this project which can be used in various ways.

ESP32 Automotive Dashboard PCB thumbnail
PCB automotriz educativa basada en ESP32 DevKit con sensores analógicos/digitales, display SSD1306 I2C, LEDs de freno/faro y control PWM de motor/ventilador sobre tierra común GND.

Properties

Properties describe core aspects of the project.

Pricing & Availability

Distributor

Qty 1

Arrow

$0.53–$0.80

Digi-Key

$16.40

HQonline

$1.43

LCSC

$15.99–$16.07

Mouser

$2.12

TME

$0.00

Verical

$0.52–$1.86

Controls