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

Offline RussellT

  • Hero Member
  • *****
  • Posts: 520
  • Country: gb
Re: Electronic Leadscrew?
« Reply #100 on: April 01, 2015, 04:57:49 PM »
For Integer inch pitch threads, there is no error in the ability to send steps on time in relation to the spindle position. which is what counts as far as the thread is concerned. There is no periodic error in those threads.

Yes - I wasn't clear but I'd also looked at other threads.

Russell
Common sense is unfortunately not as common as its name suggests.

Offline DMIOM

  • Hero Member
  • *****
  • Posts: 676
  • Country: gb
  • Isle of Man
Re: Electronic Leadscrew?
« Reply #101 on: April 04, 2015, 08:15:31 AM »
I like the direction you are heading. Keep it clean and simple.

Very long time ago I used EPROM as a look uptable - without using a uP. Really simple. Incremental encoder to address lines (all extras pulled), data lines were output. Eprom was mostly wasted but small partion of was this lookup table. You need reset and clock, but they could be generated from index and quadrature count pulses?
.........

OT(ish):

This reminded me of a project where I did something similar, only using volatile storage instead of EPROM.

Many years ago, I was involved in designing what was thought to be the first =digital= scanning electron microscope (SEM) in Britain, if not in Europe.

I was asked if I could use any digital techniques to improve the control and discrimination of the display; as previously the totally analog display channel typically only had the possibility of adjusting the gain and upper/lower thresholds (albeit often with multi-turn pots).

Computers at that time were far far too slow to process the image on-the-fly, so what I came up with was a hardware solution where each scan spot, instead of going through analog shaping, was digitised, modified and then converted back to analog for display. The essential central converter was a "register file" (what we would now recognise as a small block of memory) with 256 locations and stacked to 8 bits deep. The values from the ADC (Analog to Digital Converter) were used as the addresses into the register file, and the contents of that location were used to drive the DAC (Digital to Analog Converter) thence to the display. The register file was dual-ported, so you could load any pattern into the file - initially from thumbwheels and an 8048 micro, then later from a Commodore PET. Preparation of what we called "the profile", which is now more widely described as a lookup table (LUT) on the PET meant that you could add as as many knees, stretches etc. as you wanted; and the profiles could be stored and shared - between runs, between researchers and even between sites.

Although the input from the SEM was monochrome, by fanning-out from the DAC to a stack of three register files, we added false-colour ability; modification of the colour lookup tables on the PET allowed various features to be highlighted, and we added a facility similar to the zebra-stripes in professional video camera viewfinders that if the video settings meant that detail was being lost at either end, we would highlight that area on-screen - at the bottom, crushed blacks would be highlighted in blue and over-exposed/burnt-out areas would be highlighted in red.

Dave

Offline PekkaNF

  • Hero Member
  • *****
  • Posts: 2523
  • Country: fi
Re: Electronic Leadscrew?
« Reply #102 on: April 06, 2015, 04:46:06 AM »
I hope that VT will post here something, othervise we are running amok with OT :D

I remember using hardware FIFO and LIFO registers with hardware multiplier or something. The best thing with these assyncrous lookuptables and regfisters was that you could syncronize them with the "process". Eliminitating a whole lot of quanisizing error and timing problems. You could actually have PLL to lock the "clock" and inhibit "data" when the loop was not locked, that saved whole lot of housekeepping if you were logging data. Now I'm probably good just for blowing up electrolytes.

Pekka


Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew?
« Reply #103 on: April 06, 2015, 10:43:15 AM »
Pekka, thanks! I'm working on this in the evenings but not ready to write anything here yet because I have several options I want to explore, and I am waiting for parts I ordered to arrive by mail so I can build and test.  I should have everything here within the week.  :beer:
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline PekkaNF

  • Hero Member
  • *****
  • Posts: 2523
  • Country: fi
Re: Electronic Leadscrew?
« Reply #104 on: April 06, 2015, 02:13:12 PM »
I love OT almost as much as pictures!

Two of my friends are working on one polar cordinate measurement system. They need several thousand pulpes per revolution and they choose to use quadrature pulse sensor on X4 mode. They found one chip that is normaly sold in 1000s, but ebay rescues. There is a Eage file, they are going to test it, probably even next week. They are pretty confident that they are going to all that 4x and +/- 1 non accumulating pulse error.

Pekka

Offline PekkaNF

  • Hero Member
  • *****
  • Posts: 2523
  • Country: fi
Re: Electronic Leadscrew?
« Reply #105 on: April 09, 2015, 06:15:18 AM »
I asked my friends about the quadrature encoder chips and they are using this one:
http://www.lsicsi.com/pdfs/Data_Sheets/LS7183_LS7184.pdf

There is one that is a bit more involved, but it looks like it could offload some processor load (maybe...some pros have pretty nifty counters today.
http://www.lsicsi.com/pdfs/Data_Sheets/LS7166.pdf

There are quite a few different versions:
http://www.lsicsi.com/encoders.htm

At glance max. freg. was not clear, but I think most of them are good for 1Mhz least. Also it was hard to determine how much error they generate at most infavorable case.

I started thinking.... Maybe this error is not that bad here...because you can use index-pulse to reset/initialize the situation AFTER you have both axes rotating but prior engaging the feed. Therefore spurious pulses on start/stationary/stop modes does not matter.

LS7184 has Clk-output and when spindle is at steady speed and "feed" is inching you know the direction.

Bigger issue I see on stepper drive, under load at very slow speed they are close to nominal step error and that is at their best. Microsteping gives smoothness, but does not give that much linear resolution.

I'm pretty confident that VT will pull this off. He has plenty of experience.

I have plenty of experience over/under dimensioning and hit the goldilocks zone after many iterations.  :lol: No matter how hard I calculate and plan at first!

Pekka

Offline spuddevans

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1618
  • Country: 00
  • Portadown, Northern Ireland
    • My Photo website
Re: Electronic Leadscrew?
« Reply #106 on: April 09, 2015, 12:07:56 PM »
The PIC 18F2331 (or 4331) has a Quadrature Encoder peripheral module built in. http://ww1.microchip.com/downloads/en/devicedoc/39616b.pdf

There are also a number of more powerful PIC microcontrollers that have the Q.E. modules built in, some have 2 of them. But for me the one linked above is sufficient.

I have ordered a couple of those pic's and also a Quad encoder off ebay, and a few other bits and bobs as well. This thread has sparked off a little  :proj:  :D


I plan on using 3 BCD thumbwheel switches as both the means of setting the required Pitch/TPI, and the means of displaying the set Pitch/TPI.

I have a PIC development board I bought ages ago, so I will prototype on that, I've already cobbled together a program, just waiting for the hardware to arrive in order to test it out.

I reckon the total cost should be £30-40 max, especially as I plan on using the 4th axis stepper driver of my CNC mill along with the stepper motor on my RoTab (perhaps with a little modding, without even removing it from the RoTab!!)

Should be fun

Tim
Measure with a micrometer, mark with chalk, cut with an axe  -  MI0TME

Offline spuddevans

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1618
  • Country: 00
  • Portadown, Northern Ireland
    • My Photo website
Re: Electronic Leadscrew?
« Reply #107 on: April 09, 2015, 12:25:14 PM »
Bigger issue I see on stepper drive, under load at very slow speed they are close to nominal step error and that is at their best. Microsteping gives smoothness, but does not give that much linear resolution.

I was worried about this too, and perhaps with a non-leadscrew equiped lathe it would be an issue, but if the lathe has a leadscrew already, it will also have an arrangement of gearing attached to the leadscrew. You could use a geared reduction from the stepper to the leadscrew. In the case of my mini lathe with a metric leadscrew of 1.5mm pitch and a 2:1 geared reduction, that would result in a resolution of 0.00375mm.

Tim
Measure with a micrometer, mark with chalk, cut with an axe  -  MI0TME

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8967
  • Country: gb
  • East Sussex, UK
Re: Electronic Leadscrew?
« Reply #108 on: April 09, 2015, 12:41:59 PM »
I'd be tempted to replace the gear train with tensioned toothed belts and toothed pulleys to minimise backlash.
Andrew Mawson
East Sussex

Offline John Stevenson

  • In Memoriam
  • Hero Member
  • *****
  • Posts: 1643
  • Nottingham, England.
Re: Electronic Leadscrew?
« Reply #109 on: April 09, 2015, 01:41:13 PM »
I'd be tempted to replace the gear train with tensioned toothed belts and toothed pulleys to minimise backlash.

Yup, gears are so yesterday.

I have replaced the 'standard' ratio on all my lathes with a toothed belt drive to the gearbox.



The gears stacked on the holders are just for specials that are out of reach of the normal ratio's in the gearbox. Means I can run at higher speeds with less noise.
John Stevenson

Offline spuddevans

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1618
  • Country: 00
  • Portadown, Northern Ireland
    • My Photo website
Re: Electronic Leadscrew?
« Reply #110 on: April 09, 2015, 06:03:34 PM »
I'd be tempted to replace the gear train with tensioned toothed belts and toothed pulleys to minimise backlash.

Yup, gears are so yesterday.

I have replaced the 'standard' ratio on all my lathes with a toothed belt drive to the gearbox.


Sounds good, do you think that would fit on my lathe (Seig C2)  :scratch:

Tim
Measure with a micrometer, mark with chalk, cut with an axe  -  MI0TME

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8967
  • Country: gb
  • East Sussex, UK
Re: Electronic Leadscrew?
« Reply #111 on: April 10, 2015, 02:57:19 AM »
Toothed belts are available in an amazing array of pitches and sizes:


http://www.hpcgears.com/n/products/1.pulleys_belts/pulleys_belts.php
Andrew Mawson
East Sussex

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew?
« Reply #112 on: April 10, 2015, 08:23:18 AM »
Taken me two days but I've finally got FORTH assembled and burned onto an Arduino. Guess it's not an Arduino anymore since the bootloader and everything else is changed in flash. It now has a real OS and language onboard. It is its own computer. And a cool retro one at that. I'm back in the early 80's with it and enjoying it!
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: 8967
  • Country: gb
  • East Sussex, UK
Re: Electronic Leadscrew?
« Reply #113 on: April 10, 2015, 08:41:47 AM »
Now Steve my first male menopausal event was celebrated re-building a motor cycle from my youth, and my second was to buy an Austin Healey 3000 ....

.... but you, oh no, it has to be a retro computer  :lol:
Andrew Mawson
East Sussex

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew?
« Reply #114 on: April 10, 2015, 11:15:05 AM »
From what you say about the Healy costs these days, that's out for me. I'd prefer a Morgan +4 with a TR3 engine, anyway. Any availble in my price range of say $50 over there?

Guess I'll have to settle for a $10 Arduino, then.  :lol:
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?
« Reply #115 on: April 12, 2015, 09:09:02 PM »
I've got a running experimental system with a toy encoder/gearhead motor w/IR detector combo feeding an Arduino, doing the dividing function, with step and direction output to a stepper drver and a stepper motor running at the divided rate.  :ddb:

It all works at the relatively low data rate that the toy encoder is putting out. The real encoder hasn't arrived yet, but it's really great to see it all running together as imagined now!

I used Arduino's Wiring language just to work out the connections and timing,  but I'm in the process of writing FORTH code for it, which will make future extensibility easier -- at least for me.
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline spuddevans

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1618
  • Country: 00
  • Portadown, Northern Ireland
    • My Photo website
Re: Electronic Leadscrew?
« Reply #116 on: April 13, 2015, 08:49:02 AM »
I've got a running experimental system with a toy encoder/gearhead motor w/IR detector combo feeding an Arduino, doing the dividing function, with step and direction output to a stepper drver and a stepper motor running at the divided rate.  :ddb:

It's always a good feeling to get a test system up and going, well done  :clap: :clap:

Are you going to have a LCD readout of the pitch/TPI?

I was wanting to have one on mine, but then realised the PIC that I've ordered haven't enough ROM (or I haven't pruned my code down enough) for the menu structure that I was thinking of, hence I changed plan to use BCD thumbwheels as setting/display means.

Tim
Measure with a micrometer, mark with chalk, cut with an axe  -  MI0TME

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew?
« Reply #117 on: April 13, 2015, 10:21:18 AM »
Tim, I don't know yet. It makes sense to do that, but the retro part of me wants to have a knob selector or lever selector and no display, or a hidden set of switches or something on the new lathe. Just an aesthetics thing. I'd like it to look like a manual lathe -- and function like one, actually.

On the other hand a display would allow me to do lots more in the future re. expansion of capabilities without adding too many knobs and levers! I keep thinking of writing my own simple CNC manual control stuff for a lathe instead of using the heavy CNC hitters and mega computing setups. After saying I just wanted to replace change gears, it gets tempting to go further.  :palm: But I noticed I've stopped building my lathe, and that's no good. I think I'll put off getting too ambitious electronically at this stage, get the electronic change gears working, and finish the lathe. I can always come back to the fancier programming stuff after.

I might play with a display, maybe just to learn how it works. But I don't know if updating a display will hurt the gear routine throughput -- another consideration. I'm not using interrupts yet, just a simple input polling loop -- I'll have to see what is needed for speed when the "real" encoder gets here.

I'll have a very short video of the toy encoder setup shortly -- as soon as Vimeo gets done re-encoding it.
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?
« Reply #118 on: April 13, 2015, 10:36:57 AM »
Just a quick test.

First button runs the DC toy motor turning the encoder. The arduino translates that to step pulses at any preset ratio and sends to the stepper controller.

Second button reverses the stepper (leadscrew) direction.

Third button is an emergency stop/limit switch input.


« Last Edit: December 03, 2020, 10:48:00 PM by vtsteam »
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline spuddevans

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1618
  • Country: 00
  • Portadown, Northern Ireland
    • My Photo website
Re: Electronic Leadscrew?
« Reply #119 on: April 13, 2015, 11:01:59 AM »
I'm impressed with the video, that looks a good rate of RPM on the encoder.


But I don't know if updating a display will hurt the gear routine throughput -- another consideration.

When I was looking at having a LCD for mine I was worried about that too, so I came up with the thought of using a toggle switch for "Set" or "Run". then the program would regularly poll the switch and only update the display or change parameters when set to "Set".

Another thought was to use the Quad Encoder instead of buttons to change parameters (obviously without the lathe running!!) saves having a plethora of buttons, just one "Set"/"Run" switch and the display.


Tim
Measure with a micrometer, mark with chalk, cut with an axe  -  MI0TME

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew?
« Reply #120 on: April 13, 2015, 11:25:08 AM »
Along with your approach, Tim, there should be a "leadscrew" switch, anyway, so setting a thread pitch could occur before running the LS, and lock the display and pitch while running the leadscrew in threading mode.

I imagine autofeed ought to be variable with a pot, though, but that's easy enough to swtch into a separate non-encoder simple variable timing routine. Then display refresh timing isn't a problem.

There's a million ways to skin this cat for UI, and that will all end up to personal taste.  :beer:
I love it when a Plan B comes together!
Steve
https://www.youtube.com/watch?v=4sDubB0-REg

Offline sparky961

  • Hero Member
  • *****
  • Posts: 844
  • Country: ca
Re: Electronic Leadscrew?
« Reply #121 on: April 13, 2015, 04:40:28 PM »
Some thoughts regarding display update and general latency when switching tasks... just off the top of my head, and just in the door from work.... so maybe not well thought out.

Maybe you already know this, but you're better off updating the display and such in the main loop.  You're not going to care if there's a few millisecond delay where it's unresponsive, if that.  Miss an encoder pulse though and it might mean a scrapped part or worse.

Run the encoder off interrupts (as I think you're planning eventually) and then it will always have priority.  Don't disable interrupts once you're in the main loop.  Keep your interrupt(s) as simple as humanly possible.  That said, I've been surprised how quickly my state machine code runs and counts correctly.  If its been a while since you've played with uC's, you will be pleasantly surprised at how far they've come.  I've been away from the mainstream for a while, and I sure am.

I'd be happy to send you a copy of my encoder state machine interrupt handler function... in C - the only FORTH I know is "May the FORTH be with you" ;)

Now stop (lead) screwing around and get the rest of that lathe built!

RobWilson

  • Guest
Re: Electronic Leadscrew?
« Reply #122 on: April 13, 2015, 05:29:27 PM »
 :clap: :clap: :clap: Looking very canny there  Steve  :thumbup:



Were did you purchase  the smaller circuit board  ?   the opto thing



Rob

Offline vtsteam

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6466
  • Country: us
  • Republic of Vermont
Re: Electronic Leadscrew?
« Reply #123 on: April 13, 2015, 09:45:57 PM »
Sparky, thanks for replying.  :beer: We'll work out the timing to whatever is needed. FORTH is pretty fast on old and limited procs with tiny memory and also has a built in assembler if we really need to get down and dirty for something. And there are two interrupt input pins on the board, etc.

Like I said a display isn't top priority for me -- a rotary switch and knob can select pitches very conveniently, a dip switch also, though less conveniently. I even have a plan B.

I don't know C so it wouldn't help any to see your code. I do thank you, though!

Nobody uses FORTH these days. Or even knows what it is. Just guys from the early eighties era of computing. And even then, not many.

FORTH is a language that you write your own language in. It suits the way I think. I never felt anything else fit as well. People make a big deal nowadays over various unusual characteristics like the reverse polish notation for math, the use of the stack and untyped variables, 1024 byte blocks for storage, etc. But they never seem to make much mention of the fact that it is a language designed to create your own language in. That's the critical point of interest to me!

A FORTH program works by defining words in your own invented program language at a low level, and combining those into definitions for higher level words until you get to the top of what you want to do -- the last word in your dictionary that does it all.

Utter that word and boom your program runs. I think that's cool! Just a quirk of mine. The rest of the stuff is just mechanical details. I learned them a long time ago, and don't even think about them. But it's easier for people to talk about and give little demos online of using the stack and RP notation. So you don't see much about why you'd ever want to learn a language that requires that.

FORTH isn't useful because of unusual arithmetic operations -- they're a pain in the neck for most experienced programmers. It's the way you create a program that's wonderful, to me. And how compact and fast it is. And that's possible because of the stack and RPN -- they're the primitive base words and functions very close to how the proc works and sees things.

Your program builds up from this low level of words to a level so high, one word does it all. Everything you want, in a single command. That's the highest level of the language. There aren't subroutines and calls. rather every FORTH word is a subroutine, and there is no distinction between the words you define and the base words that come with the system. They are all part of the grand dictionary, and can be used to make up new words.

Okay apologies for going on and on about this. Using FORTH again brings back the interest and excitement I had when I first started using computers, so I start chattering!

Yes, back to building the lathe as soon as the shop dries out. 1/4" of water on the floor because of ice out here. Early crocuses just beginning to show. Daffs not up yet. Still some white stuff out there in patches and the streams are roaring....
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?
« Reply #124 on: April 13, 2015, 09:58:19 PM »
Rob, I found this little gem on ebay and grabbed the whole kit and kaboodle:

http://www.ebay.com/itm/321719649728?

Price is ridiculously low. The Arduino Uno clone isn't the best quality PC board work, but it runs fine so far.

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