Author Topic: Revisiting a DIY Arduino/Forth Electronic Leadscrew Project  (Read 13053 times)

Offline vtsteam

  • Full Member
  • ****
  • Posts: 1252
Re: Revisiting a DIY Arduino/Forth Electronic Leadscrew Project
« Reply #15 on: February 22, 2026, 11:34:41 pm »
Discovered a little problem today with the Arduino Nano. One of the switches that set the thread pitch wasn't actually working. The six switches I have are labeled A through F. The F switch was the problematic one. I hadn't noticed this earlier since it is mainly used for the last threads in my lookup table -- the coarsest metric threads, and I hadn't tested those yet.

The way things are supposed to work -- pushing any switch to "on" basically grounds it's connected pin in the Arduino. Specifically, my switch F grounds pin D13 on the little computer. But my program wasn't seeing that happening when I flipped the switch.

After doing some electrical testing and not finding anything wrong with the wiring, or the switch, I searched the web for "Pin D13", and sure enough, there were several user issues about a Nano's pin D13 as problematic for input!  Apparently, this a known  issue. :Mad:

The reason, it turns out, is that on the nano this pin is attached to a resistor in series with a LED that is connected to ground. The function of that LED is so people can program these boards to run simple programs that flash it as a demonstration -- in fact the most basic program almost everyone starts with when they get one of these boards is called "Blinky" and it blinks that LED.

To do this the Blinky program converts Pin D13 into an output pin. This pin can either be programmed as an input or an output type. I am using it as an input. Unfortunately, the connection to a resistor and LED and then to ground makes it unresponsive as an input, though supposedly you can add a pullup resistor to +5V and get it to work that way. Recommended is a fairly small resistor since the LED is sinking a lot of current (relatively). But no actual value is given.

I tried a 10K and when that din't work, a 4.7K pullup but nothing changed. Finally I got mad at this road blocking #&%! circuitry and applied my soldering iron to the LED's series resistor -- a tiny surface mount speck, and just flicked it off of the board! :LittleDevil:

SUCCESS! Testing again, switch F now works, and I can select all of the metric pitches that I've programmed in.  :pinkelephant:
Steve

Online Kim

  • Global Moderator
  • Full Member
  • *****
  • Posts: 9611
  • Portland, Oregon, USA
Re: Revisiting a DIY Arduino/Forth Electronic Leadscrew Project
« Reply #16 on: February 23, 2026, 04:24:00 am »
Good sleuthing, Steve!  :ThumbsUp: :popcorn:

There are issues with EVERY project.  It is inevitable. I'm glad you were able to figure this one out, though I'm sure it was quite frustrating going through the whole process.

Kim

Offline vtsteam

  • Full Member
  • ****
  • Posts: 1252
Re: Revisiting a DIY Arduino/Forth Electronic Leadscrew Project
« Reply #17 on: February 23, 2026, 03:36:16 pm »
Thanks kindly, Kim  :cheers: I greatly appreciate your interest! Another test fact came to light yesterday when I mounted the whole unit onto the lathe and tried more settings out. I found that everything worked up to a little over 250 RPM spindle speed. After that the leadscrew stopped working.

A limiting speed was expected since this unit is receiving 3000 pulses per spindle revolution, and it's a lot to ask a computer the size of two postage stamps to keep up with 12.5 khz pulse rate, sense quadrature of the pulses, calculate and count down loop indices, and then output stepper commands. And really, 250 spindle RPM is an acceptable max rate for the threading I'm likely to do.

But I also hoped that I could use this unit for doing regular turning and generating fine feeds for the carriage. I'd like to get more than 250 RPM for that.

So today I'm thinking about options for modification. One possibility is programmatic. Just ignore the encoder output for fine feeds, and send a set pulse rate to the stepper.

Another is mechanical -- since I'm using belts, just slip a belt off of the stepper and onto a fabricated fine feed train to the spindle when needed.

If I have room for it, I'm starting to favor the mechanical approach, which would reserve the electronics for cutting threads. At present I slip the belt off anyway to use the leadscrew manually, instead of trying to turn the stepper motor by hand with the leadscrew. The encoder is also swing-away even now.

Another possibility is changing encoders -- presently the encoder is a 600 line, and runs at 5 times the spindle speed, yielding 3000 lines/rev. I have on hand a 400 line encoder I could substitute, which would drop the data rate to 2000 lines/rev and presumably work for fine feeds up to 375 rpm.

Finally, I should probably look at my code and see if I can reduce time spent during a pulse interrupt. Could be some optimization possible there.

Well it's a freaking Noreaster blizzard outside today so I have plenty of time to think about it!  :Lol:
Steve

Offline Jasonb

  • Full Member
  • *****
  • Posts: 11312
  • Surrey, UK
Re: Revisiting a DIY Arduino/Forth Electronic Leadscrew Project
« Reply #18 on: February 23, 2026, 03:44:02 pm »
By way of comparrison the lathe I tested looks to have had the encoder at double spindle speed and would provide feed rates upto it's top spindle speed. There was a 500rpm limit when threading.

Offline vtsteam

  • Full Member
  • ****
  • Posts: 1252
Re: Revisiting a DIY Arduino/Forth Electronic Leadscrew Project
« Reply #19 on: February 23, 2026, 04:09:50 pm »
Thanks Jason. I just looked and found I have a third encoder that is 200 lines per rev. At 5 to 1 (running direct drive from the spindle motor) that would give 1000 lines per spindle rev and probably allow fine feeds up to 500 RPM.

This would require a different set of belt pulleys between stepper and leadscrew, and make the stepper work a lot harder, but probably do-able. Presently the stepper is belted with 1.5 to 1 pulley advantage. If I switched over to this new line rate, I'd go to 1 to 2, to keep the program's math similar. In other words the stepper would see 3 times the work. It's a pretty big, motor though, and presently not running at top driver current available.

But if I went the mechanical route, fine feeds would be available at any spindle speed that the lathe could run, and would be proportional to that speed. I'd only need a couple pulleys and a belt. Wear on the electronic elements would be reduced to only screw cutting, which isn't something I do every day.

But also, I'd have one fine feed rate. Probably say 200 revs/inch of carriage travel. More choices would require more trains, and then I'd be getting back into conventional gearbox antics.
Steve

Offline Jasonb

  • Full Member
  • *****
  • Posts: 11312
  • Surrey, UK
Re: Revisiting a DIY Arduino/Forth Electronic Leadscrew Project
« Reply #20 on: February 23, 2026, 04:34:27 pm »
Thinking back there were two feed options with that lathe.

One was related to spindle rotation like you would get on a lathe with conventional gears and is in effect a very fine thread. The other just ran the stepper at a set feed rate along the bed much like a milling machine power feed would you could enter a speed within a certain range, I think hardinge lathes have this feature with a motor powering the feed shaft. This is how it could be used to cut keyways etc just by moving the carriage while the spindle was stopped

<a href="https://www.youtube.com/watch?v=tB7MaCHxQQ0" target="_blank">http://www.youtube.com/watch?v=tB7MaCHxQQ0</a>

I'm not sure if you could program yours to ignore the encoder and just run at preset speeds unrelated to spindle speed, probably your six buttons could each give one speed?

Edit, another thought for feeds would be to add a potentiometer and use that to give an infinitely variable feed by using it to control the stepper motor speed. Just fit the belt to the encoder when you want to screwcut.
« Last Edit: February 23, 2026, 04:49:26 pm by Jasonb »

Offline vtsteam

  • Full Member
  • ****
  • Posts: 1252
Re: Revisiting a DIY Arduino/Forth Electronic Leadscrew Project
« Reply #21 on: February 23, 2026, 04:58:17 pm »
I could possibly do that, Jason. I'd probably want an additional switch to change modes. It would allow carriage speeds unrelated to spindle speed.

The routine it would signal to run would turn off interrupts (and so block the threading code from running). Then it would read the other switch settings. It would ignore those meant for threading, but respond to those meant for carriage feed rates.

If the computer sensed, lets say for argument's sake, a switch combination of D E F for a carriage traverse rate, it would output pulses to the stepper at a set rate that would make that happen.

It would do that until the new feed switch was turned off. when it would stop. Or, of course you could just lift the carriage feed lever to stop the movement, while the leadscrew kept on turning.

It would be possible to have a variety of fixed feed speeds that way, since I still have plenty of available unused switch combinations.
Steve

Offline vtsteam

  • Full Member
  • ****
  • Posts: 1252
Re: Revisiting a DIY Arduino/Forth Electronic Leadscrew Project
« Reply #22 on: February 23, 2026, 06:00:26 pm »
Carriage speed could optionally be controlled by a potentiometer instead of switch settings. The Arduino has unused analog inputs I could connect to.

The caution in disconnecting carriage speed from spindle speed would be if the spindle slowed or even stopped in a jam. The carriage would keep on moving.

Slowdowns are not as frequent an occurrence on an AC spindle motor, but mine is a variable speed DC motor which is more sensitive to load. I imagine the lathe in the photo has an AC motor and VFD drive. Still -- I might want hand on the half-nut lever during the cut on an unsynchronized carriage drive.

Lots to think about......
Steve

Offline vtsteam

  • Full Member
  • ****
  • Posts: 1252
Re: Revisiting a DIY Arduino/Forth Electronic Leadscrew Project
« Reply #23 on: March 01, 2026, 05:41:10 pm »
Over the last couple days I spent some time making a transparency, and then using dry PCB UV film on some brass sheet to make an etched threading table for my lathe's ELS switch settings. This took a lot of tries to get the film adhesion and the UV exposure right. And then finally getting a consistent etch. But I'm happy with the result. This is what it looked like right after the etching bath. Pencil for scale.

Steve

Offline crueby

  • Full Member
  • *****
  • Posts: 23219
  • Rochester NY
Re: Revisiting a DIY Arduino/Forth Electronic Leadscrew Project
« Reply #24 on: March 01, 2026, 06:34:51 pm »
That plate came out amazing!   :ThumbsUp:

Offline vtsteam

  • Full Member
  • ****
  • Posts: 1252
Re: Revisiting a DIY Arduino/Forth Electronic Leadscrew Project
« Reply #25 on: March 01, 2026, 06:45:51 pm »
Thanks Chris! :cheers: I just filled in with paint:

Steve

Offline vtsteam

  • Full Member
  • ****
  • Posts: 1252
Re: Revisiting a DIY Arduino/Forth Electronic Leadscrew Project
« Reply #26 on: March 04, 2026, 07:42:39 pm »
Simple slip roll machine (bending rolls): a cushion, a magazine, and a dowel. Roll 'til done.



Steve

Online Kim

  • Global Moderator
  • Full Member
  • *****
  • Posts: 9611
  • Portland, Oregon, USA
Re: Revisiting a DIY Arduino/Forth Electronic Leadscrew Project
« Reply #27 on: March 04, 2026, 11:11:52 pm »
Nicely done, Steve!  :Lol: :ThumbsUp: :popcorn:

Kim

Offline vtsteam

  • Full Member
  • ****
  • Posts: 1252
Re: Revisiting a DIY Arduino/Forth Electronic Leadscrew Project
« Reply #28 on: March 05, 2026, 02:20:40 am »
Thank you Kim! :cheers: I'm hopeful that I can get the ELS back together and finally mounted on the lathe tomorrow.
Steve

Offline JackPick

  • Full Member
  • ****
  • Posts: 19
Re: Revisiting a DIY Arduino/Forth Electronic Leadscrew Project
« Reply #29 on: March 05, 2026, 09:50:38 am »
There's some very clever stuff going on here! Thanks for showing us,  :ThumbsUp: :ThumbsUp:

 

SimplePortal 2.3.5 © 2008-2012, SimplePortal