Lathe Outfitted With Electronic Gearbox

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.

https://www.youtube.com/watch?v=iSDNKmk5B20

 

45 thoughts on “Lathe Outfitted With Electronic Gearbox

  1. CLOUGH42 makes a pretty good controller kit (just add stepper) for an electronic lead screw, and uses a fairly tame in comparison TI F280049C

    While the more the better, [Not An Engineer] did seem to go though a lot of trouble “reinventing the wheel” instead of looking on what other projects have already solved. (big fan of his BTW, but the entire time watching this I kept feeling like dude your putting a lot more effort into a solved problem than really is needed)

    1. I agree with not reinventing the wheel, however this project seemed more like a lets see what i can come up with rather than grab a kit from somewhere. Also I am not bad mouthing CLOUGH42 he did a great job with his kit I just see this video as something else rather than a copy/paste now it is done thing.

      1. Agreed, it’s often refreshing to tackle a subject from a totally different angle and not just be another “copy pasta’ video that seems to spring up all with same click bait title and subject matter , a good example is all these videos on “adding a lipo to your solar genertor’ and every video is the same “take another lipo and add barrel jack and plug in” , 35 mins to say that. ugh iu hate youtubes algo, it feeds the same crap to my feed every day.

      1. because even though he only has 150k subs (still a good amount but in youtube terms not huge) his videos get traction and that leads to their algorithm pushing him to a nauseating level.

        on a side note mind posting some of the links here. the algorithm is skewing search results as well :(

    2. It is I, Not an Engineer here. Just wanted to chime in and say that this project was much less about reinventing the wheel, and more about understanding how it is that the wheel can roll.

      I’m still an infant when it comes to software, and my implementation is absolute spaghetti – but the process has widened my understanding to an incredible degree, and that alone has made it more than worthwhile.

      Not having to deal with change gears is just the cherry on top.

      1. I totally empathize with your want to pursue some project for your own education, but also would appreciate you citing some prior art and explaining that you want to think this out yourself. Regardless, good job!

  2. I saw that video a few days ago, but didn’t catch the “Arduino was not nearly fast enough to catch every signal from the encoder, ” bit.

    Hunh? This the the 21st century. Weren’t quadrature counter inputs on micros invented for exactly this purpose a long time ago? The Due has two channels. The Teensy4 has four of them. Libraries exist.

    If you’re hell-bent on using something stoneage without a quadrature input counter, you still have the option of dedicated quadrature counter chips; some even give you a nice SPI interface.

    There’s no excuse at all to miss encoder counts.

      1. Quadrature encoder inputs were handled just fine back in the last millennium with an 8-bit 4.7 MHz 8088 PC through the parallel printer port as input. Raw speed is not the answer. Correctly understanding the problem is.

          1. sure but i bet a 20MHz pic12 could just about do it if you really thought about how to use the integrated counter/timer units :)

            not so sure about atmel parts…i feel like an atmega should be able to do it but when i looked, specifically the counter/timer units struck me as the downside compared to microchip pic

          2. With a 2000 pulse per rev encoder, at 2500 rpm, that is 83k and change pulses per second… I am not 100% on the 328p interrupts, but I would think it could handle 100kHz if the chip is running at 16MHz.

            Probably all those serial.print() lines in the isr slowing it down.

          3. [the 8088 couldn’t handle that.]
            Nor did it have to. Because the encoder counting logic was done in hardware just like the quadrature counters in a modern microcontroller except back then it was discrete TTL logic. I was counting quadrature (optical) signals this way at 16 MHz using a 6502 in 1985, but this one needed a 24 bit counter buffer. The 8088 encoder application I mention was much easier: just had to tolerate 25 kHz.

      1. there are a ton of examples that preceded James’s work as well… some superior in various ways, others not. There used to be a yahoo group of electronic leadscrew developers with some really cool examples. I really liked one that had control of both the crossslide and carriage leadscrews… dial-a-taper turning.

      2. Bresenham is superior to the complicated math (necessitating a powerful processor) that clough42 used. Actually, I find this article from [Not an Engineer] interesting enough to see if I can find a link to source code, (I want to build something similar) while I did not find the clough42 version interesting enough for this.

        STM32 has hardware support for high speed quadrature encoders, and I think the Teensy 4.1 has this too, but I don’t know yet if it’s being used here. But for real-time accurate control you probably want to trigger an ISR and run Bresenham on each encoder flank. Letting the hardware run and accumulate encoder pulses in a hardware register is not very useful here.

    1. It’s also easy enough to toss your own quadrature decoder in front of a chip that doesn’t have them built in.

      https://www.fpga4fun.com/QuadratureDecoder.html

      Hook the step line up to an interrupt, and read the direction line when it hits. The speed limit will be how quickly your chip can get in/out of IRQs, or if you can think up a clever counter using the hardware peripherals.

      I suspect the Arduino libraries are trying to do it all in software, and that’s what is slowing them down.

  3. You make it sound like there is some kind of black magic to using gears. You look up what you want on a table and put the correct ones in and the advancement speed is locked to the spindle speed. Any kind of electronic solution is going to be sloppier. Just wasting time re inventing a wheel that you are not going to improve on and does not need to be re invented.

    1. That’s fine if you only want to cut threads that are on the tables. 95% of the custom threads I cut, aren’t on the tables because they’re non-standard and I can’t buy them and that’s why I’m cutting them. And on my lathe, unless you go find a NOS triple slot banjo, it’s only approximately correct or impossible to get some feeds, so you can only cut a few threads deep before the cumulative error makes it bind.

          1. It’s the system that holds the gears. You have to take it off and bolt on new gears and adjust them for every gear change. It’s quite a fiddly and time consuming process.

      1. I guess if you let the lathe control everything so both the spindle and advance are servo controlled and linked to each other. It just seems like a plan that is likely to fail. I can perhaps see it stopping before it does major damage the issue would be in starting it back up again. As much of a pain in the ass as gears may be you can be sure the components are in lock step with each other. It might make more sense to see if you could figure out the ratio for the gears you need to the thread pitch you are after and make the gears.

  4. Seriously team. Even if you don’t know or care about metal or lathes, this dudes videos are freaking hilarious. And so painfully true.
    Summary: Australian dude in tiny shorts in his backyard shed narrates into a non-microphone while documenting his lazy solution to a very complex problem.

      1. Some lazy people became millionaires because they found a way to do something easier/faster/better.

        OTOH, some people became millionaires because they found they could make something cheaper, not better.

  5. There seems to be a huge aversion, particularly amongst hobbyists, to using hardware timers. I see it very often, driving servos or motors, counting pulses, etc, all done with software timers/PWM or counters rather than just using a hardware timer or counter. I know the classic arduinos are lacking in the timer department but there are so many more MCUs that can be used and there are a lot more accessible ones now too.

    There is hardware built in MCUs designed for the exact task people are trying to do yet they don’t use them.

    1. I believe, except I have also thought the same question, that it’s just because they don’t know. Or perhaps they know but doesn’t realize the extreme difference it can make, and avoid going into it because it’s “difficult”..

      I have also felt this some 15 years ago, but then I was dissatisfied with the software result so I learned the hardware way either way.

      So it might be acceptable for a hobbyist starting out?

      But why my washing machine keeps missing pulses ON THE PRROGRAM KNOB is an extreme mystery, surely they got paid, aka professionals. So how can they miss 1 pulse per second?

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.