State of the Workshop - July 2024
Added 2024-07-05 10:25:49 +0000 UTCComments
Ah yeah, floating point and computers are a pain to be sure, but yeah, just moving to dot point makes it easy again
Nicholas Burgin
2024-07-06 01:52:19 +0000 UTCGreat reading through this, as it's basically exactly how I've tackled it. The problem I was having was just figuring out the actual relationship between the spindle and the lead screw, in a mathematical sense, and how to check it without getting into floating point math. Finally cracked it this morning, and had the child-like realisation that I can just multiply the angle values by 100 before checking them to avoid any floats. Thanks for the excellent comment!
NotAnEngineer
2024-07-06 01:50:51 +0000 UTCSoftware Dev here: I haven't got a direct solution for you (though I could probably come up with one if I had some time to think about it a bit more). I'm not sure how much software experience you have or which language you are writing in, but I'll assume minimal experience and Arduino/C++, so apologies if this is aimed a bit low. The goal is to break down each aspect of the problem into small manageable bits, this could be done with proper C++ classes which are fully supported in Arduino, but for a fairly basic control system like this, that may be over the top. Just keep it in mind if your code starts getting a bit unwieldy. I'd start by setting up some basic data structures to model the different aspects of the machine: - One for the lead screw that has a constant set for the tread pitch (or maybe rotations per MM to make the caclations faster) and a variable for the current position of the tool post - One for the gearbox that has all the possible ratios configured, probably as a hard coded array from lowest combination to highest, you'd also have a variable that contains the currently selected ratio so you don't have to recalculate it all the time - One for the motor that has constants for steps per revolution and maximum reliable speed - One for the spindle has a constant for pulses per revolution and a variable for the current position You'd also have some general flags that you'd make use of: - One to track if the tool post is in sync with the spindle, this would be set to false when the tool post reaches your configured endstop, and set to true when the spindle reaches the required position (elaboration below) There'd be other stuff to keep track of as well, such as the soft endstop, desired feed rate or thread pitch and so on From there, create a bunch of functions that take care of a single calculation each. Obvious examples would be: - calculate lead screw revolutions to achieve a given change in position - calculate the lowest gear ratio required to achieve the required movement speed (this would make use of the lead screw calculation) - calculate the required spindle position to sync up with the current tool post position (this is the main one you were asking for in the video) In your control loop, you'd then have all the calculation you need to know how much you need to spin the stepper each time you receive a pulse from the spindle, this would take into account the sync flag, probably best explain with some pseudo code: ``` If sync == false If spindle.position != calc_spindle_sync_pos(tool_post.position) Return 0 Else Sync = true End if End if Return calc_required_steps(lead_screw, gearbox.current_ratio, calc_required_toolpost_distance_per_pulse) ``` Hope this is helpful or at least inspires some alternative approaches. Love your work, I have aspirations to build up a hobbyist machine shop with DIY machines one day.
Nicholas Burgin
2024-07-06 01:45:22 +0000 UTCI'm thinking of reconditioning my micro lathe into a cnc controlled one , great work on the lathe anyway its looking "engineer sexy"
Glib globler
2024-07-06 00:25:44 +0000 UTCEvery lathe needs one! 😁
NotAnEngineer
2024-07-06 00:16:15 +0000 UTCOh god… the nut button at the end is gold 🤪
Steven Bierlink
2024-07-05 14:41:53 +0000 UTC