Apparent Stepper Misbehavior when Using Servo

tl;dr. My X or Y axis shifts slightly the first time I actuate the servo controlling the Z axis after a move.

I hesitate to post this here because what I’m running no longer bears any resemblance to the MPCNC, but I built it using the old MiniRambo and steppers from what was intended to be a second MPCNC. Now it’s a dedicated pen plotter for some upcoming art projects. That said, I suspect this is as good a place as any to seek the expertise to diagnose/potentially fix this problem.

I have steppers running the X and Y axes of my plotter, and I’ve configured it to use a small servo for the Pen lifter. I used the Zmax pin as the Servo pin, and have plugged the servo cable directly into the header for the Zmax endstop, though this required rewiring the cable to put power and ground in the right spots.

Everything works better than I would have expected. I’m generating gcode that replaces all Z-up moves with:

M400
M280 P0 S40

M400 was necessary to make sure the servo doesn’t actuate before the X/Y moves finish, and position 40 is enough to lift the pen. Likewise, all Z-down moves are replaced with:

M400
M280 P0 S110

Which drops the pen nicely. Everything is working better than I’d expected, but when doing jobs that did a lot of raising and lowering the pen, I found that the Y axis in particular seemed to get really misaligned. I watched the machine and sometimes (but not always) the axis would jump right when the servo moved down. There’s an audible thump when it happens. I know it’s not the servo forcefully jostling anything, because it’s both a very weak servo and also the servo isn’t directly linked to the pen lifter. Gravity pulls in down and a cam on the servo pushes the lifter up.

After some experimentation, I found that the servo activating seems to cause the axis to jerk only once per movement of that axis. If I move the axis once and cycle the servo a bunch of times, it only jumps the first time. And for some positions of the axis, it doesn’t jump at all. My best guess right now is that the stepper gets knocked off a microstep, though I’m not sure why. Maybe a power-dip on the board when it moves the servo? I’ve attempted to isolate the wiring as much as possible in case it was noise interference.

Any thoughts on this? Any suggestions? Anyone else using a servo on the Frankensteined remnants of an MPCNC? For most of my purposes, this isn’t so much of an issue. If I do continuous line art pieces it’s a non issue because it will, at most, jump once at the beginning, but I have some things that require both pen lifts and precision planned for the future and I’m hoping I can iron this out.

Thanks!

1 Like

Okay, so I powered the servo with its own power supply and things seemed to behave as intended. I knew it was too easy just plugging it all in to the end stop header. I think I just have to give the servo its own power supply.

It works fine now. I dug up a 5v regulator from my parts box and wired it into the 12v input. Running that 5v power directly to the servo did the job. It drew a dragon.

6 Likes