Oh man this is a really BIG project. I'm looking forward to learning how you'll overcome the unforeseen. Like how to minimize glitches on your dev board? Motor noise, etc...
Hey, thanks for stopping by! Prior planning and good engineering practice go a long way toward reducing risk, but something always goes sideways. Always. When it does, you'll see it here, and then we'll learn and adapt.
True, you don't want to be dropping steps in a thread cutting operation, but this is a VERY cool project, and solves the problem of cheap shit mini lathes shipping with plastic gears problem ;-)
@@EdAgers110 And then remembering "O'Toole's Commentary on Murphy's Law : Murphy was an Optimist." This looks very interesting and something I can use also! And having written software on and off for 30 years...what can go wrong? Ok, then what? And then after that happens? . . .
I have watched this video several times since it was first posted. It taught me so much. I have to say it is my favourite of the whole project. Thankyou.
There are ways to do this kind of thing using only integer addition and subtraction, which should be comparable in speed to the floating point while giving results that don't drift at all. Check out the integer version of Bresenham's algorithm. It's usually presented as a way of drawing lines in computer graphics, but it's essentially the same problem.
Your explanation and demonstration of dimensional analysis was excellent! I have long appreciated the value of multiplying by one. Entire video was excellent in all respects. (And thanks VERY much for no "music" under your narration.)
How about this: Write your ratio in the form R = I + N/D , such that 0 0 { Output I + 1 steps E = E - D } else { Output I steps } E = E + N Next count } All integer arithmetic, with only addition and subtraction in the main loop. It’s a variation on Bresenham’s algorithm, which is well known in graphics.
Finally, someone who understands this problem, thanks!:) And remember the granularity of the encoder is 0.09 degrees, which is way over-designed! There is no floating point needed, because many MCUs have exactly for those pwm/dividing/motor control applications specialized hardware counters. Also, if you have expertise with such machines (... in REALITY) and the design of them you would've chosen an ANGLE ENCODER (that grants synchronicity, BY DESIGN which is a no-brainer for the PROBLEM we want to solve here: proportional synchronicity) which renders those botched mathematical pull-ups superfluous, anyways. Great project, but in hindsight? It hurts, its sad, because it was doomed (a botch) from the beginning.
@@dieSpinnt the advantage of my approach here is that it will be exact for any rational number to within one pulse. Threading, by its nature, uses integer ratios (even for metric/imperial conversions). With an ELS, you COULD, conceivably, cut a non rational thread pitch, that would be incompatible with anything cut using a lead screw and gears, but who would be mad enough to do that (other than This Old Tony)?
I know this is years old, but I was screaming this at the screen. I didn't get there from graphics, but from EE. James is building a phase-locked loop, and this is how you construct a phase locked loop that can generate a frequency that is locked to your reference signal times any arbitrary rational factor.
@@danmenes3143 you and me both. I’ve had this argument with any number of junior SW engineers who were wondering why their floating point implementation was drifting off the specified endpoint. Bresenham would certainly have known of analog PLLs in 1962, and may have found inspiration there.
This might be a great article to submit to Nuts & Volts and or Servo magazine, maybe both! This video did answer my questions regarding differences in lead screws and inch/metric translations. Thanks for the intensely interesting-informative content and detailed explanations.
A very surprising result regarding integer vs. floating point. I've thought about doing this for ages, but dreaded doing all the fiddly quadrature decoding in ardunio. I really didn't know that there were microcontrollers out there that did this......
Nice explanation. You identified the issue and built it up in a very logical way. I remember being taught this by a physics teacher, and it's helped me continuously since then. Particularly useful when you have more than a couple of unit conversions to do. FWIW, I tried to explain this to my kid in jr. high recently, and it's harder to teach than it is to do, once you 'get' it. So I appreciate the effort that it took to put this together.
the biggest roadblock i have seen( and experienced) is that most of the time it is taught using "simple" conversions. when you already know the conversion rate, DA is easy enough as Input # X or / by Conversion Rate = Answer with a calculator, making many young people(and me at one point) think this is a waste of time, pointless, and needlessly complex for something so simple. only when you do more complex conversions like this, that you don't know the conversion rate is this actually useful. I personally think that teachers shouldn't teach that DA is used for converting, but teach that DA is useful for FINDING conversion rates.
Fabulous walk-through and solid reasoning - this is real engineering in action. Integer divisions are definitely pretty slow on small microcontrollers, but floating point operations without a hardware floating-point unit are much worse! The fact that you have hardware floating point in that controller definitely tips the scales toward using floating-point numbers, but for anybody else looking to implement a similar solution in another microcontroller that lacks hardware floating-point operations, definitely check the docs for your specific chip (they usually document cycle counts for various operations) or run some simulations since the integer version will almost certainly be faster in that case.
In most microcontrollers every integer operation is faster than floating point operations even with FPU, but here is problem (if i remember correctly) microcontroller he picked do not have hardware integer division (or multiplication, common in 8 bit microcontrollers but most 32 bit microcontrollers have hardware implementated that instructions), and for most microcontrollers for simple calclations like this (where you have some oponents as integers) is faster doing float point calculations not using FPU (conversion from integer to float point take more time then it take to simulate float point on main cpu unit). In this case there is posibility that with diferent optimization levels he get totaly different results (if he tested speed in debug mode, he can get even 10 times slower results for compilers that have good optimization conmpairing to optimized code). ps: chacking documentaion for cycle count for operation is theoreticly good way but in case of some c/c++ compilers is useless (for example Microchip compiler for 8 bit PIC microcontrollsers in free mode which insert useless instruction to make code slower, so you need to buy it...)
This is absolutely one of the best examples of a real world, mixed-signal embedded application design I've seen. Thank you!!! I'm looking forward to more of your videos.
"mixed-signal" means processing of both analogue and digital electrical (input) signals ... which isn't the case here. That "application" is purely digital: discrete steps in -> discrete steps out. Don't confuse that something like a motor driver looks somehow analogue: the motor is also driven digitally. Or that computers and MCUs work with "analogue supply voltages". From that logic everything is analogue ... and digital at the same time. But that would render the technical term "mixed-signal"-something-something just useless, because that is not its meaning. Excuse my nitpicking and possibly have fun with a quick look at Wikipedia about the term?!:)
Thank you for being completely different to almost everybody posting"how to" videos when they show an accelerated video if them making something. Your explanations of the mathematics ( p.s. can someone please explain the singular MATH word?) was both educational and clear. Subscribed.
educating in the best tradition of true education. I had a large turret lathe from WW2, low hrs.,but no half nuts for threading,this would have solved that issue. The next step is a rotter table to cut splines and gears .thanks so much.
Hi James, a general comment if I may (! - I'm English, you see!). I've been dipping into your back catalog (catalogue!) and originally I felt things were moving on a bit too slow. But I've come to appreciate both the pacing and the carefully explained gentle presenational style and realised that it is what a newcomer like me really needs. So, Thank You! There's a very good chance that with your current project your channel will really take off. It most certainly deserves to, there's a lot of thought, care and expertise going into it. It's not enough to 'know' stuff for these shows, you have to be able to explain it, and you can and do. It is VERY much appreciated. BobUK.
New to your channel and have been binge watched the episodes starting with the lathe VFD through present. Now I have gone to the earlier ones for the tool post grinder. All I can say is you do an awesome job. I love how you share all the steps from concept in Fusion 360 through final operations and sometime including 3D printing, another passion of mine, when it make sense. Plenty of highlights and details without being overwhelming make this one of the more enjoyable channels to watch.
Excellent job at your math explanation. I think it all will work just fine with the floating point. Heck a worn lead screw will be off more than that. Great Project.
The dimensional analysis refresher was super useful, particularly showing each conversion fraction. It's been a while, so I had a lot of trouble trying to think of all of the steps to get from one end to the other. Thank you!
This is my new favorite youtube channel by far. You are an engineer's engineer. Every nuance I was struggling to find an answer for, you answered them.
As a programmer of industrial PLC's with specific reference to spinning things must admit this project has been my fave for a while of yours. No, You sat on Goldbolt for hours trying to wangle the instructions down when you found the github.. Hah. Anyway kudos. Ballsy.
With how you set things up, it's also possible to reduce your floating point error physically. You could also detect if for certain threads the thread ratio can be computed perfectly as a fixed point decimal (or even an integer), which would allow some clever math to vastly speed up the division. For example, if you were cutting a 12 TPI thread instead of a 13 TPI thread, you'd have an integer multiplier of 25 and then bit shift 6 (with bit shifting being able to be performed as a single processor instruction)
I watched this one three times as it was very fascinating to see your approach. I like it, and learned a lot from your explanation of how you approached your system's input-process-output algorithm. Thank you for sharing your thought processes in your projects.
For me the detail, delivery and structure made it easy to follow along. Thanks for taking your time to make and share your learnings. I have finaly been able get some clarity on fundamentals that are skipped over elsewhere. The awesomeness is that I can adapt into my projects and priorities. Much appreciated
I appreciate you sharing at this depth. Your strategy for avoiding propagation of the rounding error seems so obvious once you explained it! I had to replay the video a couple of times to get it. I explains why so much horsepower is needed in the processor. Please continue to drill down into the logic of your strategies.
Dimensional analysis is a very useful and powerfull technique. In my day way back when Pontious was still a pilot, this particular technique was called Unitary Brackets, the underlying principle being, as you noted, that you can multiply something by '1' as many times as you like without affecting it.
Thanks for keeping cost a factor.Too many projects on youtube are great but will never be in my SS budget. This one definitely is and I and my Harbor Freight 9x20 appreciate the effort.
most lead screws are 4 or 8 I have. 1" 4 trends to the 1" UNC course. most are acne thread's are 6,12, 4, or 8, that the normal lead screw Thread's for the 1" . led screw pitch. very interesting theatrical work , & I will buy one once you have sorted it out , use of the shelf produces too build the package , out the work & I can see it being an attentive system to the makers of the modern lath , small lath It certainly interesting for my lath witch is a Colchester master A hundred years old , with a half shaft .
Hi James, I've been thinking. I do, sometimes! There's a good argument that using change gears is essentially 'open loop'. There's so much power available that 'slip' simply cannot occur - the machine would have to shear a gear tooth. So, despite what I was saying earlier, an open loop stepper could be seen as replicating that change gear implementation. It just needs a powerful enough motor. BobUK.
I think I may have understood a bit less than half. That's a lot more than I understood before. A few more viewings and I might get there. I have a 1950's South Bend 9B. This would be fantastic for it. Thank you
You have built a phase-locked loop. There is no need to use either integer division OR floating point. You have a signed integer register that tracks your cumulative error. Every time you get a pulse from the spindle encoder, decrement the register by the denominator (or numerator--not sure which way your fraction is standing). As long as the register is negative, output pulses to your microstepper driver, adding the numerator (or denominator...) to the error value for each pulse. Nothing but integer add and subtract, no cumulative error, and your instantaneous error is always less than one pulse. And, if I am not mistaken, on many microcontrollers, part or all of this math can be done by hardware independent of the main CPU.
Subscribed to your channel just to hear you explain the design process, even though I am not a machinist and might never need an electronic lead screw. Coming from from electronics computer background, I am getting deja vu of sitting in my classes.. Thank you for the great video and wish you all the success with your project.
James - just wanted to express my thanks for your outstanding videos I have a special interest in this ELS project and you Fusion explanations and demonstrations. Pete
This was an incredibly complex problem, and explained very simply! You are one of those people I would put in the category of “GENIOUS”! I am super interested in watching this project to it’s completion! Well done!!
Very cool video. My suggestion is to add an index so the encoder count resets on every revolution. Hall-effect or optical. Prevents position error from accumulating over multiple revs.
I feel the same way. I was wondering if anybody noticed. Knowing the phase angle that the thread started is how to eliminate the accumulated error. So, the index will solve the accumulated error problem. This would allow the pgm to return to using integer arithmetic too.
*Subscribed* I *luuuv* this project. Learning much and refreshing skills dormant a long time - like programming. Also many thanks for referencing to decimal too. The code - I think - is unfortunately imperial only, so I have to adapt the code. Btw. cheers for offering the code! This is such a good project, I decided to build it as I got half ways through the first video. So I ordered a TI micro-controller without spending a second thought. As mentioned Arduino RasPi is easy to use and thanks to you I am diving into a new world :)
An extremely interesting video James although most of it was well above what little I thought I knew. But a calculated 1/10th error after 15 min. of continuous threading at 600 rpm is 100% meaningless. I can guarantee your leadscrew is off by multiple thous per foot and that also will change variably throughout it's length to different lead and lag pitch errors. Moore Tools tried everything they could think of to build perfect feed screws for there jig borers and grinders prior to the development of cnc and very likely threw a few million $$$$ at the effort. While they could measure the errors of only a few millionths in there precision ground and carefully lapped screws and nuts it's simply impossible to get perfection using the best state of the art equipment and a large bankroll. Even if it was the slightest wear would ruin the perfection as soon as you started using the machine. So you can bet on a more than surprising amount of pitch error in the average lathes leadscrew. In fact the lathes components will flex far more than that under even the fairly light cutting loads during single point threading.
This might be a place to reminisce my old HP-87. An amazing engineering tool. Not fast, but with its 8-bit registers chained to 64 bits wide and with BCD math you avoided the rounding errors within something like 10^-500 to 10^+500 numerical range. Well, I mentioned the speed. If I’m right, its clock frequency was 680 kHz (some people have stated 0.7 MHz). That was in the days when a Z80 chip ran at up to 4 MHz.
Amazing video! I love the detailed explanations of the math. I'll start ordering parts soon, and will definitely want a through-hole pcb. Thank you for sharing your wealth of knowledge!!
Try the floating point performance when *dividing* by the (precalculated) inverse of the ratio... Instead of multiplying by the ratio, i mean. I say that because i think the time diff is not due to float vs integer, but due to a single vs two operations And furthermore, with one division vs without division. Afaik, divisions are the less optimized operations. Great vid, awesome explainations
Like you, I expected a lot more error using floats. The results are really surprising! Well done sir!! I see few people don't quite grasp binary representation of numbers less than one. Perhaps a video showing decimal number system with positive and negative exponents of 10 multiplied by 0-9 and then the same thing with base 2 number system. I hope that makes sense lol. That's what made it click for me in college. After that, digital design class was a breeze. Great video!! On behalf of everyone here, thank you for all your work and sharing your knowledge!! Please keep it up :)
I'm looking at a freeze frame of your inch TPI table and would recommend a few more sizes like 26 TPI (3C collets) and 11 1/2 TPI (garden hose) if you have room. Cool project!
@@Clough42 Some others to consider perhaps: 19 for BSP (British Standard Pipe thread) 22 for 5/16 BSF 26 for Brass thread, CEI & 1/4 BSF 27 for GAS thread
Wonderfully lucid explanation -- I wish my instructors had been half as clear when I was doing my C.S. degree. Too bad binary coded decimal fell out of modern microprocessor instruction sets...
First: You presented an excellent explanation, very clear. Comment: Rather than compare the two methods on an RPM basis, consider a comparison of error per linear thread length. Error/time seems to me not the best metric. Comment: Again, I have not done the work so I may be missing something with raw intuition, but I 'suspect' that a purely integer method can work. I assert this is a problem for which all the calculation can be accomplished once without the need for floats on a per count basis. I mentioned the other day a count down register approach. The core of which is a pair of integers calculated once and used to approximate the ratio first over then under the exact. Implementing n/d = 1/a - 1/b. Think of a Taylor series. The actual code may require more than two fractions, (1/a, 1/b , 1/c,...), depending on the resulting error per length. The count values corresponding to each fraction are calculated once. Then the count down register is loaded sequentially with the values. Comment: I am sure my 'explanation' is not as clear as you have presented. The path you are following WILL WORK, I have no doubt. The only possibility is that 'maybe' a less capable uprocessor would be able to do the work. Second: I enjoy your presentation method, very organized, nice work. You have another subscriber.
5 лет назад+1
Still can't believe you only have 6.6K subs. Production quality is awesome. There's many 1M subs who don't even have such content. Keep up your good work. Really becoming of one my favorite channel ever.
I am in the fortunate position with my lathe its very easy to change the feed rate . But watched the whole video the explanation of the math was brilliant and always good to see how other tackle a coding problem. Need to do some test on floating point math for my projects (Subscriberd and thumbs up)
I totally agree. I don't assert that the way I'm doing it is the best way--just that it's the way I did it. I'm always fascinated to see how other people solve the same problem in different ways. Someone this morning mentioned Bresenham's line drawing algorithm. I'd never made that connection before.
@@Clough42 The internet has made electronics and programming much more accessible to everyone when I started programming over 20 years ago it was all done through books and courses. Now with creators like yourself and others you can just watch a video. Keep up the great content
Nice video. I must admit my initial thought was that the integer maths would be the way to go, but you explained the value of the floating point well. If you really needed the FP speed, but wanted to get rid of the error, I think you could run the loop in two parts. A slow loop that operates on the most significant bits of the encoder count done in integer maths, and a fast interrupt loop that applies only to the least significant number of bits, and adds to the number calculated by the slower loop. That way your floating point error can be made essentially as small as you like, based on that number of bits and how fast (frequently) you choose to run the integer loop.
Suggestion: Continuously output the position delta. Numeric display might be useless for this, maybe something like......if abs(delta) > 10 ; LED yellow, >100 LED red, else green ? The code is on github, so I'll give this a go anyway ........ TI dev kit is in the post ...... This is an excellent project, I wish you and the community much success.
Hi Clough42 , I have a 602 lathe and I'm looking forward to watching this project. Have you considered a look up table? Or multiple tables, one for each feed? You only need one table in memory at a time and 32 x 4096 is only 16K. You'd get the accuracy back. I'm also hoping you'll get a speed up as I'd like to try doing this with a teensy.
Been here, did this. Use a 32 bit microcontroller and go floating point. Teensy and a 2600 series Trinamic stepper driver, or there are steppers that have an encoder right inside the stepper housing that pulse more than 1 million times per revolution. (Micron level encoding) That stepper/encoder manufacturer makes a driver board for it that deals with missed steps automatically.
Oh man this is a really BIG project. I'm looking forward to learning how you'll overcome the unforeseen. Like how to minimize glitches on your dev board? Motor noise, etc...
Hey, thanks for stopping by! Prior planning and good engineering practice go a long way toward reducing risk, but something always goes sideways. Always. When it does, you'll see it here, and then we'll learn and adapt.
Clough42 Murphy’s Law: If anything can go wrong, it will go wrong! ;)
True, you don't want to be dropping steps in a thread cutting operation, but this is a VERY cool project, and solves the problem of cheap shit mini lathes shipping with plastic gears problem ;-)
@@EdAgers110 And then remembering "O'Toole's Commentary on Murphy's Law : Murphy was an Optimist."
This looks very interesting and something I can use also! And having written software on and off for 30 years...what can go wrong? Ok, then what? And then after that happens? . . .
Ya but don't you think this video needs more swearing?
It is still generating great interest 3 yrs later!!
Well done and thank you!
The depth of understanding the problem you are demonstrating is astonishing. Can't wait to see more
i think this blew a capacitor in my brain. great vid. super exciting.
I have watched this video several times since it was first posted. It taught me so much. I have to say it is my favourite of the whole project. Thankyou.
There are ways to do this kind of thing using only integer addition and subtraction, which should be comparable in speed to the floating point while giving results that don't drift at all. Check out the integer version of Bresenham's algorithm. It's usually presented as a way of drawing lines in computer graphics, but it's essentially the same problem.
Exactly what I thought! Having designed a plotter many years ago (Z80...) I discovered this algorithm. Widely use in CNC machines.
This project combines many of my favorite hobbies. Microcontrollers, steppers, encoders, machining and hopefully a little 3D printing.
Of course. How about a keypad with flexible 3D-printed buttons?
Your explanation and demonstration of dimensional analysis was excellent! I have long appreciated the value of multiplying by one. Entire video was excellent in all respects. (And thanks VERY much for no "music" under your narration.)
That was our first week of High School Physics! And significant digits also!
How about this:
Write your ratio in the form R = I + N/D , such that 0 0
{
Output I + 1 steps
E = E - D
}
else
{
Output I steps
}
E = E + N
Next count
}
All integer arithmetic, with only addition and subtraction in the main loop. It’s a variation on Bresenham’s algorithm, which is well known in graphics.
Finally, someone who understands this problem, thanks!:)
And remember the granularity of the encoder is 0.09 degrees, which is way over-designed! There is no floating point needed, because many MCUs have exactly for those pwm/dividing/motor control applications specialized hardware counters. Also, if you have expertise with such machines (... in REALITY) and the design of them you would've chosen an ANGLE ENCODER (that grants synchronicity, BY DESIGN which is a no-brainer for the PROBLEM we want to solve here: proportional synchronicity) which renders those botched mathematical pull-ups superfluous, anyways.
Great project, but in hindsight? It hurts, its sad, because it was doomed (a botch) from the beginning.
@@dieSpinnt the advantage of my approach here is that it will be exact for any rational number to within one pulse. Threading, by its nature, uses integer ratios (even for metric/imperial conversions).
With an ELS, you COULD, conceivably, cut a non rational thread pitch, that would be incompatible with anything cut using a lead screw and gears, but who would be mad enough to do that (other than This Old Tony)?
I know this is years old, but I was screaming this at the screen. I didn't get there from graphics, but from EE. James is building a phase-locked loop, and this is how you construct a phase locked loop that can generate a frequency that is locked to your reference signal times any arbitrary rational factor.
@@danmenes3143 you and me both. I’ve had this argument with any number of junior SW engineers who were wondering why their floating point implementation was drifting off the specified endpoint.
Bresenham would certainly have known of analog PLLs in 1962, and may have found inspiration there.
This might be a great article to submit to Nuts & Volts and or Servo magazine, maybe both! This video did answer my questions regarding differences in lead screws and inch/metric translations. Thanks for the intensely interesting-informative content and detailed explanations.
A very surprising result regarding integer vs. floating point. I've thought about doing this for ages, but dreaded doing all the fiddly quadrature decoding in ardunio. I really didn't know that there were microcontrollers out there that did this......
Nice explanation. You identified the issue and built it up in a very logical way. I remember being taught this by a physics teacher, and it's helped me continuously since then. Particularly useful when you have more than a couple of unit conversions to do.
FWIW, I tried to explain this to my kid in jr. high recently, and it's harder to teach than it is to do, once you 'get' it. So I appreciate the effort that it took to put this together.
the biggest roadblock i have seen( and experienced) is that most of the time it is taught using "simple" conversions. when you already know the conversion rate, DA is easy enough as Input # X or / by Conversion Rate = Answer with a calculator, making many young people(and me at one point) think this is a waste of time, pointless, and needlessly complex for something so simple. only when you do more complex conversions like this, that you don't know the conversion rate is this actually useful. I personally think that teachers shouldn't teach that DA is used for converting, but teach that DA is useful for FINDING conversion rates.
@Mr T One metre = 3 feet 3 and 3/8 inches less 5 thou.
Fabulous walk-through and solid reasoning - this is real engineering in action. Integer divisions are definitely pretty slow on small microcontrollers, but floating point operations without a hardware floating-point unit are much worse! The fact that you have hardware floating point in that controller definitely tips the scales toward using floating-point numbers, but for anybody else looking to implement a similar solution in another microcontroller that lacks hardware floating-point operations, definitely check the docs for your specific chip (they usually document cycle counts for various operations) or run some simulations since the integer version will almost certainly be faster in that case.
In most microcontrollers every integer operation is faster than floating point operations even with FPU, but here is problem (if i remember correctly) microcontroller he picked do not have hardware integer division (or multiplication, common in 8 bit microcontrollers but most 32 bit microcontrollers have hardware implementated that instructions), and for most microcontrollers for simple calclations like this (where you have some oponents as integers) is faster doing float point calculations not using FPU (conversion from integer to float point take more time then it take to simulate float point on main cpu unit).
In this case there is posibility that with diferent optimization levels he get totaly different results (if he tested speed in debug mode, he can get even 10 times slower results for compilers that have good optimization conmpairing to optimized code).
ps: chacking documentaion for cycle count for operation is theoreticly good way but in case of some c/c++ compilers is useless (for example Microchip compiler for 8 bit PIC microcontrollsers in free mode which insert useless instruction to make code slower, so you need to buy it...)
It is an interesting application. Can't wait to see the finished product.
Absolutely amazing stuff, love the indepth look of the math. Can't wait for part 3.
This is absolutely one of the best examples of a real world, mixed-signal embedded application design I've seen. Thank you!!! I'm looking forward to more of your videos.
"mixed-signal" means processing of both analogue and digital electrical (input) signals ... which isn't the case here. That "application" is purely digital: discrete steps in -> discrete steps out. Don't confuse that something like a motor driver looks somehow analogue: the motor is also driven digitally. Or that computers and MCUs work with "analogue supply voltages". From that logic everything is analogue ... and digital at the same time. But that would render the technical term "mixed-signal"-something-something just useless, because that is not its meaning. Excuse my nitpicking and possibly have fun with a quick look at Wikipedia about the term?!:)
Thank you for being completely different to almost everybody posting"how to" videos when they show an accelerated video if them making something.
Your explanations of the mathematics ( p.s. can someone please explain the singular MATH word?) was both educational and clear.
Subscribed.
Thanks! I'm glad you're enjoying them.
That was a surprising amount of AWESOME! I learned a lot more than expected from this video!
Thank you!
educating in the best tradition of true education.
I had a large turret lathe from WW2, low hrs.,but no half nuts for threading,this would have solved that issue. The next step is a rotter table to cut splines and gears .thanks so much.
He speaks with the clarity of full understanding
Hi James, a general comment if I may (! - I'm English, you see!). I've been dipping into your back catalog (catalogue!) and originally I felt things were moving on a bit too slow. But I've come to appreciate both the pacing and the carefully explained gentle presenational style and realised that it is what a newcomer like me really needs. So, Thank You! There's a very good chance that with your current project your channel will really take off. It most certainly deserves to, there's a lot of thought, care and expertise going into it. It's not enough to 'know' stuff for these shows, you have to be able to explain it, and you can and do. It is VERY much appreciated. BobUK.
New to your channel and have been binge watched the episodes starting with the lathe VFD through present. Now I have gone to the earlier ones for the tool post grinder. All I can say is you do an awesome job. I love how you share all the steps from concept in Fusion 360 through final operations and sometime including 3D printing, another passion of mine, when it make sense. Plenty of highlights and details without being overwhelming make this one of the more enjoyable channels to watch.
Excellent job at your math explanation. I think it all will work just fine with the floating point. Heck a worn lead screw will be off more than that. Great Project.
The dimensional analysis refresher was super useful, particularly showing each conversion fraction. It's been a while, so I had a lot of trouble trying to think of all of the steps to get from one end to the other. Thank you!
Great video James, I am so on board with this. I am ready to start buying components. My 1945 South bend lathe will never be the same!
This is my new favorite youtube channel by far. You are an engineer's engineer. Every nuance I was struggling to find an answer for, you answered them.
As a programmer of industrial PLC's with specific reference to spinning things must admit this project has been my fave for a while of yours. No, You sat on Goldbolt for hours trying to wangle the instructions down when you found the github.. Hah.
Anyway kudos. Ballsy.
Such a high quality content, on such an interesting project with such a generous effort on depicting a fantastic engineers mindset. Thank you!
wow - that was a total nerdgasm!!! loved every minute from thought process to calculation to measurements. Can't wait for the next one.
With how you set things up, it's also possible to reduce your floating point error physically. You could also detect if for certain threads the thread ratio can be computed perfectly as a fixed point decimal (or even an integer), which would allow some clever math to vastly speed up the division. For example, if you were cutting a 12 TPI thread instead of a 13 TPI thread, you'd have an integer multiplier of 25 and then bit shift 6 (with bit shifting being able to be performed as a single processor instruction)
I watched this one three times as it was very fascinating to see your approach. I like it, and learned a lot from your explanation of how you approached your system's input-process-output algorithm. Thank you for sharing your thought processes in your projects.
WOW! Excellent description of how the program works and why you chose to do what you did. Thank you for the detail! 👍
There's an old adage : those who can, do. Those who can't, teach. It's refreshing to see you can do, and teach. Thanks.
For me the detail, delivery and structure made it easy to follow along. Thanks for taking your time to make and share your learnings. I have finaly been able get some clarity on fundamentals that are skipped over elsewhere. The awesomeness is that I can adapt into my projects and priorities. Much appreciated
Excellent job in explaining the background details. I’m hooked!
Looking forward to buying the kit. I hope you'll make it easy to adapt to a metric feedscrew - 4mm pitch in my case.
Enter 0.15748" pitch
Nice Brian you answer to a my doubt
Fantastic video!!! Now I plan on adding one to my old Clausing lathe, instead of trying to source 50+ year old metric gear sets!
eager to purchase your "kit" and adapt my 12" Clausing that has had its threader removed. this is a genius adaptation. thankyou!
Make that 2x.
@@toeknitter Add another!
Amazing display of talent and knowledge. Thanks.
I appreciate you sharing at this depth. Your strategy for avoiding propagation of the rounding error seems so obvious once you explained it! I had to replay the video a couple of times to get it. I explains why so much horsepower is needed in the processor. Please continue to drill down into the logic of your strategies.
My old Myford Super 7 is dancing around the shop in anticipation.
"count " me in, thru hole board for me. Great video, thanks
Dimensional analysis is a very useful and powerfull technique. In my day way back when Pontious was still a pilot, this particular technique was called Unitary Brackets, the underlying principle being, as you noted, that you can multiply something by '1' as many times as you like without affecting it.
Thanks for keeping cost a factor.Too many projects on youtube are great but will never be in my SS budget. This one definitely is and I and my Harbor Freight 9x20 appreciate the effort.
Thanks for going into the pros / cons of floating point! Awesome video!
most lead screws are 4 or 8 I have. 1" 4 trends to the 1" UNC course. most are acne thread's are 6,12, 4, or 8, that the normal lead screw Thread's for the 1" . led screw pitch. very interesting theatrical work , & I will buy one once you have sorted it out , use of the shelf produces too build the package , out the work & I can see it being an attentive system to the makers of the modern lath , small lath It certainly interesting for my lath witch is a Colchester master A hundred years old , with a half shaft .
this means a lot for home built lathes.
I've taught computer science, and you did a beautiful job explaining this, well done.
Hi James, I've been thinking. I do, sometimes! There's a good argument that using change gears is essentially 'open loop'. There's so much power available that 'slip' simply cannot occur - the machine would have to shear a gear tooth. So, despite what I was saying earlier, an open loop stepper could be seen as replicating that change gear implementation. It just needs a powerful enough motor. BobUK.
Great math explanation and demonstration. Keep the info coming. Looking forward to more of your videos. Thanks.
I think I may have understood a bit less than half. That's a lot more than I understood before. A few more viewings and I might get there. I have a 1950's South Bend 9B. This would be fantastic for it.
Thank you
You have built a phase-locked loop. There is no need to use either integer division OR floating point. You have a signed integer register that tracks your cumulative error. Every time you get a pulse from the spindle encoder, decrement the register by the denominator (or numerator--not sure which way your fraction is standing). As long as the register is negative, output pulses to your microstepper driver, adding the numerator (or denominator...) to the error value for each pulse.
Nothing but integer add and subtract, no cumulative error, and your instantaneous error is always less than one pulse. And, if I am not mistaken, on many microcontrollers, part or all of this math can be done by hardware independent of the main CPU.
A great thanks for the fine project and we can learn so much from you.
Very well done. Great analysis and pretty damn good code. (Coming from a retired systems analyst / programmer.)
Great combination of theory and practice. I very much like the discussion on rounding error and to what degree it plays a role ... or not :)
Incredibly well explained a complex subject. Thank you.
It would be fun to see a 14+ hour threading cycles That first week scratch pass...
I really wish you were my high school chemistry teacher :) The way you explained the complex conversions was great
Subscribed to your channel just to hear you explain the design process, even though I am not a machinist and might never need an electronic lead screw. Coming from from electronics computer background, I am getting deja vu of sitting in my classes.. Thank you for the great video and wish you all the success with your project.
Excellent Presentation. Thanks for Sharing. ❤
James - just wanted to express my thanks for your outstanding videos I have a special interest in this ELS project and you Fusion explanations and demonstrations.
Pete
Nice.. it’s nice to see The math behind binary.
Well the math is over my head. I do understand what your doing and wow very well thought out. Loved both videos. Looking forward to the next one.
This was an incredibly complex problem, and explained very simply! You are one of those people I would put in the category of “GENIOUS”! I am super interested in watching this project to it’s completion! Well done!!
The problem isn't incredibly complex. It's digital logic 101. He did however explain it nicely.
Omar Ham Perhaps you are a GENIOUS as well! Please provide the links to YOUR videos showing YOUR solutions to this problem.
Very cool video. My suggestion is to add an index so the encoder count resets on every revolution. Hall-effect or optical. Prevents position error from accumulating over multiple revs.
I feel the same way. I was wondering if anybody noticed. Knowing the phase angle that the thread started is how to eliminate the accumulated error. So, the index will solve the accumulated error problem. This would allow the pgm to return to using integer arithmetic too.
Most excellent. I have no clue what you were taking about, (I despise math) but your presentation is excellent! Can’t wait to see this in action.
*Subscribed*
I *luuuv* this project.
Learning much and refreshing skills dormant a long time - like programming.
Also many thanks for referencing to decimal too.
The code - I think - is unfortunately imperial only, so I have to adapt the code. Btw. cheers for offering the code!
This is such a good project, I decided to build it as I got half ways through the first video.
So I ordered a TI micro-controller without spending a second thought.
As mentioned Arduino RasPi is easy to use and thanks to you I am diving into a new world :)
An extremely interesting video James although most of it was well above what little I thought I knew.
But a calculated 1/10th error after 15 min. of continuous threading at 600 rpm is 100% meaningless. I can guarantee your leadscrew is off by multiple thous per foot and that also will change variably throughout it's length to different lead and lag pitch errors. Moore Tools tried everything they could think of to build perfect feed screws for there jig borers and grinders prior to the development of cnc and very likely threw a few million $$$$ at the effort. While they could measure the errors of only a few millionths in there precision ground and carefully lapped screws and nuts it's simply impossible to get perfection using the best state of the art equipment and a large bankroll. Even if it was the slightest wear would ruin the perfection as soon as you started using the machine. So you can bet on a more than surprising amount of pitch error in the average lathes leadscrew. In fact the lathes components will flex far more than that under even the fairly light cutting loads during single point threading.
I like it I will look into doing it as well. For now I need to get my shop done first.
Great explanation for what can be a confusing problem.
This might be a place to reminisce my old HP-87. An amazing engineering tool. Not fast, but with its 8-bit registers chained to 64 bits wide and with BCD math you avoided the rounding errors within something like 10^-500 to 10^+500 numerical range. Well, I mentioned the speed. If I’m right, its clock frequency was 680 kHz (some people have stated 0.7 MHz). That was in the days when a Z80 chip ran at up to 4 MHz.
Amazing video! I love the detailed explanations of the math. I'll start ordering parts soon, and will definitely want a through-hole pcb. Thank you for sharing your wealth of knowledge!!
Try the floating point performance when *dividing* by the (precalculated) inverse of the ratio...
Instead of multiplying by the ratio, i mean.
I say that because i think the time diff is not due to float vs integer, but due to a single vs two operations
And furthermore, with one division vs without division.
Afaik, divisions are the less optimized operations.
Great vid, awesome explainations
Like you, I expected a lot more error using floats. The results are really surprising! Well done sir!! I see few people don't quite grasp binary representation of numbers less than one. Perhaps a video showing decimal number system with positive and negative exponents of 10 multiplied by 0-9 and then the same thing with base 2 number system. I hope that makes sense lol. That's what made it click for me in college. After that, digital design class was a breeze. Great video!! On behalf of everyone here, thank you for all your work and sharing your knowledge!! Please keep it up :)
Very good. Insightful problem solving and excellent communication skills. I will definitely track the developments. Congratulations.
I'm looking at a freeze frame of your inch TPI table and would recommend a few more sizes like 26 TPI (3C collets) and 11 1/2 TPI (garden hose) if you have room. Cool project!
Great suggestion. Done. I have seen 11 1/2 TPI on lathes before but never knew what it was for.
@@Clough42 Some others to consider perhaps:
19 for BSP (British Standard Pipe thread)
22 for 5/16 BSF
26 for Brass thread, CEI & 1/4 BSF
27 for GAS thread
Wonderfully lucid explanation -- I wish my instructors had been half as clear when I was doing my C.S. degree. Too bad binary coded decimal fell out of modern microprocessor instruction sets...
Excellent video.University standart teaching.Lets see the comercial aspect of this.Thank you very much.
First: You presented an excellent explanation, very clear.
Comment: Rather than compare the two methods on an RPM basis, consider a comparison
of error per linear thread length. Error/time seems to me not the best metric.
Comment: Again, I have not done the work so I may be missing something with raw intuition, but I 'suspect' that a purely integer method can work. I assert this is a problem for which all the calculation can be accomplished once without the need for floats on a per count basis. I mentioned the other day a count down register approach. The core of which is a pair of integers calculated once and used to approximate the ratio first over then under the exact.
Implementing n/d = 1/a - 1/b. Think of a Taylor series. The actual code may require more than two fractions, (1/a, 1/b , 1/c,...), depending on the resulting error per length. The count values corresponding to each fraction are calculated once. Then the count down register is loaded sequentially with the values.
Comment: I am sure my 'explanation' is not as clear as you have presented. The path you are following WILL WORK, I have no doubt. The only possibility is that 'maybe' a less capable uprocessor would be able to do the work.
Second: I enjoy your presentation method, very organized, nice work. You have another subscriber.
Still can't believe you only have 6.6K subs. Production quality is awesome. There's many 1M subs who don't even have such content. Keep up your good work. Really becoming of one my favorite channel ever.
im a first time viewer and just learned so much... Thank you! and please keep making this kind of content. I
I am in the fortunate position with my lathe its very easy to change the feed rate . But watched the whole video the explanation of the math was brilliant and always good to see how other tackle a coding problem. Need to do some test on floating point math for my projects (Subscriberd and thumbs up)
I totally agree. I don't assert that the way I'm doing it is the best way--just that it's the way I did it. I'm always fascinated to see how other people solve the same problem in different ways. Someone this morning mentioned Bresenham's line drawing algorithm. I'd never made that connection before.
@@Clough42 The internet has made electronics and programming much more accessible to everyone when I started programming over 20 years ago it was all done through books and courses. Now with creators like yourself and others you can just watch a video. Keep up the great content
Nice video. I must admit my initial thought was that the integer maths would be the way to go, but you explained the value of the floating point well. If you really needed the FP speed, but wanted to get rid of the error, I think you could run the loop in two parts. A slow loop that operates on the most significant bits of the encoder count done in integer maths, and a fast interrupt loop that applies only to the least significant number of bits, and adds to the number calculated by the slower loop. That way your floating point error can be made essentially as small as you like, based on that number of bits and how fast (frequently) you choose to run the integer loop.
Awesome project. I really enjoyed the math. I will be following with interest to see how it all comes together.
Suggestion: Continuously output the position delta. Numeric display might be useless for this, maybe something like......if abs(delta) > 10 ; LED yellow, >100 LED red, else green ? The code is on github, so I'll give this a go anyway ........ TI dev kit is in the post ...... This is an excellent project, I wish you and the community much success.
excellent, can't wait to see ALL in real action, THANKS!
Man this is an epic project!! Can't wait for the rest of the series!
I am following you thank you for instruction something I want to adopt, old head but will get there.
Your talking hands rival those of This Old Tony! Awesome video! Thanks!
(hehe) Thanks!
Great MATH Refresher!
Hi Clough42 , I have a 602 lathe and I'm looking forward to watching this project. Have you considered a look up table? Or multiple tables, one for each feed? You only need one table in memory at a time and 32 x 4096 is only 16K. You'd get the accuracy back. I'm also hoping you'll get a speed up as I'd like to try doing this with a teensy.
Been here, did this. Use a 32 bit microcontroller and go floating point. Teensy and a 2600 series Trinamic stepper driver, or there are steppers that have an encoder right inside the stepper housing that pulse more than 1 million times per revolution. (Micron level encoding) That stepper/encoder manufacturer makes a driver board for it that deals with missed steps automatically.
Good video, I think I'll need to watch it a few more times before I get it straight in my head though I wish I had more Software experience.
Thanks for going through the math, great explanation.
Good job on the video, definitely worth watching. Looking forward to the next one. Bill
great explination , thank you
oooh man, very cool project. I am looking forward to another progress !
Fastest 30 minutes this week. =)
Thank you.
Well done James complicated subject but understandable
If you put a piece of red packing tape over those led displays it makes them much easier to see and film.
Outstanding! !