{
  "version": "0.1",
  "title": "Pinto tree-jumping squirrel robot: wiring",
  "components": [
    {
      "id": "board-squirrelbrain-v2",
      "name": "squirrelbrain v2 (Pinto main control board)",
      "kind": "board",
      "outline": [
        0.027,
        0.027
      ],
      "holes": [
        [
          0.02481,
          0.02481,
          0.0022
        ],
        [
          0.00219,
          0.02481,
          0.0022
        ],
        [
          0.02481,
          0.00219,
          0.0022
        ]
      ],
      "source": "https://github.com/qwertpas/squirrelbrain/blob/37f06da4e034332678634c682fda11ad8d369ee7/v2/squirrelbrain.kicad_pcb",
      "ports": [
        {
          "id": "xt30-batt-in",
          "label": "J4 BATT: XT30U-M battery input (5-15 V); pin 1 GND at (19.5, 3.4), pin 2 +BATT at (14.5, 3.4)",
          "type": "power",
          "position": [
            0.017,
            0.0034,
            0.0023
          ]
        },
        {
          "id": "xt30-motor-out",
          "label": "J5 BLDC_PWR: XT30U-F load-switched power output to the motor drivers (38 A limit); pin 1 GND at (3.25, 3.4), pin 2 BLDC…",
          "type": "power",
          "position": [
            0.00575,
            0.0034,
            0.0023
          ]
        },
        {
          "id": "dxl-ttl",
          "label": "J2: Dynamixel 5 V TTL bus (pin 1 GND at y=14.5, pin 2 +5V switched at y=17, pin 3 DATA at y=19.5; pins at x=2.1)",
          "type": "serial-servo",
          "position": [
            0.00261,
            0.0168,
            0.0023
          ]
        },
        {
          "id": "rs485-0-jst",
          "label": "J1: RS-485 bus 0 (A, B) on JST-SH 2-pin; the bus the brain2 firmware uses (rs485_0) for the O32controllers",
          "type": "uart",
          "position": [
            0.0069,
            0.0094,
            0.0023
          ]
        },
        {
          "id": "rs485-1-jst",
          "label": "J3: RS-485 bus 1 (A, B) on JST-SH 2-pin; unused by the brain2 firmware",
          "type": "signal",
          "position": [
            0.0201,
            0.0094,
            0.0023
          ]
        },
        {
          "id": "rs485-0-ffc",
          "label": "J7: RS-485 bus 0 + 3.3 V + GND on 4-pin 0.5 mm FFC (on the XIAO face); same bus as rs485-0-jst",
          "type": "uart",
          "position": [
            0.00207,
            0.00975,
            0.0023
          ]
        },
        {
          "id": "rs485-1-ffc",
          "label": "J8: RS-485 bus 1 + 3.3 V + GND on 4-pin 0.5 mm FFC (on the XIAO face)",
          "type": "signal",
          "position": [
            0.02494,
            0.00695,
            0.0023
          ]
        },
        {
          "id": "gpio-header",
          "label": "J6 GPIO1: 4-pin socket, pin 1 current-sense output (y=20.8), pin 2 GPIO1, pin 3 +5V, pin 4 GND (y=13.18)",
          "type": "signal",
          "position": [
            0.02485,
            0.01699,
            0.0023
          ]
        },
        {
          "id": "xiao-module",
          "label": "U4: Seeed Studio XIAO ESP32S3 module (on the opposite face), footprint outline 17.8 x 21.15 mm",
          "type": "signal",
          "position": [
            0.0135,
            0.01643,
            0.0023
          ]
        },
        {
          "id": "xiao-usb-c",
          "label": "USB-C on the XIAO ESP32S3 (programming / serial); overhangs the board edge by 1.424 mm",
          "type": "usb",
          "position": [
            0.0135,
            0.02475,
            0.0023
          ]
        }
      ]
    },
    {
      "id": "board-o32controller-v3",
      "name": "O32controller v3 (Pinto brushless motor driver)",
      "kind": "board",
      "outline": [
        0.027,
        0.027
      ],
      "holes": [
        [
          0.00219,
          0.00219,
          0.002
        ],
        [
          0.02481,
          0.00219,
          0.002
        ],
        [
          0.00219,
          0.02481,
          0.002
        ],
        [
          0.02481,
          0.02481,
          0.002
        ]
      ],
      "source": "https://github.com/qwertpas/O32controller/blob/ad33b9693df4db032494eeab119caefca8233950/v3/O32controller.kicad_pcb",
      "ports": [
        {
          "id": "batt-plus-1",
          "label": "J1 BATT+ solder-wire pad (7-15 V in)",
          "type": "power",
          "position": [
            0.01995,
            0.0016,
            0.0023
          ]
        },
        {
          "id": "batt-plus-2",
          "label": "J2 BATT+ solder-wire pad",
          "type": "power",
          "position": [
            0.01995,
            0.0254,
            0.0023
          ]
        },
        {
          "id": "batt-minus-1",
          "label": "J3 BATT- (GND) solder-wire pad",
          "type": "power",
          "position": [
            0.02535,
            0.00995,
            0.0023
          ]
        },
        {
          "id": "batt-minus-2",
          "label": "J4 BATT- (GND) solder-wire pad",
          "type": "power",
          "position": [
            0.02535,
            0.01715,
            0.0023
          ]
        },
        {
          "id": "phase-u",
          "label": "J10 motor phase U solder-wire pad",
          "type": "motor",
          "position": [
            0.02535,
            0.02095,
            0.0023
          ]
        },
        {
          "id": "phase-v",
          "label": "J11 motor phase V solder-wire pad",
          "type": "motor",
          "position": [
            0.02535,
            0.01375,
            0.0023
          ]
        },
        {
          "id": "phase-w",
          "label": "J12 motor phase W solder-wire pad",
          "type": "motor",
          "position": [
            0.02535,
            0.00655,
            0.0023
          ]
        },
        {
          "id": "rs485-a",
          "label": "J9 RS-485 (A, B) JST-SH 2-pin, on the B.Cu face; daisy-chain port 1",
          "type": "signal",
          "position": [
            0.00253,
            0.0155,
            0.0023
          ]
        },
        {
          "id": "rs485-b",
          "label": "J8 RS-485 (A, B) JST-SH 2-pin, on the B.Cu face; daisy-chain port 2 (same nets as J9)",
          "type": "signal",
          "position": [
            0.00253,
            0.0205,
            0.0023
          ]
        },
        {
          "id": "swd",
          "label": "J6 SWD programming + UART_TX (pin 1 USART_TX, 2 SWDIO, 3 SWCLK, 4 GND), on the B.Cu face",
          "type": "uart",
          "position": [
            0.0029,
            0.00795,
            0.0023
          ]
        },
        {
          "id": "aux-uart-pads",
          "label": "J7 AuxUART solder pads (3.3V, TX, RX, GND at 1.27 mm), F.Cu face",
          "type": "uart",
          "position": [
            0.00158,
            0.00655,
            0.0023
          ]
        },
        {
          "id": "unstated-power",
          "label": "connector not stated",
          "type": "power"
        },
        {
          "id": "unstated-uart",
          "label": "connector not stated",
          "type": "uart"
        }
      ]
    },
    {
      "id": "board-o12encoder-v2",
      "name": "O12encoder v2 (Pinto magnetic encoder, MA702 on RS-485)",
      "kind": "board",
      "outline": [
        0.01404,
        0.01404
      ],
      "holes": [
        [
          0.002,
          0.00355,
          0.002
        ],
        [
          0.01204,
          0.00935,
          0.002
        ],
        [
          0.01049,
          0.00355,
          0.002
        ],
        [
          0.002,
          0.01204,
          0.002
        ],
        [
          0.00469,
          0.002,
          0.002
        ],
        [
          0.01049,
          0.01204,
          0.002
        ]
      ],
      "source": "https://github.com/qwertpas/O12encoder/blob/0a91237a1392d682838a0372b27c514d69a083ca/v2/O12encoder.kicad_pcb",
      "ports": [
        {
          "id": "ffc-1",
          "label": "J4: 4-pin 0.5 mm FFC, power + RS-485 (daisy-chain port), B.Cu face",
          "type": "power",
          "position": [
            0.00209,
            0.0078,
            0.0023
          ]
        },
        {
          "id": "ffc-2",
          "label": "J3: 4-pin 0.5 mm FFC, power + RS-485 (daisy-chain port), B.Cu face",
          "type": "power",
          "position": [
            0.00624,
            0.01193,
            0.0023
          ]
        },
        {
          "id": "sensor",
          "label": "U1 MA702 magnetic angle sensor (centre of the sensor; align with the motor shaft), F.Cu face",
          "type": "motor",
          "position": [
            0.00624,
            0.0078,
            0.0023
          ]
        },
        {
          "id": "unstated-uart",
          "label": "connector not stated",
          "type": "uart"
        }
      ]
    },
    {
      "id": "board-o12imu",
      "name": "O12imu (Pinto IMU, LSM6DSV on RS-485)",
      "kind": "board",
      "outline": [
        0.01249,
        0.01249
      ],
      "holes": [
        [
          0.01049,
          0.002,
          0.002
        ],
        [
          0.01049,
          0.01049,
          0.002
        ],
        [
          0.002,
          0.002,
          0.002
        ],
        [
          0.002,
          0.01049,
          0.002
        ]
      ],
      "source": "https://github.com/qwertpas/O12imu/blob/556c23b1b520ca7db3666c2e7307205dcc22251d/O12imu.kicad_pcb",
      "ports": [
        {
          "id": "ffc-1",
          "label": "J1: 4-pin 0.5 mm FFC, power + RS-485 (daisy-chain port)",
          "type": "power",
          "position": [
            0.00211,
            0.00624,
            0.0023
          ]
        },
        {
          "id": "ffc-2",
          "label": "J2: 4-pin 0.5 mm FFC, power + RS-485 (daisy-chain port)",
          "type": "power",
          "position": [
            0.00624,
            0.00211,
            0.0023
          ]
        },
        {
          "id": "unstated-uart",
          "label": "connector not stated",
          "type": "uart"
        }
      ]
    },
    {
      "id": "w-gamepad",
      "name": "Gamepad (BINBOK Switch-compatible or Xbox)",
      "kind": "switch",
      "ports": [
        {
          "id": "usb",
          "label": "USB",
          "type": "usb"
        }
      ]
    },
    {
      "id": "w-laptop-station",
      "name": "Laptop station (station.py, pygame)",
      "kind": "computer",
      "ports": [
        {
          "id": "usb",
          "label": "USB",
          "type": "usb"
        }
      ]
    },
    {
      "id": "w-laptop-usb",
      "name": "Laptop USB",
      "kind": "computer",
      "ports": [
        {
          "id": "usb",
          "label": "USB",
          "type": "usb"
        }
      ]
    },
    {
      "id": "w-e-stop-box-xiao-esp32s3-usb-c",
      "name": "E-stop box XIAO ESP32S3 USB-C",
      "kind": "switch",
      "ports": [
        {
          "id": "usb",
          "label": "USB",
          "type": "usb"
        }
      ]
    },
    {
      "id": "w-e-stop-push-button",
      "name": "E-stop push button",
      "kind": "switch",
      "ports": [
        {
          "id": "signal",
          "label": "signal",
          "type": "signal"
        }
      ]
    },
    {
      "id": "w-e-stop-xiao-esp32s3-pins-d8-and-d7",
      "name": "E-stop XIAO ESP32S3 pins D8 (input pulldown) and D7 (driven high)",
      "kind": "switch",
      "ports": [
        {
          "id": "signal",
          "label": "signal",
          "type": "signal"
        }
      ]
    },
    {
      "id": "w-e-stop-xiao-esp32s3",
      "name": "E-stop XIAO ESP32S3",
      "kind": "switch",
      "ports": [
        {
          "id": "signal",
          "label": "signal",
          "type": "signal"
        }
      ]
    },
    {
      "id": "w-squirrelbrain-xiao-esp32s3",
      "name": "squirrelbrain XIAO ESP32S3 (telemetry back the same way)",
      "kind": "part",
      "node": "body_frame",
      "ports": [
        {
          "id": "signal",
          "label": "signal",
          "type": "signal"
        }
      ]
    },
    {
      "id": "w-tattu-3s-lipo",
      "name": "Tattu 3S LiPo (450 or 500 mAh)",
      "kind": "battery",
      "node": "body_frame",
      "ports": [
        {
          "id": "power",
          "label": "power",
          "type": "power"
        }
      ]
    },
    {
      "id": "w-5x-dynamixel-xl330-m077-t-daisy-chained",
      "name": "5x Dynamixel XL330-M077-T, daisy-chained (IDs 3, 4, 5, 6, 7)",
      "kind": "servo",
      "ports": [
        {
          "id": "serial-servo",
          "label": "servo bus",
          "type": "serial-servo"
        }
      ]
    },
    {
      "id": "w-mag-encoder-on-each-motor",
      "name": "Mag encoder on each motor",
      "kind": "motor",
      "node": "body_frame",
      "ports": [
        {
          "id": "spi",
          "label": "SPI",
          "type": "spi"
        }
      ]
    },
    {
      "id": "w-o32controller",
      "name": "O32controller",
      "kind": "part",
      "node": "body_frame",
      "ports": [
        {
          "id": "spi",
          "label": "SPI",
          "type": "spi"
        }
      ]
    },
    {
      "id": "w-hglrc-2105-5-brushless-motor",
      "name": "HGLRC 2105.5 brushless motor",
      "kind": "motor",
      "node": "body_frame",
      "ports": [
        {
          "id": "motor",
          "label": "motor leads",
          "type": "motor"
        }
      ]
    }
  ],
  "connections": [
    {
      "id": "wire-1",
      "from": {
        "component": "w-gamepad",
        "port": "usb"
      },
      "to": {
        "component": "w-laptop-station",
        "port": "usb"
      },
      "type": "usb",
      "label": "Bluetooth or USB",
      "notes": "Source: https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/readme.md#operating-procedure-latest-version"
    },
    {
      "id": "wire-2",
      "from": {
        "component": "w-laptop-usb",
        "port": "usb"
      },
      "to": {
        "component": "w-e-stop-box-xiao-esp32s3-usb-c",
        "port": "usb"
      },
      "type": "usb",
      "label": "USB serial; station.py opens it at 115200 baud, 2 stop bits",
      "notes": "Source: https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/readme.md#version-3-station-estop-brain-architecture-current; https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/pintocode/station/station.py#L160"
    },
    {
      "id": "wire-3",
      "from": {
        "component": "w-e-stop-push-button",
        "port": "signal"
      },
      "to": {
        "component": "w-e-stop-xiao-esp32s3-pins-d8-and-d7",
        "port": "signal"
      },
      "type": "signal",
      "label": "two wires (photo); pin assignment inferred from firmware",
      "notes": "Source: https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/pintocode/esp32s3/estop/src/main.cpp#L10, L113-L115; https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/readme.md (estopinside.jpeg)"
    },
    {
      "id": "wire-4",
      "from": {
        "component": "w-e-stop-xiao-esp32s3",
        "port": "signal"
      },
      "to": {
        "component": "w-squirrelbrain-xiao-esp32s3",
        "port": "signal"
      },
      "type": "signal",
      "label": "ESP-NOW wireless; brain2 peers with the e-stop MAC hard-coded in firmware, the e-stop picks the brain MAC from its send_to_addrs table",
      "notes": "Source: https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/readme.md#version-3-station-estop-brain-architecture-current; https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/pintocode/esp32s3/brain2/src/main.cpp#L35, L227-L231, L642; https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/pintocode/esp32s3/estop/src/main.cpp#L16-L25"
    },
    {
      "id": "wire-5",
      "from": {
        "component": "w-tattu-3s-lipo",
        "port": "power"
      },
      "to": {
        "component": "board-squirrelbrain-v2",
        "port": "xt30-batt-in"
      },
      "type": "power",
      "label": "XT30; block diagram labels the battery rail 12V",
      "notes": "Source: https://github.com/qwertpas/squirrelbrain/blob/37f06da4e034332678634c682fda11ad8d369ee7/readme.md (Connections); https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/readme.md#power (blockdiag.png)"
    },
    {
      "id": "wire-6",
      "from": {
        "component": "board-squirrelbrain-v2",
        "port": "xt30-motor-out"
      },
      "to": {
        "component": "board-o32controller-v3",
        "port": "unstated-power"
      },
      "type": "power",
      "label": "XT30 / power leads; the squirrelbrain readme says this switch lets the ESP32 cut motor power, and the block diagram shows 12V to both O32 boards. Exact harness not stated",
      "notes": "Source: https://github.com/qwertpas/squirrelbrain/blob/37f06da4e034332678634c682fda11ad8d369ee7/readme.md; https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/readme.md (blockdiag.png); https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/pintocode/esp32s3/brain2/src/main.cpp#L5, L188-L189, L242"
    },
    {
      "id": "wire-7",
      "from": {
        "component": "board-squirrelbrain-v2",
        "port": "dxl-ttl"
      },
      "to": {
        "component": "w-5x-dynamixel-xl330-m077-t-daisy-chained",
        "port": "serial-servo"
      },
      "type": "serial-servo",
      "label": "Dynamixel 5V TTL half-duplex UART, 1 Mbaud (UART2: TX 8, RX 9, DE 7)",
      "notes": "Source: https://github.com/qwertpas/squirrelbrain/blob/37f06da4e034332678634c682fda11ad8d369ee7/readme.md; https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/readme.md (blockdiag.png 'Half-duplex UART', '5V'); https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/pintocode/esp32s3/brain2/src/main.cpp#L13-L15, L42-L48, L208-L210"
    },
    {
      "id": "wire-8",
      "from": {
        "component": "board-squirrelbrain-v2",
        "port": "rs485-0-jst"
      },
      "to": {
        "component": "board-o32controller-v3",
        "port": "unstated-uart"
      },
      "type": "uart",
      "label": "RS-485, 1 Mbaud; squirrelbrain bus connector JST-SH 2-pin (or 4-pin 0.5 mm FFC); O32 has 2x JST-SH 2-pin for daisy chaining. Firmware uses rs485_0 (UART0: TX 43, RX 44, DE 6)",
      "notes": "Source: https://github.com/qwertpas/squirrelbrain/blob/37f06da4e034332678634c682fda11ad8d369ee7/readme.md; package file pcbs/O32controller/readme.md; https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/pintocode/esp32s3/brain2/src/main.cpp#L10-L12, L845-L857"
    },
    {
      "id": "wire-9",
      "from": {
        "component": "board-squirrelbrain-v2",
        "port": "rs485-0-ffc"
      },
      "to": {
        "component": "board-o12imu",
        "port": "unstated-uart"
      },
      "type": "uart",
      "label": "RS-485 (3.3 V per block diagram) with power over 4-pin 0.5 mm pitch FFC, daisy-chainable",
      "notes": "Source: https://github.com/qwertpas/squirrelbrain/blob/37f06da4e034332678634c682fda11ad8d369ee7/readme.md; package file pcbs/O12encoder/readme.md; package file pcbs/O12imu/readme.md; https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/readme.md (blockdiag.png); https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/pintocode/esp32s3/brain2/src/main.cpp#L308-L321"
    },
    {
      "id": "wire-10",
      "from": {
        "component": "w-mag-encoder-on-each-motor",
        "port": "spi"
      },
      "to": {
        "component": "w-o32controller",
        "port": "spi"
      },
      "type": "spi",
      "label": "Angle (SPI) per the block diagram; the O32controller has a built-in MA702 angle sensor and an external SPI encoder port",
      "notes": "Source: https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/readme.md (blockdiag.png); package file pcbs/O32controller/readme.md"
    },
    {
      "id": "wire-11",
      "from": {
        "component": "board-o32controller-v3",
        "port": "phase-w"
      },
      "to": {
        "component": "w-hglrc-2105-5-brushless-motor",
        "port": "motor"
      },
      "type": "motor",
      "label": "motor phase leads (drawn as three wires in the block diagram); field-oriented control",
      "notes": "Source: https://github.com/NovelMobileRobotsLab/pinto-squirrel/blob/506c4bfdffd9fe9968d336734c5e2c8d34ce77f9/readme.md (blockdiag.png); package file pcbs/O32controller/readme.md"
    }
  ]
}
