An Electronic Lead Screw controller using a Teensy 4.1

Changed the code to be initialized as RH threads. Had a 50/50 chance and Murphy chose the other option!

Put in a flag to be able to change the handedness. In a little while, I will add the button to the touch panel. Tried out threading at 40 TPI. First try in aluminum didn't come out so hot, because I muffed a thread start. Lets call that one ugly at best.

Second try, this time in steel, was ok, but I went in too far. Still, it threaded 1/2" into a 1/2" deep 1/4"-40 right hand nut I had made previously, so I am still calling it a win. Still an embarrassing example of threading, so I'm not showing it! It's been a little while since I single pointed and yeah, I had to re-remember thread depth stuff. For a 40TPI thread the 60 degree compound should be advanced 0.5/(TPI * cos(60)) or about 0.025". I went a bit too far. Should have gone in about 0.020 then started to use the thread mic, but honestly, I had forgot that I had one! Kind of embarrassing, really.

I have no room in my shop (yet) for my computer. Fortunately I was able to find a USB extension cord so I could program the controller (and power it!) from the other room. The cord just was long enough. I have a RPI4 for my little shop computer, running off an SSD. It is slow, but it works, and I can program the Teensy. That's what counts!
 
Ok, got a decent 1/4"-40 thread this time. Feel better about this now. A little ragged, but it is a nice tight fit. I'm hoping I got my threading tables right, but eventually I will need to check them.
PXL_20220910_220340475.jpg
Lets see now, I have a 3/4"-16 nut and a 1"-14 nut. It would seem my threading table doesn't have 14 or 16 pitch! Well, I will have to fix that! I will edit the threading table to include them. Of course, now I have to figure out the values N & D for my program. Think I should figure out how to do this on the fly, but for now, I will manually add them to the table.
 
A useful mod would be to be able to enter a custom pitch at your user interface. It is one shortcoming in the Clough42 ELS that I would like to see.
 
A useful mod would be to be able to enter a custom pitch at your user interface. It is one shortcoming in the Clough42 ELS that I would like to see.
I agree. Just added 11, 14, & 16 TPI to my table. But I had to delete 4 TPI because my simple table only can display 25 entries. After that I have to implement scrolling tables. I have no idea yet how to do that with the primitive graphics libraries that I have. Need to learn and use more advanced libraries and there is limited personal payback for me.

To calculate the values is easy. Data entry is the issue. Right now I only have a touch panel. This is my current imperial thread table.
PXL_20220911_003132164.jpg
My latest thread, a 3/4"-16. Easy as pie. No gear changes necessary :grin:

PXL_20220911_003418588.jpgPXL_20220911_003452223.jpg
Got to say, this is very, very nice
 
The two basic numbers that are needed for changing threads or feeds are N and D. (Numerator N and Denominator D)

For TPI:
N = leadscrewTPI * (steps per revolution of the motor) * microsteps/step
D = TPI * encoder_events_per_revolution

for metric:
N = pitch * (steps per revolution of the motor) * microsteps/step
D = leadscrewpitch * encoder_events_per_revolution

For feeds, we can think of the feed as a pitch.

After that the Bresenham algorithm is identical. I chose my timing pulleys on the encoder to be 1:1 with the spindle. Once I got the gear box sorted, all my threads are controlled by look up tables for N and D. There are no other fudge factors or coefficients.

If I implemented a keyboard, or additional method of data entry, then I could add in arbitrary values for threads. I did put in a means to pass simple messages to the controller - I could add a method there.
 
My Imperial thread table:
TPI, ustep, N, D, err
6.0, 8, 25, 32, 0.00,
8.0, 8, 75, 128, 0.00,
10.0, 8, 15, 32, 0.00,
11.0, 8, 75, 176, 0.00, // was 19200, 45056
11.5, 8, 75, 184, 0.00,
12.0, 8, 75, 192, 0.00,
13.0, 8, 75, 208, 0.00,
14.0, 8, 75, 224, 0.00, // was 19200, 57344
16.0, 8, 75, 256, 0.00, // was 19200, 65536
18.0, 8, 75, 288, 0.00,
19.0, 8, 75, 304, 0.00,
20.0, 8, 15, 64, 0.00,
22.0, 8, 75, 352, 0.00,
24.0, 8, 75, 384, 0.00,
26.0, 8, 75, 416, 0.00,
27.0, 8, 75, 432, 0.00,
28.0, 8, 75, 448, 0.00,
32.0, 8, 75, 512, 0.00,
36.0, 8, 75, 576, 0.00,
40.0, 8, 15, 128, 0.00,
56.0, 8, 75, 896, 0.00,
72.0, 8, 75, 1152, 0.00,
80.0, 8, 15, 256, 0.00,
96.0, 8, 75, 1536, 0.00,
100.0, 8, 3, 64, 0.00

A lot of threads, most of which I will never use...
 
Well now. Success at last. Now I have to package things up, as they are a disheveled mess, not suitable for general use in a shop, even mine.

As far as I can figure out, it makes sense to have two enclosures, one for the stepper driver and its power supply, and a separate smaller one for the micro controller, touch display and interface board. Been thinking about connectors - it always boils down to this.

I need some cheap connector sets that are panel mountable. Ideally they'd be different, i.e. keyed, but that's probably out of reach cost wise. Are there any circular connectors that won't break the bank? Otherwise I will have to fallback to banks of DB9's which are cheap and plentiful. I realize the many ways they stink, but they are inexpensive! Between boxes I need 9 wires maximum. Right now I am using 3 twisted pairs. There is an alarm pin, a break pin and a common, which are not being used.

The power enclosure needs 3 wires for mains power, and glands for the motor cables. Then a 9 pin connector. It will also have a fuse and a power switch.

The control enclosure needs 2 connectors (4 pins each) for the DROs (Z and X), the 9 pin interconnect, a connector for the encoder (5 or 6 pins) and some sort of USB connector. This connector is used to supply 5V power to run the DROs, the micro controller, the interface board, and the display. The power for everything, excluding the DROs is 200mA. Guessing the DRO read heads need about 200mA max. This is well within the ability of a USB port to supply, should I need to reflash the code, and a simple wall wart will be fine otherwise.

Speaking of panel mount USB connectors, does anyone know of a super flexible short cable to go from the panel mount to the board? The Teensy uses a microB USB connector.
 
@WobblyHand - you're making great progress. I think the connector you're looking for is an "Amphenol AHD" type connector. You might be able to find what you need here: https://www.waytekwire.com/products/14/Amphenol-AHD-Connectors/ I had better luck using that site over Mouser's as they have so much stuff if you don't know exactly what you're looking for you won't find it. I would be inclined to call the 800 number and tell them what you are trying to do so you can be sure you get the correct plug, receptacle and jamb nut, and pins to go in each.

I hope we can convince you to provide an itemized list of materials used in the event that we would like to follow your lead.
 
@WobblyHand - you're making great progress. I think the connector you're looking for is an "Amphenol AHD" type connector. You might be able to find what you need here: https://www.waytekwire.com/products/14/Amphenol-AHD-Connectors/ I had better luck using that site over Mouser's as they have so much stuff if you don't know exactly what you're looking for you won't find it. I would be inclined to call the 800 number and tell them what you are trying to do so you can be sure you get the correct plug, receptacle and jamb nut, and pins to go in each.

I hope we can convince you to provide an itemized list of materials used in the event that we would like to follow your lead.
I will check out that website for the connectors. Thanks for the link. Places like Mouser and Digikey have so much stuff it's hard to drill down to what you need. I was on Digikey and it took quite a while to sort through the aluminum box options. Have to say that project boxes are at least 2x more expensive than what they used to be.

The basic parts list is pretty simple. I'll write it up in the near future.

I'm trying to learn PCB design again. I did stuff like that in the 80's. The free tools sure have a steep learning curve. Mostly know what to do, but not how to do it with the existing software. Makes it frustrating to get started. Perhaps not strangely the documentation for the latest version hasn't been written. The old docs are wrong for the new version. I don't know why they released it if the docs aren't there at all. It means only power users or experts can use the software and no one else. A lot of the good free PCB tools are crippled to small numbers of components or layers. The completely free tools have incomplete libraries making it hard to get going. Going to have to soldier on through to get it done. Or hack something together. Rather have a board than a rats nest of wiring, but that's me.
 
I use Eagle for my pcb design. I have used it for eighteen years. Currently, it is an Autodesk product and works in conjunction with Fusion. It used to be free but I haven't check in recent years. I have an older version which I acquired prior to being sold to Autodesk as a precaution in the event that Autodesk decides to charge for it. It works fairly well for my needs. The autorouter really simplifies layout. I used to do that manually. I mill my boards on the CNC rather than photoetching as I have tons of old board with expired photoresist so I port the board layout to SolidWorks to create a solid model and then to my CAM program to generate the g code. Autodesk has an app that directly converted the board to the solid model and g code in Fusion.

If your intend to etch your boards, you can print a photomask on a transparency. The easiest route though is to send the files to a board house and have them make the board.
 
Back
Top