{
  "meta": {
    "title": "ESP32 Smart Audio + Sensing Node"
  },
  "symbols": {
    "esp32_s3_supermini": {
      "symbol_id": "esp32_s3_supermini",
      "category": "microcontroller",
      "body": { "width": 180, "height": 280 },
      "pins": [
        { "name": "3V3", "number": "1", "side": "left", "offset": 24, "type": "power_in" },
        { "name": "GND", "number": "2", "side": "left", "offset": 56, "type": "ground" },
        { "name": "GPIO5", "number": "10", "side": "right", "offset": 36, "type": "output" },
        { "name": "GPIO6", "number": "11", "side": "right", "offset": 66, "type": "output" },
        { "name": "GPIO7", "number": "12", "side": "right", "offset": 96, "type": "output" },
        { "name": "GPIO8", "number": "13", "side": "right", "offset": 126, "type": "input" },
        { "name": "GPIO9", "number": "14", "side": "right", "offset": 156, "type": "bidirectional" },
        { "name": "GPIO10", "number": "15", "side": "right", "offset": 186, "type": "bidirectional" },
        { "name": "GPIO11", "number": "16", "side": "right", "offset": 216, "type": "output" },
        { "name": "GPIO12", "number": "17", "side": "right", "offset": 246, "type": "output" }
      ],
      "graphics": {
        "primitives": [{ "type": "rect", "x": 0, "y": 0, "w": 180, "h": 280 }]
      }
    },
    "dac_i2s": {
      "symbol_id": "dac_i2s",
      "category": "audio",
      "body": { "width": 160, "height": 200 },
      "pins": [
        { "name": "3V3", "number": "1", "side": "left", "offset": 24, "type": "power_in" },
        { "name": "GND", "number": "2", "side": "left", "offset": 54, "type": "ground" },
        { "name": "BCLK", "number": "3", "side": "left", "offset": 86, "type": "input" },
        { "name": "LRCLK", "number": "4", "side": "left", "offset": 116, "type": "input" },
        { "name": "DIN", "number": "5", "side": "left", "offset": 146, "type": "input" },
        { "name": "AOUT", "number": "6", "side": "right", "offset": 96, "type": "analog" }
      ],
      "graphics": {
        "primitives": [{ "type": "rect", "x": 0, "y": 0, "w": 160, "h": 200 }]
      }
    },
    "amp": {
      "symbol_id": "amp",
      "category": "output",
      "body": { "width": 130, "height": 130 },
      "pins": [
        { "name": "5V", "number": "1", "side": "left", "offset": 22, "type": "power_in" },
        { "name": "GND", "number": "2", "side": "left", "offset": 52, "type": "ground" },
        { "name": "IN", "number": "3", "side": "left", "offset": 84, "type": "input" },
        { "name": "SPK", "number": "4", "side": "right", "offset": 74, "type": "output" }
      ],
      "graphics": {
        "primitives": [{ "type": "rect", "x": 0, "y": 0, "w": 130, "h": 130 }]
      }
    },
    "psu": {
      "symbol_id": "psu",
      "category": "power",
      "body": { "width": 140, "height": 140 },
      "pins": [
        { "name": "5V_OUT", "number": "1", "side": "right", "offset": 34, "type": "power_out" },
        { "name": "3V3_OUT", "number": "2", "side": "right", "offset": 70, "type": "power_out" },
        { "name": "GND", "number": "3", "side": "right", "offset": 104, "type": "ground" }
      ],
      "graphics": {
        "primitives": [{ "type": "rect", "x": 0, "y": 0, "w": 140, "h": 140 }]
      }
    },
    "imu_i2c": {
      "symbol_id": "imu_i2c",
      "category": "sensor",
      "body": { "width": 140, "height": 120 },
      "pins": [
        { "name": "3V3", "number": "1", "side": "left", "offset": 18, "type": "power_in" },
        { "name": "GND", "number": "2", "side": "left", "offset": 44, "type": "ground" },
        { "name": "SCL", "number": "3", "side": "left", "offset": 70, "type": "bidirectional" },
        { "name": "SDA", "number": "4", "side": "left", "offset": 96, "type": "bidirectional" }
      ]
    },
    "oled_i2c": {
      "symbol_id": "oled_i2c",
      "category": "display",
      "body": { "width": 140, "height": 120 },
      "pins": [
        { "name": "3V3", "number": "1", "side": "left", "offset": 18, "type": "power_in" },
        { "name": "GND", "number": "2", "side": "left", "offset": 44, "type": "ground" },
        { "name": "SCL", "number": "3", "side": "left", "offset": 70, "type": "bidirectional" },
        { "name": "SDA", "number": "4", "side": "left", "offset": 96, "type": "bidirectional" }
      ]
    },
    "mic_pre": {
      "symbol_id": "mic_pre",
      "category": "analog",
      "body": { "width": 150, "height": 120 },
      "pins": [
        { "name": "3V3", "number": "1", "side": "left", "offset": 20, "type": "power_in" },
        { "name": "GND", "number": "2", "side": "left", "offset": 48, "type": "ground" },
        { "name": "OUT", "number": "3", "side": "right", "offset": 62, "type": "analog" },
        { "name": "EN", "number": "4", "side": "left", "offset": 90, "type": "input" }
      ]
    },
    "debug_header": {
      "symbol_id": "debug_header",
      "category": "connector",
      "body": { "width": 130, "height": 80 },
      "pins": [
        { "name": "1", "number": "1", "side": "right", "offset": 24, "type": "bidirectional" },
        { "name": "GND", "number": "2", "side": "left", "offset": 24, "type": "ground" }
      ]
    }
  },
  "instances": [
    { "ref": "U1", "symbol": "esp32_s3_supermini", "properties": { "value": "ESP32-S3" }, "placement": { "x": null, "y": null, "rotation": 0, "locked": false } },
    { "ref": "U2", "symbol": "dac_i2s", "properties": { "value": "DAC" }, "placement": { "x": null, "y": null, "rotation": 0, "locked": false } },
    { "ref": "U3", "symbol": "amp", "properties": { "value": "Class-D Amp" }, "placement": { "x": null, "y": null, "rotation": 0, "locked": false } },
    { "ref": "U4", "symbol": "psu", "properties": { "value": "5V/3V3 Power" }, "placement": { "x": null, "y": null, "rotation": 0, "locked": false } },
    { "ref": "U5", "symbol": "imu_i2c", "properties": { "value": "IMU" }, "placement": { "x": null, "y": null, "rotation": 0, "locked": false } },
    { "ref": "U6", "symbol": "oled_i2c", "properties": { "value": "OLED" }, "placement": { "x": null, "y": null, "rotation": 0, "locked": false } },
    { "ref": "U7", "symbol": "mic_pre", "properties": { "value": "Mic Preamp" }, "placement": { "x": null, "y": null, "rotation": 0, "locked": false } },
    { "ref": "J1", "symbol": "debug_header", "properties": { "value": "Debug Header" }, "placement": { "x": null, "y": null, "rotation": 0, "locked": false } },
    { "ref": "R1", "part": "resistor", "properties": { "value": "10k" }, "placement": { "x": null, "y": null, "rotation": 0, "locked": false } },
    { "ref": "R2", "part": "resistor", "properties": { "value": "10k" }, "placement": { "x": null, "y": null, "rotation": 0, "locked": false } },
    { "ref": "C1", "part": "capacitor", "properties": { "value": "100nF" }, "placement": { "x": null, "y": null, "rotation": 0, "locked": false } },
    { "ref": "C2", "part": "capacitor", "properties": { "value": "100nF" }, "placement": { "x": null, "y": null, "rotation": 0, "locked": false } },
    { "ref": "C3", "part": "capacitor", "properties": { "value": "1uF" }, "placement": { "x": null, "y": null, "rotation": 0, "locked": false } }
  ],
  "nets": [
    { "name": "3V3", "class": "power", "nodes": [{ "ref": "U4", "pin": "3V3_OUT" }, { "ref": "U1", "pin": "3V3" }, { "ref": "U2", "pin": "3V3" }, { "ref": "U5", "pin": "3V3" }, { "ref": "U6", "pin": "3V3" }, { "ref": "U7", "pin": "3V3" }, { "ref": "R1", "pin": "1" }, { "ref": "R2", "pin": "1" }, { "ref": "C1", "pin": "1" }, { "ref": "C2", "pin": "1" }] },
    { "name": "5V", "class": "power", "nodes": [{ "ref": "U4", "pin": "5V_OUT" }, { "ref": "U3", "pin": "5V" }] },
    { "name": "GND", "class": "ground", "nodes": [{ "ref": "U4", "pin": "GND" }, { "ref": "U1", "pin": "GND" }, { "ref": "U2", "pin": "GND" }, { "ref": "U3", "pin": "GND" }, { "ref": "U5", "pin": "GND" }, { "ref": "U6", "pin": "GND" }, { "ref": "U7", "pin": "GND" }, { "ref": "J1", "pin": "GND" }, { "ref": "C1", "pin": "2" }, { "ref": "C2", "pin": "2" }, { "ref": "C3", "pin": "2" }] },
    { "name": "I2S_BCLK", "class": "clock", "nodes": [{ "ref": "U1", "pin": "GPIO5" }, { "ref": "U2", "pin": "BCLK" }] },
    { "name": "I2S_LRCLK", "class": "clock", "nodes": [{ "ref": "U1", "pin": "GPIO6" }, { "ref": "U2", "pin": "LRCLK" }] },
    { "name": "I2S_DOUT", "class": "signal", "nodes": [{ "ref": "U1", "pin": "GPIO7" }, { "ref": "U2", "pin": "DIN" }] },
    { "name": "AUDIO_ANALOG", "class": "analog", "nodes": [{ "ref": "U2", "pin": "AOUT" }, { "ref": "U3", "pin": "IN" }] },
    { "name": "I2C_SCL", "class": "clock", "nodes": [{ "ref": "U1", "pin": "GPIO9" }, { "ref": "U5", "pin": "SCL" }, { "ref": "U6", "pin": "SCL" }, { "ref": "R1", "pin": "2" }] },
    { "name": "I2C_SDA", "class": "signal", "nodes": [{ "ref": "U1", "pin": "GPIO10" }, { "ref": "U5", "pin": "SDA" }, { "ref": "U6", "pin": "SDA" }, { "ref": "R2", "pin": "2" }] },
    { "name": "MIC_ADC", "class": "analog", "nodes": [{ "ref": "U7", "pin": "OUT" }, { "ref": "U1", "pin": "GPIO8" }, { "ref": "C3", "pin": "1" }] },
    { "name": "MIC_EN", "class": "signal", "nodes": [{ "ref": "U1", "pin": "GPIO11" }, { "ref": "U7", "pin": "EN" }] },
    { "name": "DEBUG_TX", "class": "signal", "nodes": [{ "ref": "U1", "pin": "GPIO12" }, { "ref": "J1", "pin": "1" }] }
  ],
  "constraints": {
    "groups": [
      { "name": "power_stage", "members": ["U4"], "layout": "cluster" },
      { "name": "compute_audio", "members": ["U1", "U2", "U3", "U7"], "layout": "cluster" },
      { "name": "i2c_peripherals", "members": ["U5", "U6", "R1", "R2"], "layout": "cluster" },
      { "name": "support", "members": ["C1", "C2", "C3", "J1"], "layout": "cluster" }
    ],
    "alignment": [
      { "left_of": "U4", "right_of": "U1" },
      { "left_of": "U1", "right_of": "U2" },
      { "left_of": "U2", "right_of": "U3" }
    ],
    "near": [
      { "component": "C1", "target_pin": { "ref": "U1", "pin": "3V3" } },
      { "component": "C2", "target_pin": { "ref": "U2", "pin": "3V3" } },
      { "component": "C3", "target_pin": { "ref": "U1", "pin": "GPIO8" } }
    ]
  },
  "annotations": [
    { "text": "Smart audio + sensing node with I2S DAC, class-D amp, I2C peripherals, and mic ADC front-end." }
  ]
}
