New Open hardware closed loop driver for Nema17 STM32G431CB

This looks nice?

This is very nice… I like that they use the USB PD on G431. I’m wondering how they plan to implement that in practice.
They also don’t mention what sensor, but they do have a gyro/accelerometer, which could be quite cool for use on a triple gimbal stabilizer.

oh… it’s only with a stepper driver TMC2209, so no FOC :frowning:

1 Like

Interesting, I’m sure it has some good applications. I cannot make use of it though. The truth is that stepper driver can detect lost steps, though, and can also inform the microcontroller of how close you are to loosing a step, even. So you don’t need much to get it to basically practically implement something very similar to FOC, in terms of energy efficiency etc. although it works in a different way. However you do have to actually do it, and maybe that’s what they are doing, which is a good idea, but I think making a good library for the stepper driver is a stepping stone along the way anyway and that hasn’t been done yet, and truth be told would probably be more useful in many ways.

1 Like

I initially thought we could get FOC on it. I see now that we can’t

Perhaps someone will steal the PD power idea and footprint and do something similar but FOC compatible.

how exactly? some BEMF sensing?

my thoughts also :grin:

Realisation of PD on STM32 capabilities without a third-party chip such as Fusb302 requires quite a lot of development time, as there are no ready-made solutions to be found… Since I am not really a programmer, but rather a hardwarrior, I hope that together with the community we will be able to implement this functionality, which could be useful in hundreds of different projects)

1 Like

This driver is made exclusively for stepper motors, and the form factor and functionality are designed for them. Specialisation allows to reduce the load on the µC and also reduce the final cost. FOC is still the prerogative of classical BLDC, but stepper motors do have their own principles of control and many specialised drivers cope with it perfectly. If the topic with drivers will go - it is a matter of time to realise a similar driver for bldc.

As for the detection of skipping steps by the driver chip, not everything is so simple. A typical situation when under load there is a failure of more than one whole step. Yes, the draver can detect a stall or near stall using inbuilt algorithms, but if a stall occurs, it will not provide useful information because without external encoder control, the actual position will be lost.

And in addition this is a fairly recent project, so any wishes, ideas and any help would be useful to the project and the community (hopefully).

1 Like

There have been a few people who have designed SimpleFOC boards for use with bipolar stepper motors, although there are some drawbacks, you also get quite a lot more torque per amp!

Recently, in the simpleFOC discord, we also discovered some methods to use bipolar stepper with three-phase drivers, which opens up quite a lot of design options for using cheap BLDC drivers in combination with cheap, high pole-pair steppers.

I agree that USB-PD stack is quite difficult without some standalone chips… if we can work together to figure this out I think there is a lot of value for both sides. There is quite a lot to learn in this area and it doesn’t seem many hobby projects take advantage of what this can offer!

I don’t quite understand how you can achieve more torque for the same current because there are limitations, primarily electromechanical. The emphasis should rather be on the fact that without closed loop operation at high currents for stepper motors is dangerous due to overheating. However, there is no difference between good specialised drivers and the best solutions using FOC. Because even with a normal driver you can give the motor a current of 2A and get a very high torque. And higher currents are no longer allowed for stepper motor connectors.

1 Like

I happened across this project just now PicoPD - USB-C PD 3.0 PPS Trigger with RP2040 | which includes some code for the ~$1 AP33772 chip

It would be cool if the driver would be on a socket, like the classic Pololu style stepper drivers are.
That way we could replace it with a BLDC driver like the one from sFOC-mini.

The usual microstepping-config pins could then act as the 3 PWM pins.

1 Like

Would a Ustepper open hardware clone work? USTEPPER S32

1 Like

You can also look at PD Micro or pinecil which use the PD FUSB302 chip which is both common and cheap. The MPH30 soldering table works on it by the way. But here it is more about the possibility to realise the same functionality without additional chips on the basis of advanced microcontrollers like STM32G4. Because an external chip is additional costs, consumption, and in the end complexity in wiring and space on the board.


At least there is a bigger stepper driver onboard. But the function of the header is unclear to me.
The header layout is the same I thought about.

Looks like they sell some wifi shield or something? Agreed it’s a bit odd and takes up a ton of space.

I agree. There are quite a lot of solutions with extra ICs but few (none?) with using the integrated peripheral. However the stack does seeem quite heavy and due to the realtime communication need with the host maybe it’s too heavy for use with motor control, I think a lot of the talking is done with callbacks and interrupt handlers. But it’s worth searching more into!

I strongly dislike the implementation of uStepper. It’s bulky, it doesn’t have the ability to make an aesthetically pleasing and functional case, it doesn’t even have an indication LED for that price… And there are only two mounting holes, huge dimensions, no user-friendly interfaces. I’m not even talking about the crutch motor connection. In my project I tried to include all really worthwhile and valuable functions, but to make the solution as cheap as possible (no display, no complex circuitry for interaction with 3-phase motors, etc.). Everything has a price. I am happy to add features that I have not included, but only if they are really worth it. uStepper is one of the most advanced stepper drivers, but it has so many disadvantages that its use in serious projects is problematic imho.

Indeed, it’s a cumbersome stack, but not all of its functions are needed to request power. I think there is quite a lot of freedom to optimise for narrow tasks such as getting power. And in terms of functionality, all external solutions like FUSB302 require the same stack but with I2C interface added and less flexibility in operation. I haven’t found ready and at least a little bit documented uses of UCPD, but it is definitely something the community needs to do. By the way, the STM32G431CBU on JLCPCB costs less than $1.5, which with its capabilities makes it an ideal solution for all embedded projects (almost)

I have a project and board on hand of PD Trigger based on the same chip, so I can test all ideas, but I’m really bad at programming…

It’s not BEMF, it works even when the motor is not turning. I don’t know how it works exactly, you can read about it in the datasheet for the driver, coolstep etc. It might be similar to HFI, ultimately they watch the current vs voltage vs time curves and use some mathematical models to determine how close the motor is to loosing a step.

That’s exactly right. According to the documentation:

The StallGuard4 measurement value changes linearly over a wide range of load, velocity, and current settings. When approaching maximum motor load, the value goes down to a motor-specific lower value. This corresponds to a load angle of 90° between the magnetic field of the coils and magnets in the rotor. This also is the most energy-efficient point of operation for the motor.

If the difference approaches 90* then the point of maximum mechanical force (equivalent to mechanical resistance) has been reached. Since there can be no more force than this configuration based on the geometry of the magnetic fields, any increase in force will result step loss.