# Electronic Lead Screw



## ttabbal

I'm going to attempt to adapt clough42's ELS to my PM1127. I figure I might as well do it publicly in case it ends up being useful for someone else. I have most of the parts now, and have the electronics and servo running on the bench. The first thing I decided to mess with is the rotary encoder. I needed a way to drive it from the spindle. I decided to try adapting one of the GT2 pulleys to replace a change gear. This allows a minimaly invasive connection.




The pulley is a bit thicker than the stock gears. This 80T has enough metal in the middle that I can turn out a shallower section in the middle if needed though. 

It started out looking like this.. 




I held the protruding part on top in the chuck, cut the keyway (3/16 HSS blank worked great). Faced the bottom flat. Then gripped the end and parted it off. Then faced the parted side. Note that these are not a single piece. The center is solid, the toothed ring and the two flanges are pressed onto the center. 

The spindle is 40 teeth, so the plan is to mate the pulley to an 80 tooth gear. Then use a 40 tooth pulley on the encoder. That should put the encoder at the same RPM as the spindle. 

The gear will be held on the stock change gear rack with the stock axle. The encoder I'm planning on building a bracket to mount with t-nuts to the change gear rack where the second gear set would be.


----------



## Briney Eye

That looks like it ought to work.  Thinning the timing pulley in the center to the same thickness as the stock gears to get full engagement of the nut is a good idea.  I used a 6mm GT2 timing belt to couple the encoder on my ELS project, and replaced the stud gear on my Logan Model 200 with a modified timing pulley.  I'm driving the leadscrew with a 15mm wide 3mm pitch belt.  You've got all kinds of room under the cover on your lathe to do pretty much anything you want.  Keeping the encoder pulley small is a good idea, to keep the mass down.  I worried about spring/mass-induced oscillations, but have had no issues.  Even 6mm timing belts are very stiff.


----------



## ttabbal

Finally got some shop time. 

Thinned out the center and mounted the stack on the bar. Looks like it will work. 

I also made some T-nuts for the arm to use for mounting the encoder mount. The thread is M6-1.0. The stock nuts have a round center, but the normal shape works fine.


----------



## ttabbal

Decided to take a break on the gears and look at the Main control panel. Did some expensive learning on the CNC, but overall I'm happy with it. I didn't see a version with the text, so I used Fusion360 to add it and generate toolpaths. The depth in the top right got a little bit light, but it's good enough to read without hassle.


----------



## kb58

I'm doing the same to an old Takisawa TSL-800, https://www.hobby-machinist.com/threads/tsl-change-gears-or-the-lack-thereof.79453/


----------



## Bob Korves

I know little about these modifications.  My first thought of where to put a RPM reader would be at the left end of the spindle, or maybe even in the gear box if it does not use flood lubrication.  Change gears get moved around a lot, and that may cause extra time to set up the reader with each change.  ??


----------



## kb58

Once this modification has been done, there is no longer any need for any change gears, it's all done electronically. As for where to put the encoder, it's on a case by case basis where it should go, since we use a wide variety of lathes.


----------



## ttabbal

I'm mounting the encoder on the rack that holds the change gears at the moment. The designer put his under the cover on the left as well. Last time he showed it, it was mounted on a magnet from an indicator stand. 

I'm planning on putting the servo under there somewhere as well. Probably just wherever is convenient for testing. Then I'll try to find a way to get it mounted in a way that allows me to close the cover. That way I can order the right belt after I have a good spot so I can measure for it. 

Thanks for sharing your progress @kb58! Glad to see other takes on setup.


----------



## Bob Korves

kb58 said:


> Once this modification has been done, there is no longer any need for any change gears, it's all done electronically. As for where to put the encoder, it's on a case by case basis where it should go, since we use a wide variety of lathes.


Doh!  I missed that bit of reality...


----------



## ttabbal

Got some shop time in finally. The encoder is mounted after a couple of, um, test fits. 

Connected it to the board and tested RPM readout. It worked great. Matched up closely with the onboard gauge across the range. So one down.

The belt in the photo is 280mm long. I wouldn't want to go much longer as it will start interfering with the input pulley at the bottom. I suspect that a 250mm would work, but don't have one on hand to test.


----------



## ttabbal

Finally got some shop time in. I have the motor connected and forgot to get a pic. I grabbed the latest code and played with the settings. I have 2 problems right now.

1) There is a slight gear ratio in the built in gearbox that I am not adjusting for. When I get it close by just tweaking and testing, I'm darn close on threading. I think if I can figure out the ratio in there, I can get it dialed in. 

2) This lathe has a separate drive line for feed that doesn't use the lead screw. This does not appear to match the lead screw, no reason it should. So I'll need to update the code to support that. I'll contribute it back to the project once I get it working.

I did do some test cuts when I managed to get feeds close. I think it will work well once I sort out some of the issues.


----------



## ttabbal

Hmmm, well, PM doesn't know what the ratios are. It's a weird question I suppose. The current plan is to use the spare encoder and mate it to the end of the leadscrew. There is a castelated nut on the end. I'll 3D print a coupler that will fit over it with a set screw. Then mate that to the encoder. I printed the mag base bracket the author designed to hold the encoder. I can then write some test code to pulse the stepper till I get a full rotation on the encoder. Then save the pulse count. With 4096 encoder pulses per rev, it will certainly be more accurate than eyeballing it like I am now.

I was adjusting and using the DRO to dial it in. That works ok, but I think this will be a better idea overall.


----------



## RJSakowski

Gear ratios are fairly easily determined. 
EDIT:  In reviewing this post I noticed that I had misread my gear chart causing some erroneous calculations.  The erroneous text has been struck through and the correct text follows in red.  The procedure for determining the gear box ratio remains unchanged. 

If you look at your thread chart for the change gear combination for cutting a thread equal to your thread pitch, you can easily determine the ratio inside the back box.  Write down the equation  where each driven gear ( upper case) is in the numerator and each drive gear (lower case) is in the denominator like this A/a*B/b*C/c*Gearbox ratio = 1.  For thread pitches other than the lead screw pitch, The equation becomes A/a*B/b*C/c*(Gearbox ratio) = (Lead Screw Pitch)/(Thread Pitch).

As an example, my 602 has a 12 tpi lead screw and the chart shows to cut 13 tpi thread, I need to set the gear box in positions I and B and use change gears 36 and 52.  The equation is 40/60*36/127*127/52*(Gear Box Ratio) = 12/13.  Rearranging and simplifying the equation to calculate the gear box ratio,
GBR = 12/13*60/40*127/36*52/127 =12/13*60/40*52/36 = 2.

With the gear box set to positions I and A, I would cut a 26 tpi thread so the GBR would be 1 and with the gear box set to [positions I and C, I would cut a 52 tpi thread so the GBR would be .5.

In a similar fashion, if I used the same 36 and 45 change gears but set the gear box position to II and B, I will cut a 13.5 tpi thread so the equation becomes 12/13.5*60/40*127/36*5245/127 =12/13.5*60/40*5245/36 = 1.9259251.66666......

My chart doesn't use position III for threading inch threads but looking at the metric chart or the power feed chart, the ratio I:II:III II:I:III is 5:6:7 so changing the gear box  from I and B to III and B will increase the cut thread lead by the ratio of 7/6 which would be 13 tpi * 7/66/7 =15.1666611.142857.
Making that substitution, the equation becomes GBR = 12/15.1666611.142857*60/40*127/36*52/127 =12/1311.142857*60/40*52/36 = 1.714282.3333......

In this manner, it is possible to calculate the GBR of all the possible combinations of the gear box gears.  It would be possible to further determine what is going on inside as to what the actual gears are  by looking at the parts diagram but that is really only to satisfying curiosity as what matters is what comes out vs. what goes in.


----------



## ttabbal

Thanks! That is great. I got as far as figuring out the compound gears but wasn't sure about the leadscrew and some other bits. I'll give that a go with my lathe and see if I can't get it going that way.


----------



## RJSakowski

ttabbal said:


> Thanks! That is great. I got as far as figuring out the compound gears but wasn't sure about the leadscrew and some other bits. I'll give that a go with my lathe and see if I can't get it going that way.


Please review the edited post to see the changes made.  Sorry if created any confusion.


----------



## ttabbal

Thanks for the update! I did the calculations and came up with these ratios in threading mode.

A 1.25 
B 2.50 
C 0.625

As the stepper driver is set for 1000 steps/rev, in A gear I came up with 800 steps. I had gotten to 850 just trying to adjust by selecting a value and comparing to the DRO.

With the current settings, I tested manually and got 0.1" movement per spindle rev in 10TPI threading mode. Perfect. So I cut a 1/2-13 thread with it, which worked great! Even with some pretty deep cuts, it never had a problem.

Feed rates are off by a factor of 5. With 5 thou per rev set, I get 1 thou. That's easy to apply a correction for.

Here are the currently modified settings. The microsteps setting is to account for the 3:1 belt pulley ratio. 



		Code:
	

#define LEADSCREW_TPI 10
#define STEPPER_MICROSTEPS 3
#define STEPPER_RESOLUTION 800


----------



## ttabbal

Here is a current pic of the physical installation. Now I need to get to work on an enclosure for the electronics and final mounting for the control panel. I'm thinking to mount it on the DRO arm to keep all that stuff in the same place, with the enclosure on the backsplash.


----------



## ttabbal

Got the code modified and tested. I can now accurately set feed rates. I also tested metric feeds and threads successfully. Now to figure out pull requests on github. I think I have everything I need for the enclosure now, so I'll need one screw at 2AM.


----------



## ttabbal

I decided to make a better enclosure. I'm waiting on the box, but I made a plate that's a bit smaller so I could work on it. It's coming along nicely so far.


----------



## ttabbal

Getting to the home stretch! I designed and 3D printed some plates for the enclosure that fit in the knockouts. Then I did it with a bracket to mount the control panel to the DRO bracket. Installed the enclosure on the side of the bench and now I just need to cut a hole in the headstock cover so I can install it.


----------



## ttabbal

Lathe Electronic Leadscrew by ttabbal
					

These are files I designed to complement the Electronic Leadscrew project from clough42.  I created feedthrough panels that use the knockouts in the enclosure rather than cutting a large hole. The gasket is created to match. I used a laser cutter to cut them out of automotive gasket material...




					www.thingiverse.com
				




I figured thingiverse made sense for sharing the design files in case someone wants to use them.


----------



## ttabbal

All buttoned up. The cover needed to move just a little bit up and toward the front of the machine. The 80 tooth pulley at the top was just enough to interfere with the cover. I used a 4.5" hole saw to open it up for the stepper. It was overkill, 3" would probably work, but I don't have a large selection of metal hole saws. 

The enclosure is at the bottom left. I decided it would be irritating by the back splash if I want to work on it, so decided that would work better.


----------



## GunsOfNavarone

ttabbal said:


> View attachment 303830
> 
> 
> Decided to take a break on the gears and look at the Main control panel. Did some expensive learning on the CNC, but overall I'm happy with it. I didn't see a version with the text, so I used Fusion360 to add it and generate toolpaths. The depth in the top right got a little bit light, but it's good enough to read without hassle.


I NEEEEED this....where did you find the control box/buttons, I didn't see it on his website.


----------



## ttabbal

His thingiverse.com page is linked somewhere in the videos. He provided the 3D models for the box cutouts and such, I used one of them to generate tool paths for the box and used my CNC router to cut it. 

He also posted a lid using a PCB. It seems like a good option if you don't have CNC capability. I 3D printed the buttons like he did, and used red packing tape as a lens for the LEDS.


----------



## GunsOfNavarone

I have no cnc anything, nor a 3d printer. Hopefully Clough offers something soon, don't really want to make it out of an Altoids tin or cardboard...


----------



## mbonadio

@*ttabbal I also have the PM1127 and I have all the electronics working, now just need to find the correct pulley's and belts. Do you remember where your purchased the HTD belts? I'm having a difficult time locating a seller with the 72 tooth 14mm and the 1/4" 24 tooth.

Thanks for any information and it's awesome to see you got it working, can wait to get it all hooked up to my machine,*


----------



## GunsOfNavarone

72 tooth

24 tooth
Belts were Ebay and amazon, if you can't find them, let me know. I ended up not going with clough's placement for things so I ended up needing different sizes. I have a lot of left overs, figure out what you need, I think many of us that freestyled have leftovers..


----------



## mbonadio

Thanks so much, pulleys are on their way, the GT2 belts were easier to find, and I'm printing some up so that I can start working on attaching the encoder to the gear.


----------



## ttabbal

Glad you got it figured out. I got the larger belt and pulleys from ebay, the GT2 parts were all over the place and Amazon was able to get it to me fastest.


----------



## mbonadio

Do you have any close up pics of the attachment points and mounts you used for the encoder and the servo motor? I love your clean design and having it be easily reversible.

Thanks
Michael


----------



## ttabbal

The photos I took are in the thread above. If you click them you should be able to get a larger version. 

The encoder mount is simpler than it looks. It's a piece of aluminum block squared off, then drilled to match a right angle bracket I milled some slots in. It's held down to the arm with a pair of T-nuts in the arm slot the same way the stock gears are. The bracket also has holes drilled to mount the encoder on the other side. It's just a piece of angle aluminum. 

The servo is on a pair of brackets. The first is a commercial unit that fits the motor. I got lazy and it was something like $5/pair.  The other is just more angle aluminum with slots. It's mounted to the lathe with some holes I drilled and tapped. 

The exact mount locations are determined mostly by the belt length. So I just found a spot that was about right, added a little space for adjustment, and put the holes there, leaving some space in the slots for adjustment.


----------



## mbonadio

Thanks for the info, that helps so much


----------



## mbonadio

Hi @ttabbal 

I just downloaded the latest version of the ELS and I see that your code was merged into it. What values did you end up using for the following constants?

Thanks
Michael

#define LEADSCREW_TPI 10

// Steps and microsteps
#define STEPPER_MICROSTEPS 3
#define STEPPER_RESOLUTION 800

// Separate step and microstep settings for feed rates.  Redefine these if your
// lathe has a separate feed drive train with a different ratio.
#define STEPPER_MICROSTEPS_FEED STEPPER_MICROSTEPS
#define STEPPER_RESOLUTION_FEED STEPPER_RESOLUTION


----------



## ttabbal

Those are the settings I'm using, with the change below. 

#define STEPPER_RESOLUTION_FEED STEPPER_RESOLUTION * 1.66


----------



## mbonadio

ttabbal said:


> Those are the settings I'm using, with the change below.
> 
> #define STEPPER_RESOLUTION_FEED STEPPER_RESOLUTION * 1.66



Thanks for the response, will update the source today and check it out. I had some movement last night and it was so exciting, now need to consider the box to contain everything.


----------



## bcrosby

I know this is a very old thread, but I'm hoping to revive the conversation. I also have a PM1127-LB and am in the process of installing the Clough42 ELS. I took delivery on my lathe in March of 2020.

I have been researching gear ratios on my lathe and am finding a VERY DIFFERENT reality from some of you. My lead screw is 8 TPI. With the gearbox in position "A", my gear ratios for both the lead screw AND the drive shaft are 1:1. With the gearbox in position "B", my gear ratios for both the leadscrew AND the drive shaft are 1:2. And, with the gearbox in position "C", my gear ratios for both the lead screw AND the drive shaft are 2:1. Does anyone elses experience match mine?

I'm also curious what other's experiences are regarding the sizing of your stepper motor. Has anyone tried a larger stepper motor set up as a direct drive to the gear box input shaft? If so, what did you choose for sizing?

I'm not to the point where I can take pictures, but when I get there, I'll share my experience.

Thanks in advance for anything you can offer . . .


----------



## GunsOfNavarone

@bcrosby you can input your lead screw value of 8 tpi into the setup and you would want 1:1 ratio since you are using the Clough ELS. A large stepper motor probably isn't a bad idea from my experience and whatever that stepper is, you can adjust it's steps in the stepper driver setup. I thik his setup is pretty versatile. I also think there is a Clough specific thread you may want to post on as this one is more for the OP's journey to his very different setup. Search for Clough42 and it should be one of the 1st hits.


----------



## bcrosby

Thanks much! There appear to be several Clough42 threads, most of them of builds various members have undertaken. I'll peruse a bunch of them and see where they lead me.


----------



## freethink

bcrosby said:


> I have been researching gear ratios on my lathe and am finding a VERY DIFFERENT reality from some of you. My lead screw is 8 TPI. With the gearbox in position "A", my gear ratios for both the lead screw AND the drive shaft are 1:1. With the gearbox in position "B", my gear ratios for both the leadscrew AND the drive shaft are 1:2. And, with the gearbox in position "C", my gear ratios for both the lead screw AND the drive shaft are 2:1. Does anyone elses experience match mine?


I'm also in the process of doing the Clough42 ELS upgrade on the PM1127.  My lathe was manufactured in 2020, and also has the same gear ratios as you're describing.  I think they may have changed gear ratios when they changed the motor drive ratios, but I'm not sure on that.  I know the manual they provide doesn't match my machine, so it did change at some point.

I decided to go with the same Nema 23 hybrid servo from Ebay that James uses.  For gearing I'm doing a 80T change gear engaged to the 40T spindle gear, coupled with an 80T GT2 gear, and a 40T GT2 gear on the encoder.  Lead screw drive will have a 60T HTD 3M gear with a 30T HTD 3M on the servo.  Just waiting for all the gears and belts to make their way over from China so I can finish the project.  I can update with pictures when I get a little further.


----------



## RJSakowski

bcrosby said:


> I know this is a very old thread, but I'm hoping to revive the conversation. I also have a PM1127-LB and am in the process of installing the Clough42 ELS. I took delivery on my lathe in March of 2020.
> 
> I have been researching gear ratios on my lathe and am finding a VERY DIFFERENT reality from some of you. My lead screw is 8 TPI. With the gearbox in position "A", my gear ratios for both the lead screw AND the drive shaft are 1:1. With the gearbox in position "B", my gear ratios for both the leadscrew AND the drive shaft are 1:2. And, with the gearbox in position "C", my gear ratios for both the lead screw AND the drive shaft are 2:1. Does anyone elses experience match mine?
> 
> I'm also curious what other's experiences are regarding the sizing of your stepper motor. Has anyone tried a larger stepper motor set up as a direct drive to the gear box input shaft? If so, what did you choose for sizing?
> 
> I'm not to the point where I can take pictures, but when I get there, I'll share my experience.
> 
> Thanks in advance for anything you can offer . . .


I have the same lathe as Clough which has a 12 tpi lead screw.  I ran 1:1 pulleys from my 600 oz-in, stepper to the lead screw input shaft which ia essentially the same as direct drive but changed the gear box setting for a 2:1 reduction in speed to obtain more torque.  The testing I did resulted in the stepper being able to pull 105 lbs measured at the carriage at 300 rpm and a feed rate of .12 in./rev. or 36 ipm.

With a 50% larger motor and a lower speed range, you may want to opt for a larger stepper to retain full capabilities for power feed.  Threading would probably not be an issue and the cuts are usually quite light.  The down side is a larger power supply and driver will be required.


----------



## RJSakowski

GunsOfNavarone said:


> @bcrosby you can input your lead screw value of 8 tpi into the setup and you would want 1:1 ratio since you are using the Clough ELS. A large stepper motor probably isn't a bad idea from my experience and whatever that stepper is, you can adjust it's steps in the stepper driver setup. I thik his setup is pretty versatile. I also think there is a Clough specific thread you may want to post on as this one is more for the OP's journey to his very different setup. Search for Clough42 and it should be one of the 1st hits.


Guns, there are two threads titled Electronic Lead Screw.  The one by greenail, started in Jan., 2019, was not Clough specific although the vast majority of Clough42 related postings are there.  This thread was started by ttabbal in Sept., 2019 and is specific to the Clough42 ELS and the PM1127.


----------



## mbonadio

I've installed clough42 ELS on my PM-1127 and have had it running for the last couple of months. I just need to make the box to contain the electronics, but everything else is buttoned up. I've cut threads but mostly use it to quickly change feed rates to get better finishes. I've had no issues with the stepper handling the cuts the lathe is able to do. If you need any info or pics just ask and i'll post them.

Cheers
Michael


----------



## GunsOfNavarone

Thanks @RJSakowski  I just didn't want anyone to throw salt on that wound. So @bcrosby this is the thread...unload your questions here, my bad.


----------



## ttabbal

I'm happy to help with questions on integration with the PM1127. It sounds like the gear ratios might have changed, but that can be adjusted for in the code.


----------



## bcrosby

Thank you SO MUCH for your input over the past few hours! A gentle reminder why this is such a great forum!

Your feedback confirms the change in gearbox ratios. This simplifies calculations for the programming phase of the project. My thoughts at the moment are to take a couple of unique steps in my build. 

The first is to actually replace the spindle gear with an M3 pulley and drive the encoder 1:1.

The second is to experiment with a direct connection between my stepper motor and the gearbox input shaft. My stepper motor is 8.0 Nm (1,133 oz-in). I might try driving it 1:1 through the gearbox, though more likely I'll try driving is 2:1. That would give me more torque as well as RPM. I can always retreat to a belt drive if that seems advisable.

I have everything mocked up on the bench at the moment and I'm very pleased with its performance. As usual, I welcome any input anyone might have to offer. I'll keep you informed as the project progresses.

Thanks again!


----------



## Joe-R

bcrosby said:


> I know this is a very old thread, but I'm hoping to revive the conversation. I also have a PM1127-LB and am in the process of installing the Clough42 ELS. I took delivery on my lathe in March of 2020.
> 
> I have been researching gear ratios on my lathe and am finding a VERY DIFFERENT reality from some of you. My lead screw is 8 TPI. With the gearbox in position "A", my gear ratios for both the lead screw AND the drive shaft are 1:1. With the gearbox in position "B", my gear ratios for both the leadscrew AND the drive shaft are 1:2. And, with the gearbox in position "C", my gear ratios for both the lead screw AND the drive shaft are 2:1. Does anyone elses experience match mine?
> 
> I'm also curious what other's experiences are regarding the sizing of your stepper motor. Has anyone tried a larger stepper motor set up as a direct drive to the gear box input shaft? If so, what did you choose for sizing?
> 
> I'm not to the point where I can take pictures, but when I get there, I'll share my experience.
> 
> Thanks in advance for anything you can offer . . .


Hi bcrosby,

I just finished the Clough42 ELS on my PM1127-VF-LB lathe and my lathe is the latest version with the updated pulley system same as yours, I thought the same thing as you about the gear ratios, mine are also 1:1 on both the lead screw and the feed screw. 
But, here's the problem, the gearing in the carriage is not the same as the lead screw, if I set the ELS for a feed of .010", the carriage only moves .006" per revolution. 
So, I used the "#define STEPPER_RESOLUTION_FEED STEPPER_RESOLUTION * 1.66" (as mentioned by ttabbal) and it solved that issue. Now it feeds at whatever rate I set it at (within a tenth or two). 
BTW, the ratio for threading was spot on when I programmed it for an 8 TPI lead screw! 

It's an easy fix but if you're not aware of the issue, it can cause you to scratch your head a few times! Lol  

Best of luck!! 

Joe


----------



## Wheat.Millington

I'm in the process of installing and modifying the Clough42 ELS on my lathe. One enhancement I really want is a limit switch. I'm not a programmer - beyond VBA excel macros I write for my work, I get a little lost. I've done some other minor modifications to the code, but I'm stuck on how to handle GPIO with the TI board. I find the documentation difficult to digest. Can anyone point me in the right direction? Which GPIO inputs should I be looking at? Ideally I want a simple switch against a GPIO pin, so either ground or 3v, then be able to pick that up in the code to set enable to false. Am I on the right track?

Thanks.

edit: spending a little more time looking at the code (procrastinating instead of working) I'm beginning to understand the GPIO situation a little better. I'll be interfacing via the booster board and hook into one of the GPIO pins on that header. To be honest I'll probably end up re-using the stepper alarm pin, as I can't really see myself using a stepper alarm (especially with all the built-in security of the recent Clough42 updates).


----------



## RJSakowski

I tried a limit switch in my 602 using the enable function on the driver.  It worked OK but I realized that if you disable the stepper, you lose any synchronization with the spindle, the same as you would if you disengaged a gear in a standard lead screw drive.  This makes it unusable for threading.  It would function for power feed though.  One peculiarity that I noticed was that if the driver was disabled and then enabled, it would start up a random speed and direction unless the driver was shut off before enabling.  I suspect that this is due to the timing sequence requirement of the enable, direction, and pulse.

As I recall, the ELS functions by counting total pulses from the encoder to determine the spindle orientation and uses that information to determine lead screw position and orientation.  Theoretically, with a suitable homing reference, you should be able to set the ELS to set the feed to zero upon hitting a predetermined point.  You wouldn't be able to disengage the half nuts though.  

@greenail uses a different strategy for his ELS and I believe that his design is capable of moving to a limit.  You might want to check his Electronic Lead Screw thread out.  It is a lengthy thread and you might want to start around post 465.


----------



## Wheat.Millington

Thanks, will check out that thread. I hadn't thought about losing sync on a thread using a limit switch.... I wonder if I could code my way around that. Tough problem.


----------



## Wheat.Millington

Just a thought, the rotary encoder I'm using (and probably all/most rotary encoders) has an index pulse. If you modified the code to always start operations at the index pulse, would you always stay in sync, even with a limit switch disabling the stepper drive arbitrarily?


----------



## mbonadio

I would love a limit switch, I think it's a great idea. One that would continue to stay in sync would be icing on top.


----------



## RJSakowski

Wheat.Millington said:


> Thanks, will check out that thread. I hadn't thought about losing sync on a thread using a limit switch.... I wonder if I could code my way around that. Tough problem.


The Clough42 ELS accumulates counts of spindle rotation at 4,000 count/rev. from the moment the spindle starts to turn.  The lead screw is programed to remain in sync with the spindle according to the desired feed rate/pitch.  My understanding is that the counts will eventually overrun the counter so periodically, counts are subtracted to keep the count total within range.

My encoder has an index pulse as well and I had wondered why that hadn't been used in the strategy.  My take on an ELS is that what needs t be know to successfully cut a thread is what the angle of rotation of the spindle is and where the lead screw needs to be for that position.  It would seem to be a simpler problem.  But then everything appears simple if you don't know what's going on.  

The main attraction of the Clough42 ELS for me was that he had a Grizzly G0602 and I have a G0602 so he was providing a more or less turn key solution for me.  I didn't follow his build exactly, using a different hybrid stepper than he used and different pulley ratios on the stepper but it was close enough that I was comfortable. I didn't want to tied down with creating code for a year so I took the easy way out.

There are other ELS solutions out there.  The German Rocketronics ELS is much more sophisticated, being able to automatically cut threads as well as other profiles and can cut to a stop and bordering on a CNC.  It is about twice the investment of the Clough42 ELS.  If I went that far, I would look at converting to a CNC lathe as it would then be easily user programmed.  Greennail's solution is similar.  It will be interesting to see wherte it goes.

As to turning to a stop, I have designed a mechanical stop which will release the half nuts.  It's been on my drawing board for a couple of years now.  I got sidetracked this year designing and building a variable speed replacement for my lathe but that is fairly well complete now, except for a writeup so I should be able to get back to the mechanical stop.


----------



## Wheat.Millington

Great comments thanks. I've seen there's a few options, but I like that the Clough42 option is fully open source and that James has put so much great info in the public domain.

Thinking about spindle sync, I think it's acheivable with a few modifications, unless I'm missing something obvious. Firstly have the lead screw always start moving on an index pulse, so it always starts at a known spindle position. Then you need to keep track of the lead screw position relative to the spindle while in threading mode. When the machine hits the limit switch the spindle keeps turning and the leadscrew stops. Take note of the relative positions and continue counting spindle encoder pulses. Move the lead screw back using the ELS and continue keeping track of the relative positions. Re-engage threading, and the lead screw will start turning as soon as it's resynced with the spindle.


----------



## Joe-R

FWIW, I have my ELS setup with a limit switch on a longitudinal hard stop for feed only, it's just an auto stop feature for turning to a shoulder. 
This method will not work for threading because of lost sync issues as others have already mentioned but I always thread away from the chuck with a LH threading tool upside down and with the motor in reverse (for most threading ops).
I have a "Stepper Online Hybrid Stepper Motor/Driver Combo", I wound up running the enable function of the driver through the limit switch, mine will stop the feed shaft when the limit switch is closed and it does that instantly, the stepper motor will start again when I move the carriage away from the limit switch but I found that there is a slight delay from the time the limit switch is opened and when the motor starts again, I believe the delay is just over 1 second but that has never been an issue for me.
The speed and direction always stays the same on restart, I've never experienced restart in reverse or at a different speed and I've never had to cycle the power or reset it in any way.
I contacted Online Stepper and they said that their drivers are configured to do what I described above and the delay on enable is there to prevent the motor from losing steps, it's an internal calculation and ramp up thing (I think that's what it is anyway), at any rate it acts like a new start cycle has just been initiated. 
I'm not sure if other brands of drivers are configured that way or not. 
BTW, I simply picked up a 5vdc source on the control board and fed that through the limit switch to the enable terminal on the driver, I added a toggle switch to that circuit so I could disable the limit switch for times when I do not want the lead screw to stop automatically, I tend to use the longitudinal hard stop to set the start of new threads (when threading using the reverse method). 
Even though this does not work for threading, it sure saves me a lot of time for general turning to a shoulder and it even reduces personal stress that comes from making sure I disengage the auto feed lever in time, it even helps me with accuracy. 

Note: I have my driver configured so that 0vdc (low) enables the driver while a 5vdc (high) disables the driver, if there is no wire or voltage signal, the driver is enabled. I left the direction terminal as is from the control board. 

Everyone develops their own style and this added feature is just what works well for me  

Just my two cents worth!! 

Good luck!

Joe


----------



## Joe-R

Wheat.Millington said:


> Great comments thanks. I've seen there's a few options, but I like that the Clough42 option is fully open source and that James has put so much great info in the public domain.
> 
> Thinking about spindle sync, I think it's acheivable with a few modifications, unless I'm missing something obvious. Firstly have the lead screw always start moving on an index pulse, so it always starts at a known spindle position. Then you need to keep track of the lead screw position relative to the spindle while in threading mode. When the machine hits the limit switch the spindle keeps turning and the leadscrew stops. Take note of the relative positions and continue counting spindle encoder pulses. Move the lead screw back using the ELS and continue keeping track of the relative positions. Re-engage threading, and the lead screw will start turning as soon as it's resynced with the spindle.



If you are only interested in having a hard stop for threading and you are interested in a fairly simple method, use a Z axis or longitudinal hard stop limit switch to stop the spindle while simultaneously engaging an electronic brake to prevent coasting (resistor or magnetic type depending on your setup). 
Then return the carriage as normal, just be sure to leave the lead screw synced to the spindle.
Reverse the spindle direction if threading metric (if your leadscrew has imperial threads).  

Of course if you are mostly interested in doing this through coding and syncing via software and encoders, then the above suggestion is pretty much pointless  

Personally, I was going to do the auto spindle stop through a limit switch but since I do most all my threading using the reverse method, it was for the most part not worth the time and effort. 

All the best,

Joe.


----------



## RJSakowski

I have the Stepper Online Hybrid stepper/ CL57T Driver  package and it behaves as Joe describes with the exception of the unwanted reversing anomaly.  When turning t a shoulder, I usually stop short with my successive passes and do cleanup as a final op using either the DRO or a hard stop so the the utility of a limit switch was diminished so I removed it.

Another possibility for a limit would be to use DRO information to generate the stop.  Tormach's PathPilot controller for their CNC mills has a great feature for their soft limits in that once the limits are set, the feed will not overshoot the limit, regardless of how fast the feed rate is.  It senses the approaching limit and begins deceleration to come to a controlled stop to a precision of a tenth.  

In an ideal world, a DRO, variable speed drive, and electronic lead screw would all be combined in a single package.  Currently, I have three separate packages operating independent of each other.  However, I have a setup that can accomplish any lathe machining that I want to do with the exception of full CNC machining so I am very unlikely to do much more in terms of refinements.


----------



## Wheat.Millington

Thanks for your replies, this forum is awesome. Having given it some more thought, I think doing the limit switch with a sync'd feed is more trouble than it's worth. I still want a limit switch, but don't think I'll bother with keeping the spindle in sync for threading. However I do think that integrating the limit switch into the enable function of the ELS, rather than the stepper driver, makes more sense. You have a lot more flexibility with how to restart that way.

Unfortunately all I can do at the moment is play with the code because I'm still waiting for my hardware. Ordered early September but unfortunately USPS is evidently having trouble delivering into New Zealand so my package is stuck somewhere in limbo.


----------



## Wheat.Millington

Speak of the devil, received my package last night. Assembled the board and fired it up (still don't have a stepper/servo or driver), everything is working great with my spindle location modification, after a bit of bug fixing. Now I just need some kind of physical spindle lock.


----------



## Wheat.Millington

Wondering if anyone can help me with some troubleshooting. Finally got my stepper and other equipment so have been tinkering and getting it set up. Everything is working well except the motor only turns in one direction, and from what I can measure there is no signal sent to the DIR pin. Any ideas? The issue isn't with my encoder, which is definitely configured and wired correctly and is measuring in both directions.


----------



## ttabbal

There are a number of DIP switches on the main board to set. Double check those perhaps? There could be a problem with the level shift board as well. For dir, I would think that even a simple voltmeter would be enough to test. There is likely no switching on it most of the time. 

There is a reverse button on the control panel. Does that output a signal for the pin? 

If the pin is switching, then you would need a scope or logic analyzer to see it. A normal meter has averaging and can't catch it. The cheap USB analyzer units that are all over eBay and similar are decent and more than capable enough for this. 

You might also try reaching out to clough42. He likely has a good idea where to look for issues on one signal.


----------



## Wheat.Millington

The DIP switches are all set correctly and I tested this to be sure. It definitely seems like the GPIO1 (DIR pin) ont he launchpad isn't switching - I've tested everything else and this seems to be the problem. It's not a faulty Clough42 board either (I have two).

The reverse button changes the LED's but makes no difference to the motor direction.
The motor will turn the other way if I set its DIP switch, but still won't change direction.
The encoder is working perfectly.
Jumping the controller's DIR- terminal to ground DOES cause the direction to change (this is what the GPIO1 pin is supposed to do via the Clough42 interface).
GPIO1 to ground is a few mv and to 5v is 4.8v, so this pin is high and never changes as far as I can measure with my DMM.
DIR- to gnd is 4.15v wich is what you'd expect from GPIO1 being high.


----------



## ttabbal

Have you checked the GPIO pin without the clough42 board installed? It sounds like you might have. Odd. The pin should be connected to the CPU directly, perhaps with pull up or down resistors.


----------



## Wheat.Millington

Yes I tested the GPIO pin directly both with and without the Clough42 board. After extensive testing and even watching the registers directly in debugging I'm convinced that I've got a microcontroller with a bad GPIO pin. I've ordered a new board which will take a while to arrive from overseas.


----------



## ttabbal

It sounds like that is the case. That's frustrating if you have to import it. You could probably work around it with a different GPIO pin and a small mod to the adapter board, and code, but it might be more trouble than it's worth. 

I hope you get the replacement in soon!


----------



## Wheat.Millington

That's what I WOULD have done, but I'm making certain other changes (adding a second display/buttons for additional functionality) that it kinda complicates things too much, so I've decided the new board makes more sense.


----------



## Wheat.Millington

Received my new Launchpad and yep the problem was a faulty GPIO pin on the old microcontroller. Haven't yet had a chance to take it for a proper test run, but everything seems to be working correctly now.


----------



## slow-poke

Clough42 ELS question

Can anyone tell me what happens and what is displayed when you push the SET button?


----------



## Wheat.Millington

It should just say (by memory) NO SETTINGS. There isn't currently any features tied to the settings button.


----------



## slow-poke

Wheat.Millington said:


> It should just say (by memory) NO SETTINGS. There isn't currently any features tied to the settings button.


Thanks, that makes sense


----------



## ivel03

How does the Clough42 system work on these double shaft lathes?  I have a similar Weiss 1127 lathe with the separate lead vs threading screw and i'm guessing that James didn't create the software with that configuration in mind.  I was curious if it could be modified to have a different multiplier for feed vs threading or if it even matters at all.


----------



## tweinke

Take a look at this thread. I just am starting on my PM 1130V. https://www.hobby-machinist.com/threads/electronic-lead-screw.79812/


----------



## ttabbal

ivel03 said:


> How does the Clough42 system work on these double shaft lathes?  I have a similar Weiss 1127 lathe with the separate lead vs threading screw and i'm guessing that James didn't create the software with that configuration in mind.  I was curious if it could be modified to have a different multiplier for feed vs threading or if it even matters at all.




I ran into that on my lathe. I updated the code and sent it to him. It's been added to the main code. It adds a new setting for threading.


----------

