{
  "title": "Fully custom FOC stepper driver",
  "url": "https://yin.design/focdriverpcb",
  "author": "theni",
  "messages": [
    {
      "id": "initial-schematic",
      "date": "2024-08-30T23:23:00",
      "displayDate": "8/30/2024 11:23 PM",
      "text": "Hey guys i'm pretty new to this, made this with JLC's own app and parts. This is for a 36V, 2.8A nema23 2phased stepper motor with inline current sensing to take advantage of the new update, It has two encoders for permanent absolute position over multiple full rotations.\nWould really appreciate a quick review. Many thanks in advance!",
      "url": "https://yin.design/focdriverpcb#initial-schematic",
      "attachment": {
        "url": "https://yin.design/_homepage/0ab97754f3246e04377e.webp",
        "description": "Initial stepper driver schematic, including MCU, power circuits and two encoders"
      }
    },
    {
      "id": "schematic-revisions",
      "date": "2024-09-01T19:32:00",
      "displayDate": "9/1/2024 7:32 PM",
      "text": "Here's the schematic after all the changes!",
      "bullets": [
        "F401 -> G431",
        "AS5600(I2C) -> MT6816(SPI)",
        "NRST incorporated into SWD connector (i couldn't find a normal looking 1.27 connector from JLC for some reason, do you know the part name?)",
        "Didn't do anything to the BOOT0 coz i don't have any other way to debug and i'll just assume NRST SWD works",
        "Pullups added to both nCS lines"
      ],
      "edited": true,
      "url": "https://yin.design/focdriverpcb#schematic-revisions",
      "attachment": {
        "url": "https://yin.design/_homepage/81faed2b2b8ace0140c0.webp",
        "description": "Revised schematic with G431 MCU, SPI encoders and updated debug connector"
      }
    },
    {
      "id": "first-layer",
      "date": "2024-09-06T04:19:00",
      "displayDate": "9/6/2024 4:19 AM",
      "text": "Hey guys so my first layer is mostly done, i put most of the power and switching circuits on the upper left portion of the top layer. One thing i had to sacrifice is the analogue sense line from the two current sensors on the top left has to go through one of the center layers (green traces) (currently it's passing through the analogue ground layer across some power traces on the top layer which i tried to minimize).",
      "edited": true,
      "url": "https://yin.design/focdriverpcb#first-layer",
      "attachment": {
        "url": "https://yin.design/_homepage/6e261c847511ac9a0a7e.webp",
        "description": "PCB layout showing switching circuits, current sensing and inner-layer signal routing"
      }
    },
    {
      "id": "grounding",
      "date": "2024-09-06T23:24:00",
      "displayDate": "9/6/2024 11:24 PM",
      "text": "[redacted] so this is what i ended up doing, PGND only meets rest of the ground through the thermal pad under the driver.",
      "url": "https://yin.design/focdriverpcb#grounding",
      "attachment": {
        "url": "https://yin.design/_homepage/41d12081619e45321d6d.webp",
        "description": "PCB ground plane joining power ground through the driver thermal pad"
      }
    },
    {
      "id": "board-ordered",
      "date": "2024-09-07T07:47:00",
      "displayDate": "9/7/2024 7:47 AM",
      "text": "order has been placed, fingies crossed",
      "url": "https://yin.design/focdriverpcb#board-ordered",
      "attachment": {
        "url": "https://yin.design/_homepage/d846baf2ec37b940a45a.webp",
        "description": "3D render of the custom white stepper driver PCB before fabrication"
      }
    },
    {
      "id": "hal-callback",
      "date": "2024-10-22T09:33:00",
      "displayDate": "10/22/2024 9:33 AM",
      "text": "i had to add __weak to some platformio ststm32 libraries to even make my hal callback compile",
      "edited": true,
      "url": "https://yin.design/focdriverpcb#hal-callback",
      "attachment": {
        "url": "https://yin.design/_homepage/a81fa9f9a77b442786c3.webp",
        "description": "STM32 HAL UART callbacks updated with the __weak attribute"
      }
    },
    {
      "id": "firmware-working",
      "date": "2024-10-29T05:18:00",
      "displayDate": "10/29/2024 5:18 AM",
      "text": "doing this works well",
      "url": "https://yin.design/focdriverpcb#firmware-working",
      "attachment": {
        "url": "https://yin.design/_homepage/9941fd7ac16058fb3781.webp",
        "description": "Working firmware code and motor-control configuration"
      }
    },
    {
      "id": "motor-demo",
      "date": "2024-11-02T04:12:00",
      "displayDate": "11/2/2024 4:12 AM",
      "after": "It certainly goes very fast at high torque targets\n300 rad/s 😮",
      "url": "https://yin.design/focdriverpcb#motor-demo",
      "video": {
        "url": "https://yin.design/focdriverpcb/demo.mp4",
        "poster": "https://yin.design/_homepage/add0ba6db1dedb807424.jpg",
        "description": "NEMA23 motor demonstration"
      }
    },
    {
      "id": "torque-test",
      "date": "2024-12-11T19:53:00",
      "displayDate": "12/11/2024 7:53 PM",
      "text": "Its an aliexpress one for testing up to 10Nm static with 0.04Nm accuracy",
      "url": "https://yin.design/focdriverpcb#torque-test",
      "attachment": {
        "url": "https://yin.design/_homepage/a84a3bccb798f7518bd0.webp",
        "description": "Stepper motor and custom driver mounted on a static torque testing instrument"
      }
    },
    {
      "id": "high-speed-debugging",
      "date": "2025-03-26T21:24:00",
      "displayDate": "3/26/2025 9:24 PM",
      "sectionNote": "probing and debug after full robot assembly",
      "text": "very weird new bug where whenever the system reaches a high speed it looses control and continues at that speed all the way until the end of the mechanical system and bounces back to the other end and oscillates. I really don't think it's a pid issue tho since i tried all kinds of combinations. This happens in both torque mode and velocity mode. But can be effectively prevented by setting a constrain on velocity.",
      "edited": true,
      "url": "https://yin.design/focdriverpcb#high-speed-debugging",
      "attachment": {
        "url": "https://yin.design/_homepage/733805c0d94d66dcd803.webp",
        "description": "Motor telemetry plots showing high-speed oscillation and velocity constraint debugging"
      }
    }
  ],
  "closingNote": "... all bugs were fixed and system remained stable over 18mo of continuous use, more to show after product launch..."
}