Let's convert a DC motor into a stepper one


Here is a small project to “convert” a DC motor into a stepper.

This is the starting point of the retrofit of my old Trotec 50W laser engraver which is almost totally dead…

As I don’t want to duplicate the content of my hackaday’s project I just put the link: https://hackaday.io/project/193659-lets-convert-a-dc-motor-into-a-stepper-one

And a video showing the result !

1 Like

I’m slightly lost, to me it appears to be a servo setup with an extra board to interpret the driver signals from a stepper to a servo based on geared(?) steps?

You are almost right.
It’s indeed a servo motor controlled as a stepper.
But the DC driver alone is unable to drive a servo.
So the “added” board does the conversion. ( Servo control + stepper IF).
All this is described in the hackaday’s project.

Ah, the title misled me into believing you were converting a motor, not developing a module to control a servo using a signal for a stepper, mea culpa

yes it’s obviously a “fake” conversion.

But works really well !

I wouldn’t call it “fake”! There are plenty of commercial servos controlled by STEP/DIR signals, it’s not unique to steppers. I’d say you upgraded a servo. :smiley:

I’m using such a commercial servo on my electronic lead screw on my lathe:

It’s controlled by STEP/DIR (though sadly it is missing ENA).

Similarly, here’s an open source design that unfortunately depends on a closed-source toolchain:

Yours nicely avoids the problem of a dependency on closed-source toolchain! :tada:

In your design, I particularly like the use of the built-in LED driver in the ESP-32 to modulate the motor drivers.

The commented source code in your project is really nice for explaining how each of the steps in the process works, demystifying it.

I don’t know whether you are aware of SimpleFOC?

I know that they state that they are for steppers and BLDC motors, but actually there is also support for simple DC motors like yours:

I don’t know that FOC is actually important for your application, but it might be relevant to other uses for controlling a servo as if it were a stepper. :smiling_face:

1 Like

Thanks for all these infos !

Yes I am aware of simpleFoc library (fantastic one). I did use it to control a BLDC motor. Works well.
I tried it also to control a stepper.

But I was’nt aware that it could be used to control a DC motor… I will have to look at it again !

In my (limited) understanding FOC is field oriented control and is mainly relevant for BLDC (or steppers). I don’t understand how it could work for DC motors (you simply can’t control the field orientation on a DC ? (2 wires on brushes)).

By the way, the same little board can be used to control a stepper with an hall encoder.
(replace the optical one by AS5600. Code should be a merge of my first project (strong servo motor with a wiper motor | Hackaday.io) and the current one !


You are right. I had just happened across that repository and not thought enough about it.

Looking more closely, it’s using the rest of SimpleFOC code that isn’t actually doing FOC as support code for a simple DC motor controller. Not really relevant to your application.

Yes I
He is just reusing the PID stuff of SimpleFoc lib.
I don’t know how he handles the “deadband” when DC motor should be off (0V from DC driver means no torque when motor is stopped ie when command position is reached).
In my code I made a “trick” to jump this deadband… But if I “jump” too much then oscillations come :frowning:

1 Like

Hi all,

One step further today! I dared to connect my “pseudoStepper” on my Trotec laser. I don’t use anything from this machine ! Motor is controlled by jogging in gSender and FluidNC does the CNC controller.

Seems to work Sooo well!

Next steps : proper integration, X axis, laser tube !

1 Like