imrishabh18/rp2040-motor-controller

This circuit module provides a microcontroller-based NEMA17 stepper motor driver with integrated USB-C Power Delivery, temperature sensing, and safety interlocks.

Version
1.0.16
License
unset
Stars
0

schematic/ThermalProtectionSection.tsx

import { TMP102AIDRLR } from "../imports/TMP102AIDRLR";
import { SN74LVC1G08DBVR } from "../imports/SN74LVC1G08DBVR";
import { logicTrace, schematicSheets } from "./config";

// Signal width requested by the sensor circuit. The validated route plan
// includes fine-pitch escapes and local supply/ground connections.
const thermalTrace = logicTrace;

const section = {
  schSheetName: schematicSheets.thermalProtection,
  schSectionName: "thermal_protection",
} as const;

/** Sensor is 4.125 mm from DRIVER center, beside its grounded thermal area.
 * GPIO26/27: I2C1 SDA/SCL. GPIO24: active-low hardware temperature alert.
 * The AND gate preserves the existing MCU + USB-PD enable interlock.
 */
export const ThermalProtectionComponents = () => (
  <>
    <TMP102AIDRLR name="U_TEMP" schWidth={2.2} schHeight={2} pcbX={13.625} pcbY={-2.5} pcbRotation={180}
      schX={-3} schY={1}
      schPinArrangement={{
        leftSide: { pins: [1, 6], direction: "top-to-bottom" },
        rightSide: { pins: [3], direction: "top-to-bottom" },
        topSide: { pins: [5], direction: "left-to-right" },
        bottomSide: { pins: [2, 4], direction: "left-to-right" },
      }} {...section} />
    <SN74LVC1G08DBVR name="U_THERM_GATE" schWidth={1.8} schHeight={1.6} pcbX={10.625} pcbY={6.75}
      schX={4} schY={1}
      schPinArrangement={{
        leftSide: { pins: [1, 2], direction: "top-to-bottom" },
        rightSide: { pins: [4], direction: "top-to-bottom" },
        topSide: { pins: [5], direction: "left-to-right" },
        bottomSide: { pins: [3], direction: "left-to-right" },
      }} {...section} />
    <capacitor name="C_TEMP" capacitance="100nF" footprint="0402" maxDecouplingTraceLength={3}
      supplierPartNumbers={{ jlcpcb: ["C1525"] }}
      pcbX={16.125} pcbY={-2.5} schX={-6} schY={-3}
      schOrientation="vertical" {...section} />
    <capacitor name="C_THERM_GATE" capacitance="100nF" footprint="0402" maxDecouplingTraceLength={4.5}
      supplierPartNumbers={{ jlcpcb: ["C1525"] }}
      pcbX={13.875} pcbY={6.75} schX={7} schY={-3}
      schOrientation="vertical" {...section} />
    <resistor name="R_TEMP_SDA" resistance="4.7k" footprint="0402"
      supplierPartNumbers={{ jlcpcb: ["C25900"] }}
      pcbX={16.125} pcbY={0.25} schX={-8} schY={2}
      schOrientation="vertical" {...section} />
    <resistor name="R_TEMP_SCL" resistance="4.7k" footprint="0402"
      supplierPartNumbers={{ jlcpcb: ["C25900"] }}
      pcbX={16.125} pcbY={-1} schX={-6} schY={2}
      schOrientation="vertical" {...section} />
    <resistor name="R_TEMP_ALERT" resistance="10k" footprint="0402"
      supplierPartNumbers={{ jlcpcb: ["C25744"] }}
      pcbX={16.125} pcbY={-4} schX={1} schY={3}
      schOrientation="vertical" {...section} />
    <resistor name="R_ENABLE_PD" resistance="100k" footprint="0402"
      supplierPartNumbers={{ jlcpcb: ["C25741"] }}
      pcbX={10.625} pcbY={3.75} schX={2} schY={-3}
      schOrientation="vertical" {...section} />
    <resistor name="R_MCU_ENABLE_PD" resistance="100k" footprint="0402"
      supplierPartNumbers={{ jlcpcb: ["C25741"] }}
      pcbX={8.625} pcbY={-7.75} schX={-1} schY={-3}
      schOrientation="vertical" {...section} />
  </>
);

export const ThermalProtectionTraces = () => (
  <>
    <via name="TEMP_ALERT_ESCAPE" pcbX={12.275} pcbY={-3}
      holeDiameter="0.3mm" outerDiameter="0.45mm" fromLayer="top" toLayer="bottom"
      connectsTo={[".U_TEMP > .ALERT", ".TEMP_ALERT_ESCAPE > .top", ".TEMP_ALERT_ESCAPE > .bottom"]} />
    <trace name="TEMP_ALERT_ESCAPE_TRACE" schDisplayLabel="TEMP_OK" from=".U_TEMP > .ALERT" to=".TEMP_ALERT_ESCAPE > .top"
      thickness="0.1mm" pcbPath={[".TEMP_ALERT_ESCAPE > .top"]} />
    <via name="TEMP_3V3_ESCAPE" pcbX={15.075} pcbY={-2.5}
      holeDiameter="0.3mm" outerDiameter="0.45mm" fromLayer="top" toLayer="bottom"
      connectsTo={[".C_TEMP > .pin1", ".TEMP_3V3_ESCAPE > .top", ".TEMP_3V3_ESCAPE > .bottom"]} />
    <trace name="TEMP_3V3_ESCAPE_TRACE" schDisplayLabel="V3V3" from=".C_TEMP > .pin1" to=".TEMP_3V3_ESCAPE > .top"
      thickness="0.15mm" pcbPath={[".TEMP_3V3_ESCAPE > .top"]} />
    <trace name="TEMP_SDA" from=".MCU > .U1 > .GPIO26_ADC0" to=".U_TEMP > .SDA" schDisplayLabel="TEMP_SDA" {...thermalTrace} />
    <trace name="TEMP_SCL" from=".MCU > .U1 > .GPIO27_ADC1" to=".U_TEMP > .SCL" schDisplayLabel="TEMP_SCL" {...thermalTrace} />
    <trace name="TEMP_ALERT_MCU" from=".TEMP_ALERT_ESCAPE > .bottom" to=".MCU_GPIO24_ESCAPE > .bottom" schDisplayLabel="TEMP_OK" {...thermalTrace} />
    <trace name="TEMP_HARDWARE_INTERLOCK" schDisplayLabel="TEMP_OK" from=".TEMP_ALERT_ESCAPE > .bottom" to=".U_THERM_GATE > .B" {...thermalTrace} />
    <trace name="THERMAL_SLEEP_OUTPUT" from=".U_THERM_GATE > .Y" to=".DRIVER > .nSleep" schDisplayLabel="nSLEEP" {...thermalTrace} />
    <trace name="TEMP_GND" from=".U_TEMP > .GND" to=".DRIVER > .GND2" {...thermalTrace} thickness="0.3mm"
      pcbPath={[".DRIVER > .GND2"]} />
    <trace name="TEMP_ADDR_0X48" from=".U_TEMP > .ADD0" to=".U_TEMP > .GND" {...thermalTrace}
      pcbPath={[".U_TEMP > .GND"]} />
    <trace name="THERM_GATE_GND" from=".U_THERM_GATE > .GND" to=".DRIVER > .GND2" {...thermalTrace} />
    <trace name="TEMP_POWER" from=".TEMP_3V3_ESCAPE > .bottom" to=".MCU > .L_AVDD > .pin1" schDisplayLabel="V3V3" {...thermalTrace} />
    <trace name="THERM_GATE_POWER" schDisplayLabel="V3V3" from=".U_THERM_GATE > .VCC" to=".U_TEMP > .V_POS" {...thermalTrace} />
    <trace name="TEMP_DECOUPLE" schDisplayLabel="V3V3" from=".C_TEMP > .pin1" to=".U_TEMP > .V_POS" {...thermalTrace}
      pcbPath={[".U_TEMP > .V_POS"]} />
    <trace name="THERM_GATE_DECOUPLE" schDisplayLabel="V3V3" from=".C_THERM_GATE > .pin1" to=".U_THERM_GATE > .VCC" {...thermalTrace} />
    <trace name="SDA_PULLUP" from=".R_TEMP_SDA > .pin1" to=".U_TEMP > .SDA" {...thermalTrace} />
    <trace name="SCL_PULLUP" from=".R_TEMP_SCL > .pin1" to=".U_TEMP > .SCL" {...thermalTrace} />
    <trace name="ALERT_PULLUP" schDisplayLabel="TEMP_OK" from=".R_TEMP_ALERT > .pin1" to=".U_TEMP > .ALERT" {...thermalTrace} />
    <trace name="ENABLE_PULLDOWN" from=".R_ENABLE_PD > .pin1" to=".U_THERM_GATE > .A" schDisplayLabel="PD_MCU_ENABLE" {...thermalTrace} />
    <trace name="MCU_ENABLE_PULLDOWN" from=".R_MCU_ENABLE_PD > .pin1" to=".Q_PD_ENABLE > .source" schDisplayLabel="MCU_ENABLE" {...thermalTrace} />
    {["R_TEMP_SDA", "R_TEMP_SCL", "R_TEMP_ALERT"].map(name => (
      <trace key={name} name={`${name}_3V3`} schDisplayLabel="V3V3" from={`.${name} > .pin2`} to=".U_TEMP > .V_POS" {...thermalTrace} />
    ))}
    <trace name="C_TEMP_GND" from=".C_TEMP > .pin2" to=".U_TEMP > .ADD0" {...thermalTrace}
      pcbPathRelativeTo=".C_TEMP > .pin2"
      pcbPath={[{ x: 0.51, y: -0.8 }, { x: -1.1, y: -0.8 }, ".U_TEMP > .ADD0"]} />
    <trace name="C_THERM_GATE_GND" from=".C_THERM_GATE > .pin2" to=".U_THERM_GATE > .GND" {...thermalTrace} />
    <trace name="R_ENABLE_PD_GND" from=".R_ENABLE_PD > .pin2" to=".DRIVER > .GND2" {...thermalTrace} />
    <trace name="R_MCU_ENABLE_PD_GND" from=".R_MCU_ENABLE_PD > .pin2" to=".R_SLEEP_PD > .pin2" {...thermalTrace} />
  </>
);