# Redoing stepper motor power feed for X2



## idubrov (Jun 4, 2017)

Recently I decided to redo the stepper motor based power feed I had on my X2, for a couple of reasons:


Original feed was done as a separate unit, therefore no single emergency stop.
The enclosure, made from acrylic, had a bunch of cracks. I think, I put too much of internal stress while glueing it.
The controls were small and inconvenient. I don't know what I was thinking
back when I made the first version. Why would one want a button to switch between "toggle" mode (when you feed and stop by pressing the "feed" button) and "hold" mode (when you feed by holding the "feed" button)? Totally unreasonable. Instead, I want slow/fast feed, as most of the time I prefer to cut in one direction only (don't like chips flying towards me).
I wanted a tachometer.

So, I ended up with a scheme with three control boxes. One box for the power equipment (power supplies and both drivers, one for spindle motor and one for stepper motor). Second box for the controls (I used standard 22mm buttons/lever switch). Third box is for microcontroller, LCD display and rotary encoder.

I decided to only have very basic feed -- no DRO-like features.

The power equipment box is not very well built, I think. Lots of stuff which is probably no-no, like multiple wires in one terminal, too cramped (though I have forced cooling with a small fan), no good separation between noisy wires and signal wires. Actually, when I assembled everything together for the first time, my stepper motor was jerking with spindle motor rotating. Was able to fix it by shortening wires, shielding cables, separating power ground and signal ground, etc. But hey, it works!

It uses STM32 microcontroller which I programmed using language called
"Rust" (I sprayed my mill heavily with LPS 2!). I am pretty happy with it -- I am absolutely not going back to C++!

The PCB I designed myself and ordered online (I'm quite surprised how cheap you can have a factory-made PCB nowadays).

(the source code and PCB design is on the GitHub: https://github.com/idubrov/x2-feed).

See the attached images.


----------



## idubrov (Jun 4, 2017)

And this is the first and second versions I made before.

The first version (cracked one) I used for a few years. It's Arduino-based.

The second box I made for the lathe. It is based on STM32 "Discovery" board,  which one would typically use to learn parcticular STM32 microcontroller. I never completed it (it has basic features, like power feed, but no thread cutting). It was over-designed a little: rotary encoder, keypad and buttons, sophisticated menu system with ability to change lot of system parameters (like microsteps, pitch of the leadscrew, etc).


----------

