PCB ESP32 IoT Controller

Para modificar un proyecto ya terminado sin recrearlo, lo ideal es que me des el proyecto en un formato editable, no solo imágenes o PDFs.
Mejor opción
Si el proyecto ya está en Flux:
  • pasame el link del proyecto de Flux;
  • asegurate de que tenga permisos para verlo/editarlo.
Con eso puedo leer esquema, PCB, componentes, nets, reglas y hacer cambios directos.
Si viene de KiCad
Lo mejor es subir el proyecto completo en un .zip con:
  • archivo .kicad_pro
  • archivo .kicad_sch
  • archivo .kicad_pcb
  • librerías/símbolos personalizados si usaste:
    • .kicad_sym
    • carpeta symbols
    • carpeta footprints.pretty
  • modelos 3D si son importantes:
    • .step
    • .wrl
  • si existe, carpeta fp-lib-table / sym-lib-table
Si viene de EasyEDA
Ideal:
  • exportación del proyecto completo en formato EasyEDA JSON;
  • o exportación compatible con KiCad, si EasyEDA te la permite.
Si viene de Altium
Ideal:
  • .PrjPcb
  • .SchDoc
  • .PcbDoc
  • librerías usadas:
    • .SchLib
    • .PcbLib
  • o un .zip completo del proyecto.
Si viene de Eagle
Ideal:
  • .sch
  • .brd
  • librerías .lbr usadas.
Archivos útiles adicionales
No reemplazan al proyecto editable, pero ayudan mucho:
  • Gerbers: sirven para revisar cómo se fabricó, pero no son cómodos para modificar.
  • BOM: lista de componentes.
  • Pick and Place / CPL: posiciones de componentes.
  • PDF del esquemático: referencia visual.
  • STEP 3D: para ver caja, alturas y mecánica.
  • Datasheets de componentes raros.
  • Fotos de la placa real, si ya existe.
Resumen corto
Para modificar sin esfuerzo:
  1. Link de Flux, si ya está en Flux.
  2. Si no, un ZIP del proyecto completo original del software donde fue diseñado.
  3. Como apoyo: BOM, Gerbers, PDF de esquema, STEP y fotos.
Lo menos recomendable para modificar es darme solo Gerbers o imágenes, porque eso sirve para fabricar/ver, pero no para editar fácilmente el circuito.
Revisar importación
Modificar proyecto Flux
Preparar checklist archivos
Evaluar Gerbers existentes

Refine this doc
Ask about this doc
Firmware Starter — ESP32-S3 IoT Relay Controller
Platform & Toolchain
  • MCU: ESP32-S3-MINI-1U-N8
  • Framework: Arduino on PlatformIO
  • Programming: USB-C native USB Serial/JTAG / ROM downloader using BOOT + RESET
Pin Mapping

Table


FunctionGPIONet
Relay SET pulse4RELAY_SET_GPIO
Relay RESET pulse5RELAY_RESET_GPIO
WiFi/status LED6LED_WIFI_GPIO
Relay/status LED7LED_RELAY_GPIO
I2C SCL8I2C_SCL
I2C SDA9I2C_SDA
ACS732 overcurrent fault10ACS_FAULT
Current ADC1ADC_CURRENT
AC voltage ADC2ADC_AC_VOLTAGE
UART TX expansionTXD0UART0_TX_EXP
UART RX expansionRXD0UART0_RX_EXP
BOOT0ESP_BOOT
platformio.ini

Ini


[env:esp32-s3]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200
upload_speed = 921600
build_flags =
  -DARDUINO_USB_MODE=1
  -DARDUINO_USB_CDC_ON_BOOT=1
Complete Firmware Source

Cpp


#include <Arduino.h>
#include <Wire.h>
#include <WiFi.h>

#define RELAY_SET_PIN        4
#define RELAY_RESET_PIN      5
#define LED_WIFI_PIN         6
#define LED_RELAY_PIN        7
#define I2C_SCL_PIN          8
#define I2C_SDA_PIN          9
#define ACS_FAULT_PIN        10
#define ADC_CURRENT_PIN      1
#define ADC_AC_VOLTAGE_PIN   2

#define TMP102_ADDR          0x48
#define RELAY_PULSE_MS       50
#define SAMPLE_INTERVAL_MS   1000

const char* WIFI_SSID = "YOUR_SSID";
const char* WIFI_PASSWORD = "YOUR_PASSWORD";

bool relayOn = false;
uint32_t lastSample = 0;

void pulseRelay(bool turnOn) {
  const int pin = turnOn ? RELAY_SET_PIN : RELAY_RESET_PIN;
  digitalWrite(pin, HIGH);
  delay(RELAY_PULSE_MS);
  digitalWrite(pin, LOW);
  relayOn = turnOn;
  digitalWrite(LED_RELAY_PIN, relayOn ? HIGH : LOW);
}

bool readTMP102(float &tempC) {
  Wire.beginTransmission(TMP102_ADDR);
  Wire.write(0x00);
  if (Wire.endTransmission(false) != 0) return false;
  if (Wire.requestFrom(TMP102_ADDR, 2) != 2) return false;
  int16_t raw = (Wire.read() << 4) | (Wire.read() >> 4);
  if (raw & 0x800) raw |= 0xF000;
  tempC = raw * 0.0625f;
  return true;
}

float readAdcVolts(int pin) {
  uint16_t raw = analogRead(pin);
  return (raw / 4095.0f) * 3.3f;
}

float estimateLoadCurrentA() {
  float vadc = readAdcVolts(ADC_CURRENT_PIN);
  float sensorVout = vadc * 1.5f;       // R22=10k, R23=20k divider
  return (sensorVout - 2.5f) / 0.050f;  // ACS732-40AB: 50 mV/A typ
}

float readAcVoltageAdcVolts() {
  return readAdcVolts(ADC_AC_VOLTAGE_PIN); // Calibration required for RMS mains voltage
}

void initWiFi() {
  WiFi.mode(WIFI_STA);
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  uint8_t tries = 0;
  while (WiFi.status() != WL_CONNECTED && tries++ < 20) {
    digitalWrite(LED_WIFI_PIN, !digitalRead(LED_WIFI_PIN));
    delay(250);
  }
  digitalWrite(LED_WIFI_PIN, WiFi.status() == WL_CONNECTED ? HIGH : LOW);
}

void setup() {
  Serial.begin(115200);
  delay(300);
  pinMode(RELAY_SET_PIN, OUTPUT);
  pinMode(RELAY_RESET_PIN, OUTPUT);
  pinMode(LED_WIFI_PIN, OUTPUT);
  pinMode(LED_RELAY_PIN, OUTPUT);
  pinMode(ACS_FAULT_PIN, INPUT_PULLUP);
  digitalWrite(RELAY_SET_PIN, LOW);
  digitalWrite(RELAY_RESET_PIN, LOW);
  digitalWrite(LED_RELAY_PIN, LOW);
  analogReadResolution(12);
  Wire.begin(I2C_SDA_PIN, I2C_SCL_PIN);
  initWiFi();
  Serial.println("ESP32-S3 IoT Relay Controller ready");
}

void loop() {
  if (millis() - lastSample >= SAMPLE_INTERVAL_MS) {
    lastSample = millis();
    float tempC = NAN;
    bool tempOk = readTMP102(tempC);
    float currentA = estimateLoadCurrentA();
    float acAdc = readAcVoltageAdcVolts();
    bool fault = digitalRead(ACS_FAULT_PIN) == LOW;
    Serial.printf("relay=%d temp=%s%.2fC current=%.2fA ac_adc=%.3fV fault=%d wifi=%d\n",
      relayOn, tempOk ? "" : "ERR ", tempOk ? tempC : NAN, currentA, acAdc, fault, WiFi.status() == WL_CONNECTED);
    if (fault || (tempOk && tempC > 85.0f)) {
      pulseRelay(false);
      Serial.println("Safety trip: relay reset");
    }
  }
  if (WiFi.status() != WL_CONNECTED) initWiFi();
}
Build & Flash

Bash


pio run
pio run -t upload
pio device monitor
Hold BOOT, tap RESET, release BOOT if the USB bootloader is not detected automatically.
  • Platform & Toolchain

  • Pin Mapping

  • platformio.ini

  • Complete Firmware Source

  • Build & Flash

ESP32-S3 IoT Relay Controller thumbnail
Controlador IoT compacto con ESP32-S3, alimentación dual AC/DC aislada, relé de 16A, medición de tensión/corriente/temperatura, USB-C y E/S auxiliares para producción.

Properties

Properties describe core aspects of the project.

Pricing & Availability

Distributor

Qty 1

Arrow

$18.41–$22.01

Digi-Key

$0.01

HQonline

$7.16–$7.58

LCSC

$35.90–$36.58

Mouser

$46.78–$46.94

TME

$11.13–$11.30

Verical

$13.54–$374.01

Controls