Smart Relay Design Requirements


I’ll check the project BOM and availability metadata, especially LCSC/JLCPCB fields, then report which parts are ready and which need sourcing replacements.
Assuming you mean LCSC: No, not all components are currently available/assigned from LCSC.
LCSC-available in current BOM
  • KF128-5.08-2P-AA terminals — LCSC stock shown
  • LMR16030SDDAR buck regulator — LCSC stock shown
  • ESP32-S3-WROOM-1U-N16R8 — LCSC stock shown
  • AP2112K-3.3TRG1 — LCSC stock shown
  • TPS2051CDBVR — LCSC stock shown, but wrong for requirement because it is 0.5 A class and USB host target is 1 A
  • STTH212S diode — LCSC stock shown
  • SMBJ30CA TVS — LCSC part metadata present
Not confirmed / not LCSC-ready
  • ISO6741 digital isolator — no LCSC SKU/stock shown
  • ISO1212 isolated DI receivers — no LCSC SKU/stock shown
  • ISOW1044 isolated CAN transceiver — no LCSC SKU/stock shown
  • AD7329 ADC — no LCSC SKU/stock shown
  • JQC-3F-1C-24VDC relay — no LCSC SKU/stock shown
  • USB4105-GF-A USB-C connector — LCSC stock shown as 0
  • ULN2003A — LCSC stock shown as 0 for current selected part
  • Generic resistors/capacitors/inductor — not assigned to specific LCSC MPNs yet
  • Solenoid FET Driver 3.3V blocks — not production BOM-ready as discrete LCSC parts
So the design is not yet LCSC/JLCPCB procurement-ready. Next step should be a sourcing pass to replace/assign LCSC-stocked MPNs for the unavailable ICs, relay, USB connector, passives, inductor, and 1 A USB power switch.
Run sourcing pass
Fix USB switch
Assign passives
Resolve production risks
Check relay options

Waiting for input


Firmware Starter — ESP32-C3-MINI-1-N4
Platform
  • Framework: Arduino on PlatformIO
  • MCU/module: ESP32-C3-MINI-1-N4
  • Sensor: SHT41 on I2C
Pin Mapping

Table


FunctionESP32-C3 PinNetConnected To
USB D-GPIO18USB_DNJ1 D-, D1 ESD
USB D+GPIO19USB_DPJ1 D+, D1 ESD
I2C SDAGPIO6I2C_SDAU2 SDA, R5 4.7 kΩ pull-up
I2C SCLGPIO7I2C_SCLU2 SCL, R6 4.7 kΩ pull-up
Status LEDGPIO10STATUS_LEDR7 -> LED1
BOOTGPIO9ESP_BOOTR4 pull-up, SW1 to GND
Reset/EnableENESP_ENR3 pull-up, C6, SW2 to GND
platformio.ini

Ini


[env:esp32-c3-devkitm-1]
platform = espressif32
board = esp32-c3-devkitm-1
framework = arduino
monitor_speed = 115200
lib_deps =
    sensirion/Sensirion I2C SHT4x@^1.0.0
src/main.cpp

Cpp


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

#define I2C_SDA_PIN 6
#define I2C_SCL_PIN 7
#define STATUS_LED_PIN 10
#define SENSOR_READ_INTERVAL_MS 5000

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

SensirionI2CSht4x sht4x;
unsigned long lastReadMs = 0;

void initWiFi() {
  WiFi.mode(WIFI_STA);
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  Serial.print("Connecting to WiFi");
  for (int i = 0; i < 20 && WiFi.status() != WL_CONNECTED; ++i) {
    digitalWrite(STATUS_LED_PIN, !digitalRead(STATUS_LED_PIN));
    delay(500);
    Serial.print('.');
  }
  Serial.println();
  if (WiFi.status() == WL_CONNECTED) {
    Serial.print("WiFi IP: ");
    Serial.println(WiFi.localIP());
    digitalWrite(STATUS_LED_PIN, HIGH);
  } else {
    Serial.println("WiFi offline; continuing sensor logging over USB serial.");
    digitalWrite(STATUS_LED_PIN, LOW);
  }
}

void setup() {
  pinMode(STATUS_LED_PIN, OUTPUT);
  digitalWrite(STATUS_LED_PIN, LOW);
  Serial.begin(115200);
  delay(500);

  Wire.begin(I2C_SDA_PIN, I2C_SCL_PIN);
  sht4x.begin(Wire);

  uint32_t serialNumber = 0;
  int16_t error = sht4x.serialNumber(serialNumber);
  if (error) {
    Serial.print("SHT4x serial read failed: ");
    Serial.println(error);
  } else {
    Serial.print("SHT4x serial: ");
    Serial.println(serialNumber);
  }

  initWiFi();
}

void loop() {
  if (millis() - lastReadMs >= SENSOR_READ_INTERVAL_MS) {
    lastReadMs = millis();
    float temperatureC = 0.0f;
    float humidityRh = 0.0f;
    int16_t error = sht4x.measureHighPrecision(temperatureC, humidityRh);
    if (error) {
      Serial.print("SHT4x read failed: ");
      Serial.println(error);
      digitalWrite(STATUS_LED_PIN, LOW);
    } else {
      Serial.printf("T=%.2f C, RH=%.2f %%\n", temperatureC, humidityRh);
      digitalWrite(STATUS_LED_PIN, HIGH);
      // Production firmware can publish this payload via MQTT/HTTPS/BLE GATT.
    }
  }

  if (WiFi.status() != WL_CONNECTED) {
    static unsigned long lastReconnect = 0;
    if (millis() - lastReconnect > 30000) {
      lastReconnect = millis();
      initWiFi();
    }
  }
}
Build and Flash
  • Build: pio run
  • Flash over USB: hold SW1 BOOT, tap SW2 RESET if needed, then pio run -t upload
  • Monitor: pio device monitor
  • Platform

  • Pin Mapping

  • platformio.ini

  • src/main.cpp

  • Build and Flash