justimepassnow/Microdrive

C

6

17 commits

updated Aug 28, 2026

See the code

See what people are saying

SourceMessageScoreDate

My First Custom Pcb (r/robotics)

this board (specifically the black one) turns mg99x servos to much more expensive serial servos with position, velocity,torque control the software is still in early stages so anyone interested for checkout [Microdrive ](https://github.com/justimepassnow/Microdrive)

1

Oct 4, 2026

README

μDrive (Microdrive)

License: MIT Hardware License OSHWA Certified

μDrive is an open-source hardware and software project designed to convert any standard "dumb" DC motor into a smart, closed-loop servo motor. By retrofitting a standard DC motor with an analog potentiometer or an I2C magnetic encoder, μDrive grants you precise control over position, velocity, and current.


✨ Features

  • Universal DC Motor Support: Works with standard DC brushed motors (within the limits of the onboard motor driver).
  • Closed-Loop Control: PID-based control over Motor Position, Velocity, and Torque.
  • Single-Wire Communication: Network multiple servos together using a half-duplex, single-wire UART interface.
  • Web-Based Dashboard: Includes a Svelte-based WebGUI utilizing the Web Serial API. Connect a master microcontroller to your PC via USB, and monitor/tune your servo network directly from your browser.
  • High-Level API: Control motors using high-level commands without worrying about register-level or bit-level operations.

📖 Documentation

A comprehensive documentation suite is available in the docs directory:


🛠️ Hardware Specifications

μDrive is available in two PCB variants sharing the same MCU and logic, but using different motor drivers:

FeatureServo BoardMG996 Drop-in Board
Motor DriverCP2119BDR6121H
Form FactorStandard — attach to any DC motorDrop-in replacement for MG996R servo
Operating VoltageUp to 18V maxUp to 7.5V max
Current Rating5A continuous1.5A continuous / 3A peak
PCB Filesservo_pcbservo_pcb_mg99x

Board Layouts

Servo Board Front Servo Board Back

Common Architecture (Both Boards)

  • Microcontroller: MindMotion MM32G0001 (32-bit Cortex-M0, 48MHz, 16KB Flash, 2KB RAM)
  • Current Sensor: INA180A2 (current sense amplifier) with a 0.01Ω shunt resistor for overcurrent protection
  • Power: Onboard SL7533-3 3.3V logic regulator (supports input up to 24V)
  • Feedback Inputs:
    • Analog: Standard potentiometer support (shared with the SDA pin).
    • Digital (I2C): 4-pad footprint (3.3V, SCL, SDA, GND) for external I2C magnetic encoders like the AS5600.
  • Communication: Half-duplex, single-wire UART on PA12 (open-drain), 250000 baud, 8N1.

💻 Software & APIs

The project uses a Master/Slave architecture over a half-duplex UART bus. You simply import the driver library onto your master microcontroller and send high-level commands.

  • MicroPython: A fully functioning driver library is currently available.
  • Arduino/C++: Coming soon!

WebGUI Architecture

graph TD
    Web["<span style='color:#000'>💻 Web Browser<br>(Svelte WebGUI)</span>"] -- "Web Serial API" --> Master["<span style='color:#000'>🧠 Master Microcontroller<br>(Running Python Script)</span>"]
    Master -- "Single-Wire UART" --> Servo["<span style='color:#000'>⚡ μDrive Servo Board</span>"]
    Servo --> Motor["<span style='color:#000'>⚙️ DC Motor + Encoder</span>"]

    %% Styling
    style Web fill:#e1f5fe,stroke:#01579b,stroke-width:2px;
    style Master fill:#e8f5e9,stroke:#1b5e20,stroke-width:2px;
    style Servo fill:#fff3e0,stroke:#e65100,stroke-width:2px;
    style Motor fill:#efebe9,stroke:#3e2723,stroke-width:2px;

Web GUI

μDrive WebGUI Dashboard



🚀 Getting Started

1. Flashing the Servo Board (via Picoprobe)

Why use a Raspberry Pi Pico? Programming obscure chips like the MM32G0001 usually requires buying dedicated, expensive hardware programmers (like mm32link or ST-Link). By using a $4 Raspberry Pi Pico instead, we keep the project incredibly cheap and accessible. Even better: once you've flashed the servo board, you can wipe the Pico and reuse it as the master MicroPython controller for your entire servo network!

Step 1: Turn the Pico into a Programmer Flash your Raspberry Pi Pico with the Picoprobe (Debug Probe) firmware to turn it into a CMSIS-DAP debugger. You can download the latest debugprobe_on_pico.uf2 file directly from the official Raspberry Pi GitHub Releases page. Just hold the BOOTSEL button, plug in the Pico, and drag-and-drop the file!

Step 2: Wire the Pico to the μDrive Board Connect these 4 wires from the Pico to the programming header on the μDrive board:

  • Pico 3V3 --> μDrive 3.3V
  • Pico GND --> μDrive GND
  • Pico GP2 --> μDrive SWCLK (Labeled C on the board)
  • Pico GP3 --> μDrive SWDIO (Labeled D on the board)

Step 3: Install the Software Tools

  1. Install VS Code and add the PlatformIO extension.
  2. Install Python on your PC.
  3. Open a terminal and install the flashing tool by running: pip install pyocd
    • (Windows Users: If pyocd fails to detect your probe later, Windows likely installed the wrong default driver. Download the free Zadig tool, select "Picoprobe CMSIS-DAP" from the dropdown, and replace the driver with WinUSB).

Step 4: Open and Flash!

  1. Clone this repository and open the Microdrive folder in VS Code.
  2. Click the PlatformIO Upload button (the small → arrow at the bottom of the screen). PlatformIO will automatically compile the code and trigger pyocd to flash it onto the MM32G0001!

2. Setting Up the Master MCU (Drivers)

Once the servo board is flashed, it listens for commands over a half-duplex UART line. You will need a "Master" microcontroller to send these commands.

  • Currently, a MicroPython driver is provided. You can flash a standard Raspberry Pi Pico with MicroPython, import the provided driver library, and use simple high-level functions to command the servo.
  • (Arduino/C++ library support is coming soon!)

3. Launching the Web GUI

To easily tune and monitor your servo network from your computer, you can run the provided Svelte WebGUI:

  1. Ensure your Master MCU is connected to your PC via USB and running the serial bridge python script.
  2. Open a terminal and navigate to the gui folder inside this repository.
  3. Run npm install to download the web dependencies.
  4. Run npm run dev to start the local server.
  5. Open the provided localhost link in a browser that supports the Web Serial API (like Chrome or Edge) to connect to your Master MCU and start tuning!

🚧 Known Issues & Roadmap

Microdrive is actively under development. Current focus areas include:

  • 🐛 EMI Stability: The board occasionally stops responding to commands during massive current spikes. This is likely due to electromagnetic interference (EMI) crashing the MCU or bus. Hardware/software filtering improvements are being investigated.
  • 🚀 Better I2C Encoder Support: Writing the software drivers to fully utilize the AS5600 footprint.
  • ⚙️ Control Optimization: Improving the efficiency of the communication protocol and fine-tuning the torque and velocity control loops.
  • 🔌 Arduino Compatibility: Development of Arduino/C++ compatible driver libraries to control the servo network from Arduino-compatible microcontrollers.

🤝 Contributing

Contributions are welcome! Whether it's firmware, hardware, documentation, or the WebGUI — check out the Contributing Guide to get started. Found a bug or have an idea? Open an issue.


⚖️ License

This project is fully open-source and OSHWA certified (UID: IN000092):

  • The Software/Firmware is licensed under the MIT License.
  • The Hardware (PCBs/Schematics) is licensed under the CERN-OHL-P v2.

You are free to build, modify, and integrate μDrive into your own projects (commercial or hobbyist).

justimepassnow/Microdrive

C

6

17 commits

updated Aug 28, 2026

See the code

See what people are saying

SourceMessageScoreDate

My First Custom Pcb (r/robotics)

this board (specifically the black one) turns mg99x servos to much more expensive serial servos with position, velocity,torque control the software is still in early stages so anyone interested for checkout [Microdrive ](https://github.com/justimepassnow/Microdrive)

1

Oct 4, 2026

README

μDrive (Microdrive)

License: MIT Hardware License OSHWA Certified

μDrive is an open-source hardware and software project designed to convert any standard "dumb" DC motor into a smart, closed-loop servo motor. By retrofitting a standard DC motor with an analog potentiometer or an I2C magnetic encoder, μDrive grants you precise control over position, velocity, and current.


✨ Features

  • Universal DC Motor Support: Works with standard DC brushed motors (within the limits of the onboard motor driver).
  • Closed-Loop Control: PID-based control over Motor Position, Velocity, and Torque.
  • Single-Wire Communication: Network multiple servos together using a half-duplex, single-wire UART interface.
  • Web-Based Dashboard: Includes a Svelte-based WebGUI utilizing the Web Serial API. Connect a master microcontroller to your PC via USB, and monitor/tune your servo network directly from your browser.
  • High-Level API: Control motors using high-level commands without worrying about register-level or bit-level operations.

📖 Documentation

A comprehensive documentation suite is available in the docs directory:


🛠️ Hardware Specifications

μDrive is available in two PCB variants sharing the same MCU and logic, but using different motor drivers:

FeatureServo BoardMG996 Drop-in Board
Motor DriverCP2119BDR6121H
Form FactorStandard — attach to any DC motorDrop-in replacement for MG996R servo
Operating VoltageUp to 18V maxUp to 7.5V max
Current Rating5A continuous1.5A continuous / 3A peak
PCB Filesservo_pcbservo_pcb_mg99x

Board Layouts

Servo Board Front Servo Board Back

Common Architecture (Both Boards)

  • Microcontroller: MindMotion MM32G0001 (32-bit Cortex-M0, 48MHz, 16KB Flash, 2KB RAM)
  • Current Sensor: INA180A2 (current sense amplifier) with a 0.01Ω shunt resistor for overcurrent protection
  • Power: Onboard SL7533-3 3.3V logic regulator (supports input up to 24V)
  • Feedback Inputs:
    • Analog: Standard potentiometer support (shared with the SDA pin).
    • Digital (I2C): 4-pad footprint (3.3V, SCL, SDA, GND) for external I2C magnetic encoders like the AS5600.
  • Communication: Half-duplex, single-wire UART on PA12 (open-drain), 250000 baud, 8N1.

💻 Software & APIs

The project uses a Master/Slave architecture over a half-duplex UART bus. You simply import the driver library onto your master microcontroller and send high-level commands.

  • MicroPython: A fully functioning driver library is currently available.
  • Arduino/C++: Coming soon!

WebGUI Architecture

graph TD
    Web["<span style='color:#000'>💻 Web Browser<br>(Svelte WebGUI)</span>"] -- "Web Serial API" --> Master["<span style='color:#000'>🧠 Master Microcontroller<br>(Running Python Script)</span>"]
    Master -- "Single-Wire UART" --> Servo["<span style='color:#000'>⚡ μDrive Servo Board</span>"]
    Servo --> Motor["<span style='color:#000'>⚙️ DC Motor + Encoder</span>"]

    %% Styling
    style Web fill:#e1f5fe,stroke:#01579b,stroke-width:2px;
    style Master fill:#e8f5e9,stroke:#1b5e20,stroke-width:2px;
    style Servo fill:#fff3e0,stroke:#e65100,stroke-width:2px;
    style Motor fill:#efebe9,stroke:#3e2723,stroke-width:2px;

Web GUI

μDrive WebGUI Dashboard



🚀 Getting Started

1. Flashing the Servo Board (via Picoprobe)

Why use a Raspberry Pi Pico? Programming obscure chips like the MM32G0001 usually requires buying dedicated, expensive hardware programmers (like mm32link or ST-Link). By using a $4 Raspberry Pi Pico instead, we keep the project incredibly cheap and accessible. Even better: once you've flashed the servo board, you can wipe the Pico and reuse it as the master MicroPython controller for your entire servo network!

Step 1: Turn the Pico into a Programmer Flash your Raspberry Pi Pico with the Picoprobe (Debug Probe) firmware to turn it into a CMSIS-DAP debugger. You can download the latest debugprobe_on_pico.uf2 file directly from the official Raspberry Pi GitHub Releases page. Just hold the BOOTSEL button, plug in the Pico, and drag-and-drop the file!

Step 2: Wire the Pico to the μDrive Board Connect these 4 wires from the Pico to the programming header on the μDrive board:

  • Pico 3V3 --> μDrive 3.3V
  • Pico GND --> μDrive GND
  • Pico GP2 --> μDrive SWCLK (Labeled C on the board)
  • Pico GP3 --> μDrive SWDIO (Labeled D on the board)

Step 3: Install the Software Tools

  1. Install VS Code and add the PlatformIO extension.
  2. Install Python on your PC.
  3. Open a terminal and install the flashing tool by running: pip install pyocd
    • (Windows Users: If pyocd fails to detect your probe later, Windows likely installed the wrong default driver. Download the free Zadig tool, select "Picoprobe CMSIS-DAP" from the dropdown, and replace the driver with WinUSB).

Step 4: Open and Flash!

  1. Clone this repository and open the Microdrive folder in VS Code.
  2. Click the PlatformIO Upload button (the small → arrow at the bottom of the screen). PlatformIO will automatically compile the code and trigger pyocd to flash it onto the MM32G0001!

2. Setting Up the Master MCU (Drivers)

Once the servo board is flashed, it listens for commands over a half-duplex UART line. You will need a "Master" microcontroller to send these commands.

  • Currently, a MicroPython driver is provided. You can flash a standard Raspberry Pi Pico with MicroPython, import the provided driver library, and use simple high-level functions to command the servo.
  • (Arduino/C++ library support is coming soon!)

3. Launching the Web GUI

To easily tune and monitor your servo network from your computer, you can run the provided Svelte WebGUI:

  1. Ensure your Master MCU is connected to your PC via USB and running the serial bridge python script.
  2. Open a terminal and navigate to the gui folder inside this repository.
  3. Run npm install to download the web dependencies.
  4. Run npm run dev to start the local server.
  5. Open the provided localhost link in a browser that supports the Web Serial API (like Chrome or Edge) to connect to your Master MCU and start tuning!

🚧 Known Issues & Roadmap

Microdrive is actively under development. Current focus areas include:

  • 🐛 EMI Stability: The board occasionally stops responding to commands during massive current spikes. This is likely due to electromagnetic interference (EMI) crashing the MCU or bus. Hardware/software filtering improvements are being investigated.
  • 🚀 Better I2C Encoder Support: Writing the software drivers to fully utilize the AS5600 footprint.
  • ⚙️ Control Optimization: Improving the efficiency of the communication protocol and fine-tuning the torque and velocity control loops.
  • 🔌 Arduino Compatibility: Development of Arduino/C++ compatible driver libraries to control the servo network from Arduino-compatible microcontrollers.

🤝 Contributing

Contributions are welcome! Whether it's firmware, hardware, documentation, or the WebGUI — check out the Contributing Guide to get started. Found a bug or have an idea? Open an issue.


⚖️ License

This project is fully open-source and OSHWA certified (UID: IN000092):

  • The Software/Firmware is licensed under the MIT License.
  • The Hardware (PCBs/Schematics) is licensed under the CERN-OHL-P v2.

You are free to build, modify, and integrate μDrive into your own projects (commercial or hobbyist).

Languages

C

93.5%

Svelte

4.7%

Python

1.1%