Author Topic: Electronic Leadscrew for the New Lathe  (Read 94416 times)

Offline PekkaNF

  • Hero Member
  • *****
  • Posts: 2523
  • Country: fi
Re: Electronic Leadscrew?
« Reply #125 on: April 14, 2015, 02:37:28 AM »
Aah Forth...When I was a school this was cutting edge. Every processor of it:
http://www.cpushack.com/2013/02/21/charles-moore-forth-stack-processors/

I remember one (least some part of) Norvegian team that was trying to make FORTH-processor for graphics application, bit slices were driven out of everything else than esoteric radar and such signal cruching. And finally out of that too with when signal processors started to appear. With PC:s I lost all interest on computers. Just too many layers of junk.

One more word: Harris. Never used one of those, but some later processors were very much influenced on those designs and ideas.
http://en.wikipedia.org/wiki/RTX2010

Pekka


Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew?
« Reply #126 on: June 28, 2018, 04:58:44 PM »
Guess I better resurrect this ancient thread and try to refresh my memory on what I'd done, if I'm going to use this. 3 years, sheesh!
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew for the New Lathe
« Reply #127 on: June 29, 2018, 09:39:27 PM »
Okay looking back at he old spreadsheet I see I kind of lucked out on the new lathe. I just this week made a set of pulleys for it and I coincidentally gave them an exact 5 to 1 ratio. I did that at the time mainly because 18T and 90T were good do-able numbers for indexing on my old spin collet, and I lack a dividing head. And because 5 to 1 was in the range of a good reduction ratio for the specs of the treadmill motor I had. To have both of those things work out to exactly 5 to 1 was true dumb luck for me.

Why? Because I hadn't looked at this old electronic lead screw thread. And looking at it now I'm reminded that 5 to 1 is THE absolutely ideal ratio to make this work. Because what it means is that I can attach the 600 line encoder I already have directly to the DC motor and that gives me 3000 lines per rotation at the spindle. The DC motor has an extension shaft on the back end, for very easy attachment.

Looking at the lead screw, the ratio of the stepper motor and lead screw will be 1.5 to 1, that means (with a 200 step motor) the 300 steps per lead screw rotation on a 10 TPI screw yields 3000 steps per inch, super-convenient for the 3000 pulse per turn signal from the spindle.

And that means that simple integer division by the intended TPI will yield the proper pulse rate for the stepper to produce that TPI. Divide encoder pulses by 4, you get  a 4 TPI screw. Divide by 28, you get a 28 TPI screw. etc.

This doesn't even require an Arduino to accomplish. It can be done with perhaps two discreet IC's. Maybe something in the 74LS161 series chained ( I have some). I think that's going to be my approach. If that doesn't work I can always fall back on the programmed Arduino I had already developed 3 years ago in  this thread. But even an SBC is overkill, oversized, and slow and complicated by comparison.

Actually even one modern IC might work -- I don't know what's available these days. Basically I need a divide by N circuit with a max divisor of say 56 (for 56 TPI, or fine feed).
« Last Edit: June 29, 2018, 10:43:15 PM by vtsteam »
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: Electronic Leadscrew for the New Lathe
« Reply #128 on: June 30, 2018, 02:37:16 AM »
Sometimes the toast falls butter side up  :thumbup:
Andrew Mawson
East Sussex

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew for the New Lathe
« Reply #129 on: June 30, 2018, 07:44:32 AM »
Glad I didn't own a dividing head! 

I do need to read my own plan A before embarking on B sometimes.
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline rowbare

  • Jr. Member
  • **
  • Posts: 38
Re: Electronic Leadscrew for the New Lathe
« Reply #130 on: July 03, 2018, 03:16:43 PM »
And that means that simple integer division by the intended TPI will yield the proper pulse rate for the stepper to produce that TPI. Divide encoder pulses by 4, you get  a 4 TPI screw. Divide by 28, you get a 28 TPI screw. etc.

So what happens to the left over pulses?  3000/28 = 107 r 4

bob

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew for the New Lathe
« Reply #131 on: July 03, 2018, 03:27:01 PM »
Well, rowbare, I know it's a little difficult to visualize at first, but think about it, and I think you'll get it...they just carry, as long as the thread continues. If you were doing only one turn, yes you'd have a remainder at the end of that turn, but this is a continuous process. In other words, the pulses don't have to line up with the end of each turn. It's just two different frequencies superimposed -- the spindle rotations, and the stepper pulses. Does that make sense?
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline rowbare

  • Jr. Member
  • **
  • Posts: 38
Re: Electronic Leadscrew for the New Lathe
« Reply #132 on: July 04, 2018, 03:36:08 PM »
If you look at it as superimposed frequencies, there has to be a harmonic relationship between them.

Given a 32 tpi thread (32 shows a bigger error than 28) and 3000 ppr, if the cutter has not moved exactly 1/32 of an inch after 3000 pulses, the thread pitch is off.

3000/32 = 93.75, so a divide by n will provide 93 pulses to the stepper per revolution. After 32 revolutions, the stepper will have gotten 32 * 93 = 2976 pulses and will have moved 0.992 inches cutting a 32.25 tpi thread. It isn't a huge error but an error just the same. It is certainly more significant in theory than in practice though...

bob

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew for the New Lathe
« Reply #133 on: July 04, 2018, 07:23:20 PM »

3000/32 = 93.75, so a divide by n will provide 93 pulses to the stepper per revolution. .

Nope, it will provide 93 pulses, plus the .75 remainder as a "virtual" timing interval, because the spindle won't have to travel more that 1/4 of its normal inter-pulse distance before sending the next pulse, #94 to the stepper. The encoder has already moved that .75 amount.

See, the encoder doesn't reset once it gets to 93 which is what you're imagining. It's moved past that point just short of the next pulse position. The stepper just sees a continuous regular stream of pulses from the encoder. And those are timed exactly right.

Get it?

The only error is the fineness of resolution of the stepper. But there is no cumulative error from remaindering.

With a perfect leadscrew and a 3000 ppi stepper ratio the tolerance is a flat .00033" at any point along the full travel of the lathe.

I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline beeshed

  • Jr. Member
  • **
  • Posts: 26
Re: Electronic Leadscrew for the New Lathe
« Reply #134 on: July 10, 2018, 06:07:59 PM »
How do you do metric? Since a Norton box is so easy the big value from an ELS is mixing imperial and metric. I think this is where a programmable device is an advantage.

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew for the New Lathe
« Reply #135 on: July 10, 2018, 10:59:20 PM »
I'm not doing metric.

If you want metric it could be done the same way, but naturally you'd probably want a metric leadscrew anyway, and then you'd work the pulley and encoder ratios the same way but favoring your measurement flavor.

If you want both yeah you could go the microprocessor route. Been there done that earlier in the thread.

If I thought about it hard, I bet I could do it simply with IC's as well. 8 bits (two ls161s) gets you divisors up to 255. And 254 is an interesting number for system conversions. But I don't want to think hard about it right now.
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline assink

  • Newbie
  • *
  • Posts: 4
Re: Electronic Leadscrew for the New Lathe
« Reply #136 on: July 11, 2018, 06:25:13 AM »
There is actually a german version that works, and seems popular in germany.
https://www.rocketronics.de/els/?v=796834e7a283
Just use google translate  :D
It's also able to do tapers and radius,


Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew for the New Lathe
« Reply #137 on: July 11, 2018, 06:32:57 AM »
Yup, I know, mentioned earlier This thread has long since evolved into making one, though.

Ysee, if  project fora like this one just carried links to manufacturer's web pages, there wouldn't be any interesting projects in them, yes?

 :proj:

 :dremel:  :dremel: :dremel: :dremel: :dremel: :dremel: :dremel: :dremel: :dremel: :dremel:



 
« Last Edit: July 11, 2018, 07:24:30 AM by vtsteam »
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline assink

  • Newbie
  • *
  • Posts: 4
Re: Electronic Leadscrew for the New Lathe
« Reply #138 on: July 11, 2018, 07:59:16 AM »
I meant it just for inspiration, have also a link to the full forum page talking about it's working and development. It's rather interesting, but you have to know german or use translate.

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew for the New Lathe
« Reply #139 on: July 11, 2018, 09:52:51 AM »
 Fair enough assink. But I should explain what I love - I guess you'd call it elegance in conservation of resources. So I'm real happy with ditching the microprocessor-display-multifunction approach and thinking through a pennies on the dollar four component control solution that will cut any integer thread up to 255 tpi with no cumulative error. I think of that as my kind of fun. And that's what drives me to make my kinds of things and post them on this very unique forum. :dremel:   :beer:
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline Holt

  • Newbie
  • *
  • Posts: 1
Re: Electronic Leadscrew for the New Lathe
« Reply #140 on: February 16, 2020, 05:11:01 AM »
I just re read this tread, it got me thinking of a youtube series about the same subject.



Holt

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew for the New Lathe
« Reply #141 on: December 09, 2020, 12:23:08 PM »
Well, I'm back at this again, now that my "new" lathe work has resumed and headed toward the finish line.... and I've finally got a big stepper mounted on it. :dremel:

I've had to reverse engineer what I had done before (5 years ago!) -- I have no notes, other than the FORTH program listing, and the surviving breadboard with some connections missing.   :wack: Nevertheless, it's beginning to come back.  :coffee:

I already have a working routine and circuit to do the carriage movement while cutting threads. But what I hadn't yet sussed was how to do multiple passes when cutting a thread. Since this lathe gear is strictly intended as an electronic leadscrew, or more accurately, digital change gear, there are some differences to what is possible with a full two axis CNC lathe.

In the case of CNC where a single pulse on the spindle gear gives spindle positional and timing information, and the program sets the leadscrew rotational speed based on the rotational speed of the spindle, the program can automatically retract the carriage, move it to a starting position, and advance the tool and begin carriage movement at the right time to begin a repeat cut. The single pulse gives a reference point. This method of essentially proportioning rotational speeds is especially accurate where the spindle RPM is controlled by servo, VFD, etc. A DC motor like mine would be less accurate for thread cutting if the load changed with a setup like this, though probably accurate enough for home workshop use.

I chose a different route in this project, which is running an encoder on the spindle yielding, after gearing, 3000 pulses per revolution. This is matched by the stepper gearing (plus the leadscrew pitch) to yield 3000 steps per inch. Any non-fractional TPI can therefore be generated by the simplest integer math:
40 encoder pulses per step pulse yields 40 TPI.
27 encoder pulses per step pulse yields 27 TPI, etc.

This is the most basic programming I can imagine for generating the motion needed. But without positional cue, a single pass is all this routine will do. There is no physical connection between the spindle and the carriage. As I imagine it, the only way to do multiple passes in this system is to use the early lathe spindle reversing method. In this case:

1.) manually stop the spindle motor (which will also stop the leadscrew stepper tracking it)
2.) manually retract the tool from the work
3.) reverse the spindle direction
4.) reverse the stepper direction
5.) power the spindle back to the start position manually (jog)
6.) stop the spindle motor
7.) set new tool depth
8.) change spindle direction to forward
9.) change stepper direction to forward
10.) start spindle to cut next pass

Now there are some sophistications possible. Encoder quadrature could be sensed by the Arduino to do its own switching from forward to reverse stepper rotation. Is this worth the trouble ......eh, maybe not. The little board is doing a lot already, at fairly high computational speed, and I've also heard (Pekka?) somewhere that fast quadrature sensing on the fly can be problematic especially if there's electrical interference.

Seems to me that I can reverse stepper direction and spindle direction simultaneously more simply than by asking a computer to figure out when to do that. A DPDT, center OFF switch on the DC motor could stop and reverse its direction. and if I add a diode and link it to the stepper driver's direction input, that would reverse the stepper rotation when needed.

I guess I'd need another switch for doing reverse threads. So that's two switches and a diode.

Other possible sophistications could be to employ the Hall sensor also present on my lathe (for the tach) to give actual spindle position, but I'm not sure just what this would enhance. I'd still have to jog the carriage with the stepper -- I couldn't release the halfnut to move it, or I'd lose carriage position. This is assuming I was somehow trying to sync up the Hall sensor and the carriage. I actually don't see any advantage in complicating things this way.

The other need is for user input of thread sizes. Six bits of information would give me 64 choices. Something like an 8 pin DIP switch would be overkill. I want to keep things as simple as possible -- no display for the board to have to refresh, no keypad to poll, minimal footprint -- just the Arduino and some switches. Besides, a DIP switch looks almost like an miniature automatic change gear lever set on a traditional mechanical lathe. The only problem for me is I wish they were bigger. Of course you couldn't call it a DIP switch properly then!

I guess I could make a bank out of larger single switches. Better still if the looked like levers instead of plain toggle switches!  :loco:


I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: Electronic Leadscrew for the New Lathe
« Reply #142 on: December 09, 2020, 12:31:52 PM »
I've had to reverse engineer what I had done before (5 years ago!) -- I have no notes, other than the FORTH

Now you know why I bore you to death with masses of details and photographs in my various rebuild threads, many is the time I've had to re-read them to clarify something that I did years ago. It's also a good reason to pop the photos on the forum server so they live as long as the forum does (though I keep higher resolution copies on my machine at home that gets a full back up every seven days)
Andrew Mawson
East Sussex

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew for the New Lathe
« Reply #143 on: December 09, 2020, 02:06:16 PM »
Hey, I not only knew, but also wasn't bored.  :beer:

Onwards and upwards:

Small fly in the ointment re. my outline above. I shouldn't just reverse the stepper driver with a switch, jog back to start position and expect the stepper to stay in registration. True, I've reversed the stepper's direction, but I also need to notify the Arduino to start decrementing from its last encoder count, rather than continuing to increment from it. Natch. There's a difference.

Example: We're 23 encoder pulses towards the step point of 40 while cutting a 40 TPI thread. We stop here and reverse the spindle motor and stepper driver in order to jog back to start. If we don't tell the program to start decrementing it will wait 17 more encoder pulses before sending a stepper pulse. On the other hand, if we tell it to decrement, it will go 23 pulses before sending a stepper pulse, which is proper.
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew for the New Lathe
« Reply #144 on: December 09, 2020, 11:18:32 PM »
Additonal thought. I'll want coarse and fine feeds for the leadscrew as well as thread cutting. I guess .005"/revolution feed for fine feed, and .010" for coarse seem to be in the range for commonly preferred speeds. That would be the equivalent TPI if we imagined it as threading for programming purposes, of 200 TPI and 100 TPI, respectively. Or 200 and 100 encoder pulses per stepper pulse.  :smart:
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew for the New Lathe
« Reply #145 on: December 11, 2020, 11:23:32 AM »
Just thinking about the possibility of doing metric threads with this thing, too.

Assuming my 3000 steps per inch, that's 118.11 steps/mm. Close enough approximation would probably be 118

If 118 was used, the cumulative error over my lathe's normal bed capacity (~ a 12" or 30 cm thread) would be ~0.25 mm).
Frankly, I wonder whether most home shop lathe leadscrews will drive their carriages to .25mm precision after 12" travel.

But for even closer precision, I could just increment one step every cm (a step is only .0085 mm).

I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew for the New Lathe
« Reply #146 on: December 11, 2020, 11:35:03 AM »
Well, that's just imagining a metric 1mm pitch thread. Actually the way to program this for all metric threads is to generalize the increment correction method I mentioned at the end, above.

Basically increment (carry) a step, as you are threading, whenever you've accumulated a remainder (error) greater than half a step. Just like rounding numbers.
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew for the New Lathe
« Reply #147 on: December 28, 2020, 02:18:55 PM »
I've been quiet on this subject for awhile, but actually the ELS project has progressed to near completion (I hope!). The last week or two I have been trying to understand how to program interrupts in the Arduino UNO using FORTH.

Interrupts have been a real Babel of online tech jargon for me to try to weed through to eventually get to a relatively simple set of requirements. I've read through examples for different control chips, read the Atmel datasheet, etc. tested and tested and tested trying to get them working, and finally, yesterday, did finally have success.

While programming for interrupts is a well documented and straight forward process in the official Arduino programming language, that language is too slow for what I want to do, even using interrupts. FORTH is far more compact, and considerably faster. It's also a language I enjoy using again. But the version I'm using: FlashForth has little documentation for using interrupts on an Arduino UNO. What there is is aimed at PCI interrupts on a different board, not EI interrupts, which was what I needed.

Anyway, I'm now at a full understanding of EI's, and the applicable Atmel registers on the UNO, and successful at using the UNO's pins #2 and #3 for A and B signals from the ELS encoder. Actually, I only need one interrupt for the A line. The B status can just be read during the A interrupt routine to determine spindle direction.

I've got a workng FORTH program now as far as reading the encoder goes, but a new fly in the ointment is that my 600 line encoder doesn't seem to work. I don't know whether its open collector outputs got damaged or not -- something the supplier warns about. I'm going to try another test before calling it dead, but that's a big disappointment. I've sent for another, since this one is way too old to inquire about a return. And maybe it got damaged in several years storage -- maybe it was a static problem.

While I'm waiting for the new encoder to arrive, I may open this one up and see if anything can be done to replace the output transistors. I'd need some advice about that from you guys if I do. Not sure what would be suitable in the box of spares.
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew for the New Lathe
« Reply #148 on: December 28, 2020, 08:09:16 PM »
 :doh: :doh: :doh: :doh:
Problem wasn't the encoder but the breadboard. I have two of them. Apparently not quite the same, though they look the same.

The one I've used before has two sets of power busses running down the sides. The newer one interrupts both busses half way down the sides. I was using that one, thinking the busses ran all the way.

Turns out that an encoder just won't work if not connected to power! Took me an entire day to figure that out...  :wack:

Reminds me of the old IT troubleshooting litany: "Did you check to see if it's plugged in?"
« Last Edit: December 29, 2020, 12:11:09 PM by vtsteam »
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew for the New Lathe
« Reply #149 on: December 29, 2020, 10:41:22 PM »
By this evening I have code working to sense direction and then step an old junkbox stepper motor in response to the 600 line encoder via interrupts.

I also have the routine working to divide by a pitch value.  I can twiddle the encoder back and forth as fast as I can manage and whatever pitch rate I set the motor follows proportionately. It still remains to be seen if the whole will be fast enough when running on a lathe. It's going to be a pretty high data rate for the encoder/Arduino program -- 3000 lines per single spindle rotation. At 100 rpm that's 30,000lines /min, or 500 hz, But, fingers crossed....

The remaining stuff to do is:
1.)Add a code routine to subtract the current pulse count from the pitch setting whenever the direction changes.
2.) Add 6 switches ( a dip switch to start with) to set the pitch rate, and add the routine to read that.
3.) Decide whether the pitch value will be calculated from the switch byte, or looked up in a table. I think the latter would be more flexible, and allow future expansion to odd and metric pitches. But the calc method would probably be faster.
4.) try it on the lathe probably with a sharpie in the toolholder.
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg