Cln17: Closed-loop Driver For Nema17

About the project

A compact, silent, high-performance open-source closed-loop (servo) stepper motor driver that supports CAN-FD and USB-C with PowerDelivery


The CLN17 motor driver is an affordable, open-source, compact, high-performance closed-loop stepper motor driver designed specifically for NEMA17 form factor motors. The driver offers advanced features such as silent and smooth motion, high-precision position control, and energy-saving capabilities, making it ideal for various applications.
This project wasn't merely born as yet another driver; it was envisioned as a mighty instrument for education, development, experimentation, and the modeling of mechanical systems. Its mission? To resolutely meet every requirement and address all the needs that may arise during the journey with stepper motors, once and for all!
The project is actively evolving and improving! If you wish to be a part of it, ask questions, or simply watch its progress, join the project's Discord server. Driver development will lead to content updates on this page and the project website. Stay tuned!



Key Features | All Features

  • 🕹️ Closed-Loop Control: Enables precise motion in challenging conditions.
  • 💪 Adaptive Torque Control: Optimizes energy efficiency, reduces stress, and extends motor lifespan.
  • 🧩 Reliable Operation and Enhanced Safety: Ensures reliable operation and protects users from potential harm.
  • 🛡️ Modular Concept: Provides flexibility and cost-effectiveness through various configurations and expansion boards.

Key Specs | All Specs

  • 🔌 Wide Input Voltage Range: 5-25VDC with reverse polarity and surge protection
  • ⚡️ Powerful Motor Control: 1.4A RMS current per phase with up to 2.5A peak and up to 1/256 microstepping
  • 🚀 High-Performance MCU: STM32G431CB Arm Cortex-M4 running at 170MHz with Classic EN/DIR/STEP interface, CAN-Bus, I2C, UART and USB Type-C with PD2.0 support,
  • 🔒 Compact and Durable Design: 38x38mm PCB, with optional aluminum housing for heat dissipation and mechanical protection and minimal height of 7.5mm (10mm with connectors)

Applications | In-depth

  • 🎓 Learning Platforms
  • 🛠️ CNC Machines & 3D printers
  • 🤖 Robotics & Automation Systems
  • 🤝 Collaborative Robots
  • 🔭 Camera & Telescope Stabilization Systems
  • 🔬 Laboratory Equipment
  • 🏭 Industrial Motion Control Systems
  • 📳 Haptics & Force Feedback Systems

What is the project's status?

There are numerous updates planned for the documentation, including the publication of articles on related topics. Alsowill be provided insights into development process, announce new versions, introduce new features, and much more. Here's a concise breakdown of major and immediate updates:

✅ Completed:

  • Project Conceptualization: The initial idea and blueprint of the project.
  • First Prototype Development: Crafting the initial version of our product.
  • Design Completion: Finalizing (or nearly finalizing) the product's design.
  • Final Prototype Testing: Evaluating the last prototype to ensure functionality and reliability.
  • Wiki and Specifications: Developing a comprehensive wiki and detailing the product's specifications.
  • Hardware Documentation: Providing essential information and guides about the hardware components.

🔜 In Progress:

  • Library for TMC2209: [📅 ≈ 30.10.2023] Developing a STM32 library to manage all TMC2209 registers using UART communication.
  • Library for TLE5012B: [📅 ≈ 15.11.2023] Crafting a STM32 library for interactions with TLE5012B registers via SPI. 
  • Basic Driver Function Code: Producing the foundational source code for executing the product's essential operations.

📅 Scheduled:

  • PowerDelivery Support Library: Working on a library that will support PowerDelivery functionalities.
  • CLN17 Lite: Simple and cheap version for basic tasks (CAN-FD, IMU excluded)
  • CLN17 Pro: Advanced version with higher currents and voltages (TMC2240 based)
  • CLN234 Version: Developing a variant that can control NEMA23 and NEMA34 motors, supporting up to 55V 10A (TMC5160 based)

Should there be significant interest, the project will establish Kickstarter Campaign and its own store to cater to the entire community's needs!

Design Overview

To fully grasp the design intricacies of the CLN17 project, it is recommended to familiarize yourself with its foundational principles, as they provide the conceptual basis for CLN17. Also see the CC BY-NC-SA 4.0 license.

What is the structure of the CLN17 architecture?

CLN17 serves as the central component of a closed-loop motor system. Its architecture is specifically designed to support nodes that manages motor feedback, process it, and provides real-time responses on the device. The block diagram of CLN17, as shown below, illustrates this architecture and includes various supporting subsystems.

STM32G431CBU pin functions PCBA assembly options

To ensure the driver fits the size requirements and provides efficient cable management, the board supports several primary assembly configurations:

No Connectors: This configuration allows for wires to be soldered directly to the board, resulting in the thinnest board profile.

Horizontal Connectors: Ideal for applications with limited vertical space where soldering isn't suitable.

Vertical Connectors: Suited for scenarios where the fitting area is accessible only from the bottom side of the motor.

Alternative Closed-Loop Drivers

CLN17 is not the only closed-loop motor driver. There are several alternatives available, which are also closed-loop drivers and designed with a similar architecture. These drivers comprise a microcontroller, an encoder, and a driver, all integrated onto a single printed circuit board placed at the rear side of the NEMA17 motor.

Quick overview of the alternatives

A comparative table of thiese drivers can be found here

Is there anything else?

There are several other similar products available, but they haven't been described due to the project's confidentiality or lack of information.

Design philosophy

In any project, the philosophy  have a significant impact on its vision and purpose, extending beyond basic functionality. Incorporating design principles into the project can result in a solution that not only fulfills technical requirements but also resonates with users on an aesthetic level.

  • 📖 Open Source and Comprehensive Documentation: Adopting an open-source philosophy invites wide-ranging engagement, making the project versatile and adaptable. Community involvement fosters innovation and knowledge exchange, creating a supportive ecosystem. Clear documentation promotes learning, collaboration, and seamless integration with other projects.
  • 💎 Aesthetic Appeal and Usability: A technical product's aesthetic appeal should be a byproduct of its superior functionality, technological advancement, and usability.
  • 💰 Cost-Effectiveness and Accessibility: Balancing cost and functionality while prioritizing accessibility ensures the project's seamless integration across various sectors.
  • 🚀 Future-Proofing: Incorporating foresight for future improvements while maintaining the core design's integrity streamlines the development of new products. Proactively addressing and accommodating future requirements ensures the project's enduring viability and relevance.

Design concepts

  • 💪High Performance: The system should be capable of processing feedback data in real-time and react immediately by controlling the motor based on predefined algorithms. This simplifies the control process and reduces the load on the control device.
  • 💻 Compatibility and Versatility: A wide range of supported interfaces should enable interaction with existing protocols as well as the implementation of new ones. This expands compatibility and facilitates integration of the device into existing systems.
  • 🛡️ Precision and Fault Tolerance: The implementation of feedback control with position and current sensors should ensure precise positioning and mechanical load monitoring. This enables the detection and prevention of abnormal system operation when necessary.
  • 🔧 Adaptability: Evaluating motor operating parameters and system displacement data enables the selection of an optimal motor control profile for the specified task.
  • ⚡️ Reliability and Power Efficiency: Providing protection against electrostatic discharge (ESD), short circuits, and reverse polarity, as well as preventing overheating through reduced thermal losses, improved heat dissipation, and enhanced energy efficiency.
  • 🧩 Customizability and Modularity: The device should accommodate functionality expansion or reduction without necessitating design changes.
  • 🏭 Optimized for Design for Manufacturing (DFM): Complying with manufacturing technology requirements enhances manufacturability while reducing production costs and complexities.
  • ⏳ Longevity Considerations: When choosing project component composition, future availability and support forecasts should be considered.

The Journey: Concept Prototype

In March 2022, while working on a laboratory robot designed for handling test tubes, the idea of using a closed-loop driver came up. This driver needed to be:

  • Compact
  • Feature minimalistic wiring
  • Offer precise and repetitive positioning
  • Exhibit unwavering reliability

Sadly, no existing solutions fit the bill. Some were inadequate due to size, others lacked the necessary features or interfaces, some had proprietary code that disallowed modifications, and still, others were either unavailable due to component shortages or had been discontinued. A detailed comparison of these alternatives can be found here.

Thus, a new vision was formed: To create a universal, powerful, and affordable driver that would address all challenges related to controlling a stepper motor.

By September 2022, the first prototype driver was born. Key components included:

  • Standard CAN-Bus and USB2.0 with QC support
  • STM32F103 MCU
  • TLE5012B encoder
  • TMC2209 stepper motor driver

However, there were critical setbacks. While it did feature a Type-C port, it relied on Quick Charge (QC) for power, which hampered its flexibility. Another significant limitation was that the controller could not operate the USB and CAN-Bus simultaneously, leading to developmental troubles. A few minor problems arose but  were quickly fixed with a soldering iron. 

Predictably, this prototype did not achieve all its intended functions, underscoring the need for a revised driver version. This initial setback only strengthened the determination to design a comprehensive stepper motor control solution.

The Journey: Concept Challenges

Based on the experience and ideas acquired during the prototype development, a final vision of the project and its functionalities has been formed. Below are the key challenges:

  • Quiet yet Robust Driver: Designed to deliver core motor control functionalities unhindered by hardware constraints. This driver is intended to be an off-the-shelf solution to minimize the computational load on the microcontroller and mitigate risks, leveraging the inherent safety features of pre-built solutions.
  • Support for Standard Interfaces: Incorporates USB for computer connectivity, CAN-Bus for communication within industrial systems, Stepstick for compatibility with legacy systems such as 3D printers, and UART and I2C for interactions in embedded environments.
  • High-Speed Microcontroller: Equipped to handle concurrent tasks such as position calculations, real-time encoder-based position monitoring, processing of external commands from various interfaces, and other user-defined tasks.
  • Compatibility with Expansion Boards: Ensures the provision to integrate additional boards to accommodate any functionalities not originally addressed.
  • Efficient Power Delivery: Guarantees compatibility with widely-used power sources or power banks.
  • Optimal Protection: Shields against potential hazards like electrostatic discharges, current overflows, voltage spikes, and more.
  • Integrated IMU: Facilitates the detection and compensation of resonances or vibrations while continuously tracking the current position.
  • Compact Design: Crafted to seamlessly integrate into devices where space is a constraint.
  • Cost-Effective and Modular Structure: Tailored for swift customization based on specific requirements.
  • There are many other smaller nuances that can be enumerated, but more on that later! You can also read the foundational principles to get a clearer picture.

    The Journey: Functional Prototype

    After an extensive development process which involved numerous design iterations and reconsideration of implementation methods, the updated project version that encompasses all concept ideas has been released!

    Compared to the previous version, the PCBA is more:

    • Compact
    • Powerful
    • Functional
    • Equipped with numerous safety features

    It has now evolved from being just another driver to becoming a powerful tool for educationdevelopmenttesting, and system modeling.

    Does it work? The short answer is yes. However, diving deeper, things get a bit more complicated.

    From a hardware perspective, there are a few minor issues, which fortunately don't have an impact on the primary functionality. These known issues include:

    • Incorrect polarity of the power indicator LED;
    • Not stable behavior of the buck DCDC converter at voltages below 6V

    Apart from these, all other driver functions operate correctly.

    On the code side of things, it's a different story. A vast amount of work is still needed to release the complete driver control library that would unlock its full potential. But there's hope that it's just a matter of time.

    Schematics, diagrams and documents

    V1 Schematic



    Project page on Github


    Leave your feedback...