Logan Model 200 Servo Threading

Any updates?
A few too many other things going on right now to work on it, but I should soon have a new NEMA 24 motor from Stepperonline and plan to swap it in after Thanksgiving. Then I'll try to get more work done on the code. Thanks for asking.
 
Our local Tech School is having a Maker Space open house next week that I'm thinking of attending. There certainly ought to be people there who can provide some insight/advice on putting out a product.

1) All of the buttons on other ELS's is why I went to the Touchscreen-plus-Knob. I offloaded a lot of complexity to the Nextion display so that the Mega could just do the real-time work. No way I wanted a mess of connections to a front panel. Been there, done that. I have a breadboard stacked between a DIN-rail terminal block and the Mega with a couple of RC filters and pullups on it, and a header to consolidate the display/knob connections. If I do a product, I will make a board to do all of that.

2) Pre-computing is the way to make it efficient and fast. In fact, I think it would be kind of silly to do it any other way (but I started doing this back when a 6502 was hot stuff, so the Mega looks pretty nimble to me). The spindle count just provides an index into a lookup table, allowing the interrupt handler to execute in a few microseconds. At 1500rpm my spindle is interrupting at 20khz, so there is only 50us between ticks to get everything else done. If you have to do any math at all you quickly get in trouble.

3) So far the Mega is handling my setup pretty well. I bought a Due just in case, but haven't needed the hardware quadrature decoding.

4) Look at the Nextion lineup. I ignored their Arduino library and parse everything myself with a couple of simple case statements. Keep the protocol simple and it leaves you with lots of cycles to do other things.

My Model 200 looks stock until you notice the touch screen and the enclosure under the pan. I want to keep it that way.
Hi Jon, been a bit out of touch lately,
Hows it all going? Are U close to publishing the code?
One Q I been meaning to ask is, assuming u saw a bit of Clough42's exposé on why he chose the 'big guns' 90 MHz TI Piccolo MCU, which uses the separate hardware based F.P. processor, do you not see the need for similar handling capability, or is his an overkill?
I am MOST interested in your point of view on this..
 
Hi Jon, been a bit out of touch lately,
Hows it all going? Are U close to publishing the code?
One Q I been meaning to ask is, assuming u saw a bit of Clough42's exposé on why he chose the 'big guns' 90 MHz TI Piccolo MCU, which uses the separate hardware based F.P. processor, do you not see the need for similar handling capability, or is his an overkill?
I am MOST interested in your point of view on this..

Just got back yesterday from a Mobile, Alabama visit with our daughter and her family. The new Nema 24 motor was in the mailbox, and I am eager to try it out along with a lower gear ratio. Stay tuned. I hope to upload something in the next few days.

I haven't watched Clough42's video on that, so I should go look for it. Our backgrounds must be very similar, so I'm interested in his take. The only place that I might even consider doing real floating point would be in the initialization code when building the lookup tables, and I haven't found it necessary so far. I don't drop steps even when updating the table while running. I've got nothing against math coprocessors, which can be faster than the core processor even on simple algebra, and probably offer some parallelism as well so there is less of a concern with interrupt blocking.

I've thought that dedicated quadrature decoding might be nice, but I have as much resolution on the spindle encoder as I can use right now. There's no significant difference in the price of a 200ppr encoder versus the 800ppr one that I'm using. Years ago that wasn't the case. The noise immunity might be very slightly better with true quadrature logic than the simple scheme that I'm using, but I haven't detected any issues with what I'm doing since reducing the values of the pull-up resistors to get faster rising edges. The internal pull-ups on the Arduino are too slow.
 
Just got back yesterday from a Mobile, Alabama visit with our daughter and her family. The new Nema 24 motor was in the mailbox, and I am eager to try it out along with a lower gear ratio. Stay tuned. I hope to upload something in the next few days.

I haven't watched Clough42's video on that, so I should go look for it. Our backgrounds must be very similar, so I'm interested in his take. The only place that I might even consider doing real floating point would be in the initialization code when building the lookup tables, and I haven't found it necessary so far. I don't drop steps even when updating the table while running. I've got nothing against math coprocessors, which can be faster than the core processor even on simple algebra, and probably offer some parallelism as well so there is less of a concern with interrupt blocking.

I've thought that dedicated quadrature decoding might be nice, but I have as much resolution on the spindle encoder as I can use right now. There's no significant difference in the price of a 200ppr encoder versus the 800ppr one that I'm using. Years ago that wasn't the case. The noise immunity might be very slightly better with true quadrature logic than the simple scheme that I'm using, but I haven't detected any issues with what I'm doing since reducing the values of the pull-up resistors to get faster rising edges. The internal pull-ups on the Arduino are too slow.
Thankyou kindly for your update,

Sounds like the town of Mobile a long way from U!
I looked again at your screens on the Nextion display, and am now unsure if my Taiwanese lathe would 'fit' with what you are doing as far as backgears speed selection goes. (BTW, it appears the Clough42 Grizzly lathe doesn't appear to have any!)
Pls see snap of my backgear speeds, (backgears are spur gears & very noisy despite minimal wearbriney Eye Jon Bryan backgears Hobby Machinist forum.jpg, hate using them).
Cheers,
 
Thankyou kindly for your update,

Sounds like the town of Mobile a long way from U!
I looked again at your screens on the Nextion display, and am now unsure if my Taiwanese lathe would 'fit' with what you are doing as far as backgears speed selection goes. (BTW, it appears the Clough42 Grizzly lathe doesn't appear to have any!)
Pls see snap of my backgear speeds, (backgears are spur gears & very noisy despite minimal wearView attachment 306954, hate using them).
Cheers,
I'm not sure what you're thinking your problem might be. Your maximum speed is 1240rpm (unless you've got a VFD). That, and the spindle encoder resolution, determine your maximum interrupt rate. I'm easily handling 1500rpm and could push it higher. The slower the spindle turns the easier things get.

My lathe doesn't have a gearbox. My ELS provides a complete "virtual" gearbox. If you're going through a gearbox you will have to approach things differently (like Clough42 has done). I haven't really watched many of his videos, to be honest. I'm listening to his very first ELS installment again while typing this. First thing I notice is that he's chosen 4096 counts per rev on the spindle. He boxed himself in and probably forced the use of a faster processor right there. I'm "only" using 800, so my interrupt rate is less than 1/4 of his, and I've still got 32000 counts per inch of resolution at the carriage. Early design decisions are important.

Eek! He's doing math on the fly! Even more processor power required. I'm way more old-school. I pre-calculate everything and use the spindle count as an index into a lookup table. I guarantee that I am never more than 1/32000th of an inch off.

Off the top of my head, if you're using a gearbox, you have two fundamental options. You can make your ELS simply emulate the gear train between the spindle and gearbox and still use your gearbox normally, or you can implement a more "complete" solution. I haven't given any thought to how I would do that. The simplest would be to choose a gearbox setting, leave it there, and derive everything from that. Or you could have a gear ratio selection option in the ELS. One advantage of the gearbox is that it provides the mechanical advantage that I have to implement with a fixed ratio between my stepper and leadscrew. I'll have to watch more of Clough42's videos to see how he approached it.

I'm never going to attempt to cover what I'm doing with the level of detail that Clough42 has, but he really had a product in mind from the beginning. I considered it, but decided that I didn't want the responsibility or liability and settled on just having fun. Feel free to ask more questions if you have them, though.
 
Last edited:
Can you provide more info on how your lookup tables work? Does each thread pitch have a separate lookup table? Does your routine go to the lookup table after every single pulse of the encoder?
 
I'm not sure what you're thinking your problem might be. Your maximum speed is 1240rpm (unless you've got a VFD). That, and the spindle encoder resolution, determine your maximum interrupt rate. I'm easily handling 1500rpm and could push it higher. The slower the spindle turns the easier things get.

My lathe doesn't have a gearbox. My ELS provides a complete "virtual" gearbox. If you're going through a gearbox you will have to approach things differently (like Clough42 has done). I haven't really watched many of his videos, to be honest. I'm listening to his very first ELS installment again while typing this. First thing I notice is that he's chosen 4096 counts per rev on the spindle. He boxed himself in and probably forced the use of a faster processor right there. I'm "only" using 800, so my interrupt rate is less than 1/4 of his, and I've still got 32000 counts per inch of resolution at the carriage. Early design decisions are important.

Eek! He's doing math on the fly! Even more processor power required. I'm way more old-school. I pre-calculate everything and use the spindle count as an index into a lookup table. I guarantee that I am never more than 1/32000th of an inch off.

Off the top of my head, if you're using a gearbox, you have two fundamental options. You can make your ELS simply emulate the gear train between the spindle and gearbox and still use your gearbox normally, or you can implement a more "complete" solution. I haven't given any thought to how I would do that. The simplest would be to choose a gearbox setting, leave it there, and derive everything from that. Or you could have a gear ratio selection option in the ELS. One advantage of the gearbox is that it provides the mechanical advantage that I have to implement with a fixed ratio between my stepper and leadscrew. I'll have to watch more of Clough42's videos to see how he approached it.

I'm never going to attempt to cover what I'm doing with the level of detail that Clough42 has, but he really had a product in mind from the beginning. I considered it, but decided that I didn't want the responsibility or liability and settled on just having fun. Feel free to ask more questions if you have them, though.
Was thinking of ur backgears screen, https://www.hobby-machinist.com/attachments/img_1974-jpg.287612/
Wasn't sure re my backgears vs yours, and menu settings, as I don't have a clear understanding of your system.. will there be a user manual?
Thankyou again for details.
Looking fwd to JH1990 reply too
 
Can you provide more info on how your lookup tables work? Does each thread pitch have a separate lookup table? Does your routine go to the lookup table after every single pulse of the encoder?
The spindle encoder gives me 800 counts per revolution, so the lookup table has 800 elements. Changing the pitch/rate repopulates the table. The total number of steps in one spindle revolution (within 1/32000th) are evenly distributed into the table. That was a slightly tricky little routine right there. The spindle encoder generates an interrupt on each pulse and loads a variable with the number of motor steps to generate for that pulse. One of the counter/timers in a PWM mode generates the step pulses for the motor and counts them in its own interrupt routine.
 
Was thinking of ur backgears screen, https://www.hobby-machinist.com/attachments/img_1974-jpg.287612/
Wasn't sure re my backgears vs yours, and menu settings, as I don't have a clear understanding of your system.. will there be a user manual?
Thankyou again for details.
Looking fwd to JH1990 reply too
Oh, that's just an arbitrary collection of spindle speeds that will be different for each lathe. I mean to have that screen actually indicate valid speed selections for the current pitch, but haven't implemented it yet. There are fundamental limitations on how fast you can drive the lead screw relative to the spindle speed.
 
Back
Top