Running a metal lathe is not for the faint of heart. Without proper knowledge and preparation, these machines can quickly cause injury or destroy expensive stock, tools, or parts. The other major problem even for those with knowledge and preparedness is that some of their more niche capabilities, like cutting threads with a lead screw, can be tedious and complicated thanks to the change gear system found on some lathes. While these are useful tools for getting things done, [Not An Engineer] decided that there was a better way and got to work building an electronic gearbox to automate the task of the traditional mechanical change gear setup in this video.
What makes change gears so tricky is that they usually come as a set of many gears of different ratios, forcing the lathe operator to figure out the exact combination of gears needed to couple the spindle of the lathe to the feed screw at the precise ratio needed for cutting a specific thread pattern. It is possible to do this task but can be quite a headache. [Not An Engineer] first turned to an Arduino Nano to receive input from a rotary encoder connected to the shaft of the lathe and then instruct a motor to turn the feed screw at a set ratio.
The first major problem was that the Arduino was not nearly fast enough to catch every signal from the encoder, leading to a considerable amount of drift in the output of the motor. That was solved by upgrading to a Teensy 4.1 with a 600 MHz clock speed. There was still one other major hurdle to cross; the problem of controlling the motor smoothly when an odd ratio is selected. [Not An Engineer] used this algorithm to inspire some code, and with that and some custom hardware to attach everything to the lathe he has a working set of electronic change gears that never need to be changed again. And, if you don’t have a lathe at all but are looking to get started with one, you can always build your own from easily-sourced parts.