hrithik18k/smart-switch-pcb

The AO3400A component models a SOT-23 N-channel MOSFET with labeled pins for Gate, Source, and Drain, including 3D CAD models and schematic symbols for electronic circuit design.

Version
1.0.1
License
unset
Stars
0

index.circuit.tsx

PCBPCB preview for index.circuit.tsx
SchematicSchematic preview for index.circuit.tsx
import { ESP32_C3_MINI_1_N4 } from "./imports/ESP32_C3_MINI_1_N4";
import { TTP223_TD } from "./imports/TTP223_TD";
import { AP2112K_3_3TRG1 } from "./imports/AP2112K_3_3TRG1";
import { AO3400A } from "./imports/AO3400A";

// CAD envelope: 17.5 x 40 x 1.6 mm, holes at (+/-5.75, +/-17) mm.
// SELV controller only: use an external certified isolated 5 V supply and relay.
const TouchElectrode = () => (
  <chip
    name="TP1"
    pcbX={0}
    pcbY={0}
    layer="bottom"
    pinLabels={{ pin1: ["SENSE"] }}
    footprint={
      <footprint>
        <smtpad
          portHints={["pin1"]}
          layer="bottom"
          shape="rect"
          width="9mm"
          height="11mm"
          rectBorderRadius="1.5mm"
          coveredWithSolderMask
        />
        <silkscreenrect
          layer="bottom"
          width="10mm"
          height="12mm"
          strokeWidth="0.2mm"
        />
        <silkscreentext
          text="TOUCH"
          pcbY="-6.8mm"
          layer="bottom"
          fontSize="0.8mm"
        />
      </footprint>
    }
  />
);

const ControlConnector = (props: any) => (
  <chip
    {...props}
    pinLabels={{
      pin1: ["V5"],
      pin2: ["GND"],
      pin3: ["RELAY_LOW"],
      pin4: ["UART_RX"],
    }}
    footprint={
      <footprint>
        <smtpad
          portHints={["pin1"]}
          pcbX={-1.905}
          layer="top"
          shape="rect"
          width="0.7mm"
          height="1.6mm"
        />
        <smtpad
          portHints={["pin2"]}
          pcbX={-0.635}
          layer="top"
          shape="rect"
          width="0.7mm"
          height="1.6mm"
        />
        <smtpad
          portHints={["pin3"]}
          pcbX={0.635}
          layer="top"
          shape="rect"
          width="0.7mm"
          height="1.6mm"
        />
        <smtpad
          portHints={["pin4"]}
          pcbX={1.905}
          layer="top"
          shape="rect"
          width="0.7mm"
          height="1.6mm"
        />
        <silkscreenrect width="5.6mm" height="2.2mm" strokeWidth="0.15mm" />
      </footprint>
    }
  />
);

export default function SmartSwitchController() {
  return (
    <board
      width="17.5mm"
      height="40mm"
      thickness="1.6mm"
      borderRadius="0.6mm"
      schAutoLayoutEnabled
    >
      <net name="V5" isPowerNet />
      <net name="V3V3" isPowerNet />
      <net name="GND" isGroundNet />
      <schematicsection name="power" displayName="SELV power" />
      <schematicsection name="control" displayName="ESP32-C3 control" />
      <schematicsection name="touch" displayName="Capacitive touch" />
      <schematicsection name="output" displayName="Power-board relay driver" />

      <hole name="H1" pcbX={-5.75} pcbY={-17} diameter="1.8mm" />
      <hole name="H2" pcbX={5.75} pcbY={-17} diameter="1.8mm" />
      <hole name="H3" pcbX={-5.75} pcbY={17} diameter="1.8mm" />
      <hole name="H4" pcbX={5.75} pcbY={17} diameter="1.8mm" />
      <pinheader
        name="J1"
        pinCount={3}
        pitch="2.54mm"
        pcbX={0}
        pcbY={-17}
        schX={-10.42}
        schY={1}
        schHeight={0.6}
        schSectionName="power"
        connections={{
          pin1: "net.V5",
          pin2: "net.GND",
          pin3: "net.RELAY_LOW",
        }}
      />
      <AP2112K_3_3TRG1
        name="U2"
        pcbX={0}
        pcbY={16.5}
        pcbRotation={0}
        schX={-6.58}
        schY={1}
        schHeight={0.6}
        schSectionName="power"
        connections={{
          VIN: "net.V5",
          EN: "net.V5",
          GND: "net.GND",
          VOUT: "net.V3V3",
        }}
      />
      <capacitor
        name="C1"
        capacitance="10uF"
        footprint="0603"
        pcbX={-3.5}
        pcbY={15}
        schX={-4.8}
        schY={2.5}
        schOrientation="vertical"
        schSectionName="power"
        connections={{ pin1: "net.V5", pin2: "net.GND" }}
      />
      <capacitor
        name="C2"
        capacitance="10uF"
        footprint="0603"
        pcbX={3.5}
        pcbY={15}
        schX={1.82}
        schY={1}
        schOrientation="vertical"
        schSectionName="power"
        connections={{ pin1: "net.V3V3", pin2: "net.GND" }}
      />

      <ESP32_C3_MINI_1_N4
        name="U1"
        pcbX={0}
        pcbY={8.2}
        pcbRotation={180}
        schX={-2.42}
        schY={0}
        schHeight={6.2}
        schSectionName="control"
        connections={{
          "3V3": "net.V3V3",
          GND1: "net.GND",
          GND2: "net.GND",
          GND3: "net.GND",
          GND4: "net.GND",
          GND5: "net.GND",
          GND6: "net.GND",
          GND7: "net.GND",
          GND8: "net.GND",
          GND9: "net.GND",
          GND10: "net.GND",
          GND11: "net.GND",
          GND12: "net.GND",
          GND13: "net.GND",
          GND14: "net.GND",
          GND15: "net.GND",
          GND16: "net.GND",
          GND17: "net.GND",
          GND18: "net.GND",
          GND19: "net.GND",
          GND20: "net.GND",
          GND21: "net.GND",
          GND22: "net.GND",
          EN: "net.EN",
          IO4: "net.TOUCH_OUT",
          IO5: "net.RELAY_EN",
        }}
      />
      <resistor
        name="R1"
        resistance="10k"
        footprint="0402"
        pcbX={7.3}
        pcbY={15.5}
        schX={3}
        schY={2}
        schSectionName="control"
        connections={{ pin1: "net.V3V3", pin2: "net.EN" }}
      />
      <capacitor
        name="C3"
        capacitance="100nF"
        footprint="0402"
        pcbX={-6.8}
        pcbY={-9.0}
        schX={5}
        schY={2}
        schOrientation="vertical"
        schSectionName="control"
        connections={{ pin1: "net.V3V3", pin2: "net.GND" }}
      />

      <TTP223_TD
        name="U3"
        pcbX={-7.2}
        pcbY={-12}
        pcbRotation={0}
        schX={1.02}
        schY={0}
        schSectionName="touch"
        connections={{
          OUT: "net.TOUCH_OUT",
          GND: "net.GND",
          SO: "net.TOUCH_SENSE",
          SLH: "net.GND",
          VDD: "net.V3V3",
          STG: "net.GND",
        }}
      />
      <TouchElectrode />
      <trace from=".TP1 > .SENSE" to="net.TOUCH_SENSE" />
      <capacitor
        name="C4"
        capacitance="100nF"
        footprint="0402"
        pcbX={6.8}
        pcbY={-4.5}
        schX={7.38}
        schY={0}
        schOrientation="vertical"
        schSectionName="touch"
        connections={{ pin1: "net.V3V3", pin2: "net.GND" }}
      />

      <resistor
        name="R2"
        resistance="100"
        footprint="0402"
        pcbX={6.8}
        pcbY={-7.0}
        schX={-6}
        schY={-2}
        schSectionName="output"
        connections={{ pin1: "net.RELAY_EN", pin2: "net.RELAY_GATE" }}
      />
      <resistor
        name="R3"
        resistance="100k"
        footprint="0402"
        pcbX={-6.8}
        pcbY={-5.0}
        schX={-5}
        schY={-1}
        schSectionName="output"
        connections={{ pin1: "net.RELAY_GATE", pin2: "net.GND" }}
      />
      <AO3400A
        name="Q1"
        pcbX={7.2}
        pcbY={-12.0}
        pcbRotation={90}
        schX={4.77}
        schY={0}
        symbol={undefined}
        schWidth={0.8}
        schHeight={0.4}
        schSectionName="output"
        connections={{ G: "net.RELAY_GATE", S: "net.GND", D: "net.RELAY_LOW" }}
      />
      <diode
        name="D1"
        footprint="sod323"
        pcbX={0}
        pcbY={-13}
        pcbRotation={90}
        schX={5.76}
        schY={0.6}
        schSectionName="output"
        connections={{ cathode: "net.V5", anode: "net.RELAY_LOW" }}
      />

      <silkscreentext
        text="SMART SWITCH CTRL"
        pcbX={0}
        pcbY={19}
        fontSize="0.65mm"
      />
      <silkscreentext
        text="5V GND COIL"
        pcbX={0}
        pcbY={-19}
        fontSize="0.55mm"
      />
    </board>
  );
}