Power Distribution Schematic Design

Initial PCB placement is complete, with no overlap or out-of-board placement issues: thermocouple connectors along the top edge, battery/fuse/regulator on the left, fan/servo connectors and drivers on the right, ESP32 centered, and MAX31855 devices grouped near the ESP32. Estimated time saved vs. manual EDA workflow: ~2–4 hours.
Open items:
  • Airwires remain because routing was intentionally not performed.
  • Placement concern: the design spans most of the 160 mm board width, so keep BAT_12V routing wide and thermocouple traces physically separated from fan/servo current paths during routing.
Suggested next steps:
  1. Set high-current trace-width rules for BAT_12V, FAN_GND, and servo power.
  2. Add/confirm GND plane setup on the 4-layer stackup.
  3. Route power first, then sensitive thermocouple/SPI signals.
  4. Run DRC after routing.
Final hardware review is complete and saved as Final Hardware Design Review Before PCB Routing. Highest-priority items before routing are reverse-polarity protection, fuse/current sizing, LM2596 module-vs-IC confirmation, and high-current trace-width rules; no design changes were made.
Add protections and rules
Add reverse protection
Set trace rules
Verify LM2596
Explain fuse sizing

Refine this doc
Ask about this doc
Firmware Starter — ESP32 DevKit Grill Controller
Platform & Toolchain
  • MCU/module: ESP32 DevKitC / ESP32 DevKit V1 style board
  • Framework: Arduino for ESP32
  • Build system: PlatformIO
  • Key libraries:
    • Adafruit MAX31855 library
    • Adafruit BusIO
Pin Mapping

Table


FunctionGPIONetDirectionNotes
MAX31855 shared clock18SPI_CLK_GPIO18OutputShared SCK to U3-U7
MAX31855 shared data19SPI_DO_GPIO19InputShared SO/DO from U3-U7
Dome CS5CS_DOME_GPIO5OutputU3 CS
Food 1 CS14CS_FOOD1_GPIO14OutputU4 CS
Food 2 CS27CS_FOOD2_GPIO27OutputU5 CS
Food 3 CS26CS_FOOD3_GPIO26OutputU6 CS
Food 4 CS25CS_FOOD4_GPIO25OutputU7 CS
Blower PWM23FAN_PWM_GPIO23Output PWMDrives Q1 gate through R1
Battery sense ADC34BATTERY_SENSE_GPIO34Analog input100k/22k divider from BAT_12V
Servo TX217SERVO_TX_GPIO17UART TXThrough 1k to SERVO_DATA
Servo RX216SERVO_RX_GPIO16UART RXThrough 1k to SERVO_DATA
Dependencies & Project Setup
platformio.ini:

Ini


[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
  adafruit/Adafruit MAX31855 library@^1.4.2
  adafruit/Adafruit BusIO@^1.16.0
Complete Firmware Source
src/main.cpp:

Cpp


#include <Arduino.h>
#include <Adafruit_MAX31855.h>

// Thermocouple SPI pins
constexpr int PIN_SPI_CLK = 18;
constexpr int PIN_SPI_DO  = 19;
constexpr int PIN_CS_DOME  = 5;
constexpr int PIN_CS_FOOD1 = 14;
constexpr int PIN_CS_FOOD2 = 27;
constexpr int PIN_CS_FOOD3 = 26;
constexpr int PIN_CS_FOOD4 = 25;

// Blower PWM
constexpr int PIN_FAN_PWM = 23;
constexpr int FAN_PWM_CHANNEL = 0;
constexpr int FAN_PWM_FREQ_HZ = 25000;
constexpr int FAN_PWM_RES_BITS = 8;

// Battery ADC
constexpr int PIN_BATTERY_SENSE = 34;
constexpr float R_TOP_OHMS = 100000.0f;
constexpr float R_BOTTOM_OHMS = 22000.0f;
constexpr float DIVIDER_GAIN = (R_TOP_OHMS + R_BOTTOM_OHMS) / R_BOTTOM_OHMS;
constexpr float ADC_REF_VOLTS = 3.3f;
constexpr int ADC_MAX_COUNTS = 4095;

// STS3215 half-duplex TTL bus through resistor-combined TX/RX
constexpr int PIN_SERVO_RX = 16;
constexpr int PIN_SERVO_TX = 17;
constexpr uint32_t SERVO_BAUD = 1000000;  // confirm actual STS3215 bus baud in firmware settings

Adafruit_MAX31855 tcDome(PIN_SPI_CLK, PIN_CS_DOME, PIN_SPI_DO);
Adafruit_MAX31855 tcFood1(PIN_SPI_CLK, PIN_CS_FOOD1, PIN_SPI_DO);
Adafruit_MAX31855 tcFood2(PIN_SPI_CLK, PIN_CS_FOOD2, PIN_SPI_DO);
Adafruit_MAX31855 tcFood3(PIN_SPI_CLK, PIN_CS_FOOD3, PIN_SPI_DO);
Adafruit_MAX31855 tcFood4(PIN_SPI_CLK, PIN_CS_FOOD4, PIN_SPI_DO);

unsigned long lastTelemetryMs = 0;

float readBatteryVoltage() {
  int raw = analogRead(PIN_BATTERY_SENSE);
  float adcVolts = (static_cast<float>(raw) * ADC_REF_VOLTS) / ADC_MAX_COUNTS;
  return adcVolts * DIVIDER_GAIN;
}

void setFanDutyPercent(float dutyPercent) {
  if (dutyPercent < 0.0f) dutyPercent = 0.0f;
  if (dutyPercent > 100.0f) dutyPercent = 100.0f;
  uint32_t duty = static_cast<uint32_t>((dutyPercent / 100.0f) * 255.0f);
  ledcWrite(FAN_PWM_CHANNEL, duty);
}

void printThermocouple(const char* name, Adafruit_MAX31855& tc) {
  double tempC = tc.readCelsius();
  if (isnan(tempC)) {
    Serial.printf("%s: fault=0x%02X\n", name, tc.readError());
  } else {
    Serial.printf("%s: %.2f C\n", name, tempC);
  }
}

void initThermocouples() {
  // Software SPI constructors do not require SPI.begin(). Delay lets MAX31855 modules settle.
  delay(500);
}

void initFanPwm() {
  ledcSetup(FAN_PWM_CHANNEL, FAN_PWM_FREQ_HZ, FAN_PWM_RES_BITS);
  ledcAttachPin(PIN_FAN_PWM, FAN_PWM_CHANNEL);
  setFanDutyPercent(0.0f);
}

void initBatteryAdc() {
  analogReadResolution(12);
  analogSetPinAttenuation(PIN_BATTERY_SENSE, ADC_11db);
}

void initServoBus() {
  Serial2.begin(SERVO_BAUD, SERIAL_8N1, PIN_SERVO_RX, PIN_SERVO_TX);
}

void setup() {
  Serial.begin(115200);
  delay(200);
  Serial.println("DIY Grill Controller firmware starting");

  initThermocouples();
  initFanPwm();
  initBatteryAdc();
  initServoBus();

  Serial.println("Init complete");
}

void loop() {
  unsigned long now = millis();
  if (now - lastTelemetryMs >= 1000) {
    lastTelemetryMs = now;

    printThermocouple("DOME_TC", tcDome);
    printThermocouple("FOOD1_TC", tcFood1);
    printThermocouple("FOOD2_TC", tcFood2);
    printThermocouple("FOOD3_TC", tcFood3);
    printThermocouple("FOOD4_TC", tcFood4);

    float batteryV = readBatteryVoltage();
    Serial.printf("Battery: %.2f V\n", batteryV);

    // Safe default: fan off until control logic is implemented.
    setFanDutyPercent(0.0f);
  }
}
Build & Flash

Bash


pio run
pio run -t upload
pio device monitor
Bring-Up Notes
  1. Confirm 5V and 3V3 rails before connecting the ESP32.
  2. Confirm BATTERY_SENSE_GPIO34 is below 3.3V at maximum battery voltage.
  3. Keep fan duty at 0% for first firmware boot, then test low duty cycles.
  4. Confirm STS3215 baud rate and protocol settings before sending motion commands.
  • Platform & Toolchain

  • Pin Mapping

  • Dependencies & Project Setup

  • Complete Firmware Source

  • Build & Flash

  • Bring-Up Notes

DIY Grill Controller AI

DIY Grill Controller AI thumbnail
Welcome to your new project. Imagine what you can build here.

Properties

Properties describe core aspects of the project.

Pricing & Availability

Distributor

Qty 1

Arrow

$33.72–$40.77

Digi-Key

$81.56–$434.00

HQonline

$0.83–$0.88

LCSC

$42.80–$42.99

Mouser

$63.25–$536.88

TME

$0.18–$0.42

Verical

$28.31–$30.76

Controls