An Electronic Lead Screw controller using a Teensy 4.1

Ahem, my code has no bugs. :grin: It's doing exactly what I told it to do - whether I meant it or not!

Setting start and stop points for turning and threading is on my wish list. One of the reasons why I integrated the DROs. I haven't figured out the threading part, though. More inportantly, I have to figure out how to make the UI for it. A 320x240 screen forces you to make some harder choices than if you had a lovely 1920x1080 touch screen.

Sound great!

I've been pondering the threading process with a Z scale for a while. In my mind, it should mimic manual threading with a lead screw, but augmented in a way what's hardly noticeable. In manual threading, you basically have a start point, and a stop point. These are just manually picked by the operator.

If one begins with a defined 'Start' and 'Stop' point (these could be defined by cranking the carriage to each position and hitting a button). The encoder value from Z is saved from those button presses.

Then, when starting a thread, the operator must engage the half nut a bit before the start point (Like manual threading). The ELS can then sync the screw/DRO to the spindle before hitting the start point, and all is good. If not, then it stops the screw and requires a restart to try again (should only happen if the operator didn't give enough 'headroom' to start everything up.)

Stopping the thread, the ELS screw stops at the stop point (or detection of manual stop, by detection of the DRO scale stopping). The screw doesn't restart until the carriage is returned back past the stop point some amount , where the operator can engage the screw and start again...

The major advantage of syncing the screw to the DRO is that metric or English or BA, can be threaded engaging and disengaging the half nut. It doesn't have to stay engaged for a metric screw on an English machine for vise versa.

There are still a few details not spelled out here, but this is the general idea of it...
 
Um, I didn't have any trouble sourcing a TI F280049C from DigiKey. They are showing 207 currently in stock. I don't know if you want to shift gears at this point, or not, but they are available.
Can't see a reason to abandon what I have at this point. Besides, mine's better at this point. It does more than the Clough42 version and is easier to use. I have integrated my DRO's.

The TI boards were out of stock everywhere from about Nov 2021 to July 2022. So I decided to make my own using a Teensy. It's taking a while, but it's a lot more gratifying to see your own ELS working than someone else's. I wrote the code from scratch. It's been a fun little project integrating many disciplines, some of which I had to learn along the way.
 
How did you manage to integrate the DRO? That would be great! I have one, although not everyone does. I was thinking a simple use of the <Set> button would be to start and stop the lead screw, no matter what. Pressing it three times would enter Shoulder Stop mode, which differs from Standard mode in that

1. It stops at the current point every time the lathe reaches it.
2. Pressing the <Set> button additional times reverses the lead screw, rather than just restarting it.
3. The display flashes "Shoulder Stop" or some such every few seconds.
4. The right hand display shows "STOP" whenever the load screw is stopped.
5. The Fwd or Rev LED dlashes depending upon which way the carriage will move when the <Set> key is pressed when the lead screw is stopped.
 
If one begins with a defined 'Start' and 'Stop' point (these could be defined by cranking the carriage to each position and hitting a button). The encoder value from Z is saved from those button presses.
I don't see a need for two set points. When threading or turning to a shoulder, only the stop point is critical. The button can be pressed manually after one resets the carriage position.
Stopping the thread, the ELS screw stops at the stop point (or detection of manual stop, by detection of the DRO scale stopping). The screw doesn't restart until the carriage is returned back past the stop point some amount , where the operator can engage the screw and start again...
I disagree. The ELS should not care when or whether the DRO starts or stops, presumably because the spindle has stopped rotating. Indeed, except for stopping the spindle to take measurements, the spindle should never stop turning.
The major advantage of syncing the screw to the DRO is that metric or English or BA, can be threaded engaging and disengaging the half nut. It doesn't have to stay engaged for a metric screw on an English machine for vise versa.
That is true, but considerably more complex to implement.
 
Last edited:
Can't see a reason to abandon what I have at this point. Besides, mine's better at this point. It does more than the Clough42 version and is easier to use. I have integrated my DRO's.
I am intrigued. Can you expand on this?
I wrote the code from scratch. It's been a fun little project integrating many disciplines, some of which I had to learn along the way.
Using what language? Any chance you would be interested in helping with my ELS project? Porting your code to the TI might be one possibility, or just updating James' code should be fairly easy for anyone familiar with C++, which unfortunately excludes me.
 
How did you manage to integrate the DRO? That would be great! I have one, although not everyone does. I was thinking a simple use of the <Set> button would be to start and stop the lead screw, no matter what. Pressing it three times would enter Shoulder Stop mode, which differs from Standard mode in that

1. It stops at the current point every time the lathe reaches it.
2. Pressing the <Set> button additional times reverses the lead screw, rather than just restarting it.
3. The display flashes "Shoulder Stop" or some such every few seconds.
4. The right hand display shows "STOP" whenever the load screw is stopped.
5. The Fwd or Rev LED dlashes depending upon which way the carriage will move when the <Set> key is pressed when the lead screw is stopped.
Haha, the extent of integration is that I can display the DRO data. I used an encoder library and simply connected the read head cable to my board. On my board there's a level translation. Out pops position, that is, if you calibrated your scales. My scales are loosely calibrated, need to put a precision reference somewhere to get it better.

Honestly haven't worked through the details for thread to a stop yet. Keep the ideas coming, this is good discussion. The point is to come up with a simple interface that enables this function. It's the kind of buttons and even number of key presses, that makes a capability useful and intuitive. Getting the function to work is part of the battle, getting it simple to use, and practically impossible to mess up, is the harder task.
 
I am intrigued. Can you expand on this?

Using what language? Any chance you would be interested in helping with my ELS project? Porting your code to the TI might be one possibility, or just updating James' code should be fairly easy for anyone familiar with C++, which unfortunately excludes me.
Basic Arduino code, but on a 600MHz ARM7 Teensy 4.1. So C and C++. The advantage of doing this is the countless 10's of thousands of free libraries available. The disadvantage is that on my platform that there's no ICE. So you need to be clever.
 
So you have a DRO scale, but not a DRO controller, or do you pass on the DRO pulses from your MCU to the DRO controller? If the former, I'm not sure I am interested. If the latter, then I am *VERY* interested.

My notion for the shoulder stop is pretty simple. In James' code, the <Set> key is unused at this point. That would make it a good candidate, assuming the use is employing the same simple control panel. This does not, of course, have to be the case.

In my vision, the <Set> key pressed once simply stops the lead screw if it is spinning and starts it if it is not, no matter what the controller mode. Pressing the <Set> key three times in less than, say, 3 seconds records the current lead screw position and starts the Shoulder Stop mode. In this mode, every second momentary press of the <Set> button reverses the lead screw direction, as does a press of the <Set> button after the controller has automatically stopped the lead screw.
 
At this point, I have no motivation to plow though the Clough42 code base, nor to port my code to the TI device, which has different hardware. That's a job for SW people at the top of their game. I'm just a guy that plodded along and exploited the capabilities of the Teensy 4.1 platform. I started coding on May 1st, having never used the device.
 
I hear you. It was worth a shot! On a related note, however, clearly you are familiar with the pinout and protocols of DRO scales, at least the ones you are using. Are you using optical scales, or magnetic? If the latter, do you know whether the two are the same? Can you point me toward some documentation?
 
Back
Top