DIY Mill Turn Center

Show off your latest creations, whether 3D printed or not
User avatar
Generic Default
Printmaster!
Posts: 558
Joined: Mon Jun 03, 2013 6:56 pm
Contact:

Re: DIY Mill Turn Center

Post by Generic Default »

Yeah a couple of months ago when I started this it was more of a concept, something that I thought would be cool to do. In the last few weeks I've made some big design changes which I haven't shown here yet, but I know for certain that even meeting minimal goals will still be worth it. I knew from the beginning that this machine will never be as fast, powerful, rigid, or precise as full sized industrial turning centers. I'm just trying to get something that makes useable parts cheaply. I hope to learn along the way, and maybe even develop some new simple methods of doing things that actually work, like the printed leadscrew nut or the simple ball bearing limit switch. What gave me hope for this project is that my Sherline lathe can turn parts out of metal, and that machine has just about everything wrong with it from a mechanical and electrical design perspective. It won't take much to surpass it!

From what I've seen on the internet, the vast majority of DIY cnc machine builds are hobbyist routers and engravers, small machines that end up cutting wood, plastic, and maybe a bit of aluminum. People stick to tried and true methods (i.e ballscrews and linear ways) or try to go cheap with metal nuts on cheap threaded rods. For the electronics, they typically use Mach3 and steppers motors. Some go for servo motors.

I've always thought lathes are cooler than routers, and since our 3d printers are pretty good at making flat, simple, 3 axis router/mill type parts, I wanted to make something a little bit different. 3d printers simply cannot make precise round parts, and even the best metal sintering machines still leave rough surfaces. So I'm trying to introduce CNC lathes to the open source scene.


Onto the build....

I got an ER-40 collet nut from Amazon. Now I can accurately model it and test fits. Surprisingly, it threaded on to my spindle adapter the first time smoothly with no problems!
This is what the collet nut looks like from the backside, notice the precision ground taper that contacts the collet. Also notice the eccentric groove to pull it out.
IMG_1529.JPG
IMG_1530.JPG
Since I'm making this machine primarily from aluminum extrusions that I machine flat with a mini CNC mill, I'm going to have to rely on standard industry tooling to get precision. Everything can be adjusted by sliding it on a flat surface and bolting it down when it's in the right place. The collet adapter will work this way, it's the only way I can think of to get runout to a few ten thousandths without having access to a cylindrical grinder.
Check out the Tri hotend!
User avatar
Generic Default
Printmaster!
Posts: 558
Joined: Mon Jun 03, 2013 6:56 pm
Contact:

Re: DIY Mill Turn Center

Post by Generic Default »

Double posting to get more pictures in.


This is my design for the linear ways. The machine will have 5 linear axes in the end, only two of those are needed for basic turning operations. The other 3 add capabilities and automation. You can still do a lot with only 2.
It's a 1x3x12 flat bar of 6061 aluminum with 60 degree dovetails machined on the sides. All mating surfaces are milled flat to close tolerances.

The linear carriage that rides on it is 0.75x4x6 inches, also 6061 aluminum. Still milled flat on all mating surfaces. The two blocks of aluminum never contact each other, the carriage will ride on wear gibs. For now my wear gibs are plastic; I prototyped them with PLA but soon I'll machine them from solid acetal square bar. I'll also make some out of green Nyloil, an oil filled cast nylon 6/6 that supposedly has extremely low stick-slip and great wear resistance.
IMG_1531.JPG
IMG_1532.JPG
IMG_1534.JPG
In comparison to the sherline lathe. My rail is huge and has a lot more area!
IMG_1535.JPG


The reason for using polymer is to eliminate abrasion and wear between the sliding surfaces. It was pointed out in a previous post that aluminum is far too soft for a linear rail, which is true for metal-on-metal contact. But acetal or nylon on aluminum works fine! My main concern with using plastic is the lack of stiffness compared to metal; acetal wear plates/gibs have a modulus of about 3 GPa, whereas aluminum is 70, brass is 120, and steel is 200. So I had to keep my wear plate/gib design stiff with lots of metal reinforcement where possible. So long as the plastic stays in compression, stiffness should be fine. It's flexing that is unacceptable in machine design, not compression.

Ideally all of the sliding linear stuff would be make out of hard steel, or hard anodized aluminum, plated with boron-nickel and impinged with tungsten disulfide. An anodized aluminum surface is around 70 on the rockwell C scale, so it lasts pretty much forever if you keep out abrasive particles and keep the friction low. If I go to a metal/ceramet design in the future, the part geometry will stay the same and all of the differences will be in the surface materials/anodizing/plating/PVD coating. I'm just using plastic for now as a test, to see what I can get away with! I half expect it will fail and I'll probably end up using the metal stuff in the end unless this works exceptionally well.



So far it seems promising, it is much stiffer than I expected using only 2 bolts on each gib instead of 4 and 5 screws on the bottom like I designed. I'll make the acetal parts today and fit them on with all of the fasteners. Both of the gibs are adjustable in the yaw axis of the headstock. The rest of the headstock has mating surfaces that will align one or both parallel with the linear doverail. The reference gib will be aligned then locked in place by tightening the nuts; the floating gib will be pressed against the opposing doverail with set screws, then locked in place as well. If it works out the way I expect, preload will be adjustable and the rails should will be extremely easy to adjust. We'll see how it goes!

Any questions/concerns about it? I fully understand that is method is pretty much unheard of in CNC machines. If it fails I'll go back to the norm of steel rails and ways with oil lubrication and a predictable service life.
Check out the Tri hotend!
User avatar
626Pilot
ULTIMATE 3D JEDI
Posts: 1720
Joined: Tue May 14, 2013 12:52 pm

Re: DIY Mill Turn Center

Post by 626Pilot »

Do you have a rough idea of what the BOM will be for this ($$$), and do you have some ideas of specific things you'll create with it?
User avatar
Generic Default
Printmaster!
Posts: 558
Joined: Mon Jun 03, 2013 6:56 pm
Contact:

Re: DIY Mill Turn Center

Post by Generic Default »

I haven't made a BOM yet but I'll do it now with the things I can think of off the top of my head;

3x3x0.125 3ft Aluminum square tube (machine base)-------> $30
1x3x 2ft Aluminum flat bar (2 linear doverails)--------------> $40
0.75x4 1ft Aluminum flat bar (2 linear slides)---------------> $20
0.5x4 1ft Aluminum flat bar (headstock vertical faces)------> $12
0.25x4 1ft Aluminum flat bar (headstock side faces)--------> $7
0.75x4 1ft Aluminum flat bar (turret blocks and turret plate)-> $20
3.5x0.375 x2 Aluminum tube (bearing journals)-------------> $14

4130 1.625x0.25 (spindle tube)----------------------------> $30
Misc metal -----------------------------------------------> $30
1x0.75 2 ft Acetal square bar(wear gibs)-------------------> $11

Fasteners------------------------------------------------> ~$20
2 Tapered roller bearings (for turret)----------------------->~$20
2 ABEC-3 62008RS Spindle Bearings------------------------> $90
1 0.375 1/6 inch acme screw -----------------------------> $10
Various Shaft Collars -------------------------------------> $40
123 Block Set --------------------------------------------> $15
ER Collet and Nut -----------------------------------------> $40


5 NEMA23 Steppers --------------------------------------> $100
5 Axis Smoothieboard ------------------------------------> $175
24V PSU ------------------------------------------------> $25

Spindle Motor electrical ----------------------------------> $200
Drills, inserts, misc tooling -------------------------------> $50

Sub Total -----------------------------------------------> $1,000

That's just for 2 linear axes, the main headstock spindle and the X tool turret. I know it's more than what most hobbyists would be willing to put down, especially since it takes time to build and there is no guarantee to get a working machine in the end! However, if done correctly, this basic 2 axis machine with the turret and indexable headstock would be capable of turning short production runs of parts from 1.125 bar stock. With threading capability, which is very important for lots of parts. The main motor is a 3 horsepower BLDC, with a clutched stepper for indexing and threading. I'll get into the details of that in future posts.*


And I plan on having a 5 (non-redundant) axis machine in the end! Not cheap, I know, but each axis gets cheaper to add since the electronics are mostly in place and the machine frame is too.
I'm expecting the cost of the full 11 axis automated machine to be a bit over $2,000 just to build, with the majority of that being electronics, bearings, and material.


Notice how none of this includes machining costs. Machining costs would easily double the price of the build if you were do have a shop do it. If I make a full 11 axis machine, it would be capable of producing the majority of it's own parts, especially the turned and turn-milled parts, which will be the most expensive. So the first machine costs the most to make...
Check out the Tri hotend!
User avatar
626Pilot
ULTIMATE 3D JEDI
Posts: 1720
Joined: Tue May 14, 2013 12:52 pm

Re: DIY Mill Turn Center

Post by 626Pilot »

I'm thinking about doing a daisy-chainable shift register-based stepper expansion module for Smoothie (or any controller somebody wants to code for) that you can use to drive as many extra axes as you like. I think someone else is working on something similar, but I don't think he's using shift registers. This would be something a person could put together on perfboard in an afternoon, and it would plug into a few pins on the Smoothieboard (+12V, +5V & ground directly from the PSU, and data & latch from the Smoothieboard). If you want to use Smoothie to drive this machine, you might get some use out of that. Shift registers update on the order of nanoseconds and we only need around millisecond-accurate timing, so it should work fine even with a bunch of them put together. Ideally there would be digipots for current control, but I don't know yet.
User avatar
Generic Default
Printmaster!
Posts: 558
Joined: Mon Jun 03, 2013 6:56 pm
Contact:

Re: DIY Mill Turn Center

Post by Generic Default »

I'm not sure how many steppers smoothie can support with extra pinouts. Each extra stepper needs a STEP and a DIR pin from the board to the driver; this machine would probably be using external drivers for the rotational axes. So if the regular smoothie supports 5 by itself, that's enough for all 5 linear axes (Headstock1,Headstock1,TurretX,MillX,MillY). Four more for both headstocks, the B axis, and the milling indexer motor.


Of course, the stepper outputs can also run on PWM outputs that would normally be used for heated beds and hotends, but I'd prefer to save those for other things like solenoids and stuff. Hopefully the smoothie V2 will allow more steppers than I need for this machine because this machine needs a TON!
Check out the Tri hotend!
User avatar
626Pilot
ULTIMATE 3D JEDI
Posts: 1720
Joined: Tue May 14, 2013 12:52 pm

Re: DIY Mill Turn Center

Post by 626Pilot »

Smoothie can support lots of steppers using this method, bound only by RAM necessary to keep track of each one, and CPU speed for generating pulses. The boards sadly lack a true expansion header, so you only get a few pins. I was wrong before when I said only data and latch were needed. A third pin is needed for the clock signal to tell the shift registers when to expect a bit to be set. Three pins should be doable. It would probably not require PWM pins. The routine would look like this:

Code: Select all

For each stepper {
     Set bits in command byte (dir, step, en, whatever else)
     For each bit in command byte {
          Set data pin to bit at position X
          Set clock line high
          (wait however many nanoseconds are required for the shift register to process the bit)
          Set clock line low
          (wait however many nanoseconds are required for the shift register to process end of clock cycle)
     }
}
It would also be possible to create two waveforms, one for the data and another with matching clock signals, and send them over PWM to the data and clock pins. However, they would have to be synchronized perfectly, possibly using two DMA controllers. They couldn't be off by much. This seems more complex than would be worth the effort. I spent a month in 2014 doing that exact kind of work to drive NeoPixels from a Raspberry Pi. It's pretty complex, requires an oscilloscope, and I don't know whether this particular CPU supports synchronized DMA transfers. We will not consume that many instructions generating and sending the data "manually" (with the CPU instead of DMA controllers). It's just incrementing, bit-shifting, writing to I/O memory, and some conditional jumps.

Shift registers tend to come with an output pin, so as soon as the register is full, it will keep sending data on down the line to the next register in the series. This makes it very easy to daisy-chain them. Three pins are really all you would need for another five steppers, or whatever you want.
User avatar
Generic Default
Printmaster!
Posts: 558
Joined: Mon Jun 03, 2013 6:56 pm
Contact:

Re: DIY Mill Turn Center

Post by Generic Default »

So the main board would more or less be communicating with a second board, where the main board uses 2 or 3 wires to send data to the secondary board and the secondary board branches signals out to extra stepper drivers?

There are two communications protocols that would work best for this, one is I2C and the other is SPI. Both should have good enough data rates to set a bunch of highs and lows for the stepper pins.


At 16x microstepping, 200 steps/rev, and a leadscrew with 1/6 inch travel per revolution, it would take 19,200 pulses to move at a rate of 1 inch per second. Per motor, minimum.
Check out the Tri hotend!
User avatar
626Pilot
ULTIMATE 3D JEDI
Posts: 1720
Joined: Tue May 14, 2013 12:52 pm

Re: DIY Mill Turn Center

Post by 626Pilot »

Shift registers are available that talk over I2C and SPI, but they cost more and I don't need those protocols. All I need to do is set a couple of pins high and low to send the stepper control bytes out over the wire, and then raise the third pin to tell the shift registers to dump their contents to their output pins. It would actually be more work, both for me and the CPU, to use I2C or SPI.

Smoothie's step ticker appears to run at 100KHz. I would amend that code to clock out the steps to all of the auxiliary steppers. It shouldn't be much more computationally intensive than talking to a stepper driver in the usual way (over its own dedicated pins). We aren't doing square roots or anything.

I just remembered, TWO other people have also posted on these forums about doing this. One wanted to use some serial pins to drive one or two motors, and another wanted to use a shift register with transistors rather than a stepper driver. I don't remember who they were, or what the threads were called. I would just use a stepper driver rather than messing with transistors.
User avatar
Windshadow
Printmaster!
Posts: 526
Joined: Mon Nov 30, 2015 6:35 pm
Location: Mid Coast Maine

Re: DIY Mill Turn Center

Post by Windshadow »

Consider using this for your contact gibs and anywhere that wear of the soft AL might become a concern I helped a friend rebuild a Monarch 10EE toolroom lathe back in the late 90s and it is still working like new it is even easier to hold work to a ten thousandth on it than on a new Hardinge tool room lathe he also had
http://www.moglice.com/articles/replica ... ebook.html" onclick="window.open(this.href);return false;
User avatar
Captain Starfish
Printmaster!
Posts: 962
Joined: Tue Dec 10, 2013 5:24 am

Re: DIY Mill Turn Center

Post by Captain Starfish »

Bit bashing a shift register is all well and good. It's cheap, it seems simple and it works well until it doesn't. One glitched clock pulse and suddenly you wreck EVERYTHING.

At least with I2C and SPI, the protocol headers ensure that at worst only the single packet on the single channel gets affected, rather than everything from then on until the next reboot. Usually the target device just rejects the packet and you can retry, never seeing the error get out.

Better yet, with I2C you get addressing which means clock and data (only two pins, or three if you want to play it safe and add a reset line) and I'm pretty sure there are complete driver modules out there which will hook up to I2C. So with the two/three I2C pins you can daisy chain as many stepper drivers as you like and suddenly you have control over the current supplied etc.
User avatar
Generic Default
Printmaster!
Posts: 558
Joined: Mon Jun 03, 2013 6:56 pm
Contact:

Re: DIY Mill Turn Center

Post by Generic Default »

I've been thinking about the stepper expansion stuff for a long time, 3d printers need 3 steppers for the motion, then one for each cold end extruder after that. Which is why so few 3d printer control boards have more than 4 or 5 steppers. That Azteeg one can do 5 built in and 3 external drivers for 8 total. If smoothie V2 isn't out by the time I have most of this machine done, I'll be using the Azteeg.

However the I2C/SPI expansion stuff we're talking about here is good also. The main problem is that it needs another microcontroller board, and the main controller would have to communicate with it. I2C and SPI are standard protocols and all ARM/CORTEX boards have dedicated hardware inside the chips that allow these communications protocols, I was configuring registers just a month ago to do this kind of stuff.


None of this is trivial or easy to do, but I know it can be done.



Back to the more intuitive hardware stuff....

Thanks for the suggestion Windshadow! I never knew that Moglice stuff existed, and the examples on their page are very convincing to me. A resin like that is exactly what I need for some of the parts of this machine!
It's a resin, so it's much stiffer than most thermoplastics. I could make a few master molds out of aluminum and pins, then mold the wear gibs and drive nuts. It would eliminate machining and printing, plus it would be fast and easy to do. They say the parts don't warp or distort, which is necessary for precision linear motion.

I'll try resin casting some parts in the future and I'll let you know how it goes.




On a separate note, I messed up big time on my precision machining. There were two things I did wrong that have caused inaccuracy in my bigger linear motion parts.

1) I didn't pound the aluminum flat bars down against the parallels in my vises when machining

2) I didn't account for thermal expansion of the spindle when machining my mill vises in situ.


The first problem was a result of the second one. When I machined my mill vises, I started the spindle then immediately began face milling the vises flat. The idea was that by machining both vises in their final positions on the mill bed, all of the alignment problems could be avoided....and they were, in the X/Y plane. However the thermal expansion of the spindle during machining caused the surfaces that were machined last to be a few thousandths of an inch LOWER on the mill bed than the surfaces that were machined first. My raster type facing program made a zig-zagging staircase surface on the vises, so the vises were low on the Y- side of the machine, thus causing non-flat surfaces on all subsequent parts. Which is why they didn't sit flat on the parallels and I needed to pound them down.


So my new procedure for ultra flat surfaces will involve running the spindle for ~10 minutes before facing big flat bars of aluminum so that the spindle reaches equilibrium temperature before the program starts, rather than thermally expanding while the surface is being cut.

I re-faced my vises last night after running the spindle for a while, then I checked with a digital indicator to make sure they were flat. Good to within 0.0005" across the mill table now, which is the limit of my indicator.
I guess I had to learn this metrology lesson the hard way. I'll have to re-face both the linear doveway and the carriage plate to fix what I did wrong the first time.

First pass of re-surfacing. Notice how the shinier surface is on the Y+ side of the vise, the cutoff is the change in Z from thermal expansion.
IMG_1538.JPG
After re-surfacing for flatness.
IMG_1539.JPG
Close up of the finished vise surface. The tool marks are in the micron range I believe, you can see rainbows of light wavelength up close (naked eye).
IMG_1540.JPG
Check out the Tri hotend!
User avatar
Jrjones
Printmaster!
Posts: 106
Joined: Mon Nov 24, 2014 6:09 pm

Re: DIY Mill Turn Center

Post by Jrjones »

For your limit switches, similar to what you have come up with but using PCB test pins: https://youtu.be/Z5Hd30bSlBU" onclick="window.open(this.href);return false;
May be easier than fabricating your own ball retention with a spring?
User avatar
Captain Starfish
Printmaster!
Posts: 962
Joined: Tue Dec 10, 2013 5:24 am

Re: DIY Mill Turn Center

Post by Captain Starfish »

It goes without saying, but don't just free-wheel your spindle for the warmup - it'll need a similar load to what the job will require. Perhaps do some surfacing cuts on scrap or something.

You /don't/ need another microcontroller for I2C or SPI. Many, many peripheral chips are available which will run straight off those busses. There's also a tonne of stepper driver boards (and a few stepper motors with built in drivers) that will plug straight into an I2C or SPI bus too. I prefer I2C because the addressing is built into the data stream, as opposed to SPI which wants independent chip select lines for each peripheral. So two wires and maybe reset for as many devices as you want, whereas SPI needs an additional line per peripheral which can stack up fast.
User avatar
626Pilot
ULTIMATE 3D JEDI
Posts: 1720
Joined: Tue May 14, 2013 12:52 pm

Re: DIY Mill Turn Center

Post by 626Pilot »

Captain Starfish wrote:Bit bashing a shift register is all well and good. It's cheap, it seems simple and it works well until it doesn't. One glitched clock pulse and suddenly you wreck EVERYTHING.

At least with I2C and SPI, the protocol headers ensure that at worst only the single packet on the single channel gets affected, rather than everything from then on until the next reboot. Usually the target device just rejects the packet and you can retry, never seeing the error get out.

Better yet, with I2C you get addressing which means clock and data (only two pins, or three if you want to play it safe and add a reset line) and I'm pretty sure there are complete driver modules out there which will hook up to I2C. So with the two/three I2C pins you can daisy chain as many stepper drivers as you like and suddenly you have control over the current supplied etc.
I read some of the documentation.

The main thing to keep in mind is that with the chip running at 120MHz, and step generation running at 100MHz, each step generation interrupt has only 1,200 clock cycles. It doesn't get all of those to run its code either, as the CPU has to push and pop registers to/from the stack, switch context, etc. both before and after interrupt execution. There are other interrupts running, as well as the main thread, so available clock cycles are further reduced. Suppose that leaves us with 800 clocks per interrupt. The instruction timing for a Cortex M3 processor is also a consideration. The "cheap" bit-flipping and (register) math operations take only one clock cycle, but a lot of other operations (particularly memory access) take two or more. We could wind up with only 300-600 opcodes of headroom, some of which is already taken up by the existing code. Therefore, we have to think carefully about what we can do in the time allowed.

I2C on this chip runs far too slow (1 megabit/sec) to do anything. There would be enough time to send an address byte, and no data. SPI runs much faster (12.5MBit/sec), but it requires a dedicated pin per stepper for the slave select lines. Smoothieboards have only a few pins broken out, so we'd run out of lines pretty fast. Additionally, SPI has no error correction, so it doesn't help vs. bit-banging.

We can bit-bang some pins directly, write whole bytes to a UART, or use a DMA controller to send PWM (which some pins can do, and others can't). Whichever way we go, we'd be setting up an array of bytes, and then flipping on individual bits (EN, DIR, STEP) before sending them over the wire. If we bit-bang or use a UART, we have to spend clock cycles writing to I/O memory. If we use DMA, we have to spend clock cycles writing to RAM, and then some more writing to a DMA control structure. That triggers the DMA controller to handle the transfer without consuming any CPU resources. However, as we're only transferring one byte per stepper (or half a byte, if we use 4-bit shift registers), the difference may not be enough to justify the added complexity.

With this solution, we have three lines to the PSU (+5V, +12V, GND) and three lines to the Smoothieboard (DATA, CLK, LATCH). Each stepper board - I think I'll call them StepShifters - would have six pin connectors on the left for accepting power and data, and another six on the right for passing power/data on to the next board in the chain. They could also have dedicated power pins elsewhere on the board, so for example you could connect +5V/+12V/GND to every third board in order to keep the power distribution clean.

The boards would either have their own stepper drivers, or pin headers for a standard StepStick. If we use 4-bit shift registers, there would be one free pin each, which could be used for a status LED.

If we use StepSticks, current control is not an issue. If we get more advanced and want to use digipots, we could hook up to the I2C pins and do that, although the digipots would need to be capable of having their bus addresses changed. Another possibility might be to drive a digipot from the shift register. It would require that the digipot could take parallel data for the current value.

Once I'm done with my magnetic arm drivetrain project, I'll start work on this for real. I believe it can be done in tandem with the new PanelDue code. I think there are enough pins to connect both a PanelDue and a chain of StepShifters.
Last edited by 626Pilot on Sat Jan 09, 2016 2:12 am, edited 1 time in total.
User avatar
Generic Default
Printmaster!
Posts: 558
Joined: Mon Jun 03, 2013 6:56 pm
Contact:

Re: DIY Mill Turn Center

Post by Generic Default »

On the Taig mill, the motor turns the spindle with a belt. Most of the spindle heat is generated by preload friction instead of load friction so the temperature doesn't increase much more with larger loads than it does just from spinning unloaded. Of course my facing programs only skim the surface, I never flatten a bar with more than a few thousandths of cut depth and if I do, I do another finishing pass.


I2C has a lower maximum data rate than SPI, but with the stepper speeds and update rates we're talking about, I don't think it would matter much. So I2C it is!



Also, I finally finished making my acetal wear gibs for the first rail. It will be the first headstock rail. It is by far the most smooth linear motion I've ever felt, and I've worked with quite a few types. There is no grainyness or vibration or noise whatsoever. There is no stick slip either, and I noticed that even after I cleaned and degreased the surfaces, the sliding carriage has a velocity dependent friction force to it. So pushing very lightly will slide it at an incredibly slow rate, but pushing proportionally harder does not make the rail move proportionally faster. It's like a greased slide in that sense, and this is with significant preload. No wiggling or clicking at all, the whole assembly feels like a solid piece of steel as far as rigidity goes.


To check friction, I adjusted the preload until the gibs were in contact with the rail along their full lengths and checked to make sure no forces or torques caused wiggling. I tilted the rail at an angle until the carriage started to slide on it. It was an 8 degree angle, which corresponds to a coefficient of friction of around 0.14. When a force is pushing down on the carriage, the doveway top face takes the force at a 90 degree angle. When something pushes up on the carriage, the 60 degree dovetail angles take the force, which effectively doubles the friction force. So once the carriage has a spindle on it and a workpiece is being cut, it's better to cut down than up. I may change the design to boxways to get around this, although it probably won't be a problem in practice.

IMG_1543.JPG
IMG_1544.JPG
IMG_1545.JPG
Yes, I used 123 blocks as an integral part of the machine headstock. I figured it's the only way I'll be able to align the spindle bearings coplanar to the tolerances I need. Plus they're rigid and stuff.

EDIT;
Just saw you posted a few minutes before I did when I was writing this. Are you certain that I2C is too slow? And I thought we were sending all of the stepper pulse data to a single chip that then sends out pulses to the stepper drivers?
Check out the Tri hotend!
User avatar
626Pilot
ULTIMATE 3D JEDI
Posts: 1720
Joined: Tue May 14, 2013 12:52 pm

Re: DIY Mill Turn Center

Post by 626Pilot »

Generic Default wrote:I2C has a lower maximum data rate than SPI, but with the stepper speeds and update rates we're talking about, I don't think it would matter much. So I2C it is!
The step generation interrupt would finish executing before you could get a single command out. Reducing step gen frequency might be OK for a mill, but if I spend time and money developing this, it has to work for everyone, and it has to not involve asking the Smoothie devs to run step generation slower (which I don't think they would ever do).

If the interrupt is firing 100,000 times a second, you have 1,200 clock cycles to do everything you need to do, minus overhead. I2C running at one megabit would only have enough time to send an address byte, and then the step generation interrupt would already be over before you could send any data.

I2C is cool and all, but it's not the holy grail. I've been using a Raspberry Pi to drive a NeoPixel ring using a self-clocking signal (one wire) since May 2014 and it has been running flawlessly, continuously, ever since.
User avatar
Captain Starfish
Printmaster!
Posts: 962
Joined: Tue Dec 10, 2013 5:24 am

Re: DIY Mill Turn Center

Post by Captain Starfish »

Hearing you 626Pilot, I didn't realise the step update ran that fast.

FWIW - I'm just finishing up a project for work, a broadcast camera remote control system which includes a control panel that lets operators do a bunch of stuff with the cameras. There are a bunch of RGB backlit buttons on there which need colour changes depending on state. It's quite pretty. To the point: I ended up needing about 70 PWM channels to cover all the LEDs. Ain't no way that was happening off a micro, so I ended up getting some 24 channel PWM LED driver chips which are controlled via, you guessed it, I2C.

Well, not quite I2C, but some high speed flavour of it that Phillips use which clocks at something like 4MHz and is write (master->slave) only. Which means i couldn't use the onboard TWI modules which expects an ACK from the slave and locks up when it doesn't get it, back to bit bashing again. So there's more code than I'd like but it isn't too bad, and that interface runs fast.

The steppers we use in the camera heads have smart controllers built into the back of them. You can go oldskool step/direction pins if you like. Or talk to them via I2C and send step/direction commands. Or use their command protocol to say "Get your arse to X (Mars?), in this amount of time / at this speed". Which to me is a much, much nicer way of doing it - no need for ridiculously fast interrupts to get smooth step rate variations at higher speeds, just the 10kHz or so g-code processing loop. Now these things are ridonkulously expensive for what they are, but surely there are driver boards out there that support this kind of techno magic?
User avatar
Generic Default
Printmaster!
Posts: 558
Joined: Mon Jun 03, 2013 6:56 pm
Contact:

Re: DIY Mill Turn Center

Post by Generic Default »

Is there any way to disable inputs to the stepper drivers while still making them output power to the stepper motors? I know there are enable and reset pins on stepper drivers, and it looks like those won't work for this, but...

If we have ALL of the stepper motor drivers wired in parallel to common IO pins, then give each stepper driver it's own unique pin for say, STEP, we can reduce the total number of pins needed to drive a bunch of steppers.

So if normally you need 3 pins per stepper (STEP,DIR,EN) we might be able to have DIR and EN common pins for all of the steppers, then give each stepper it's own STEP pin. Or something along those lines, since not every axis will need to move every frame. By switching high and low on the STEP pins to individual drivers, you can still control them. These drivers only change the DIR input when the next STEP rising edge is detected.


If the goal is to get as many stepper motors operating from one board as possible, this may be an easy and fast way to do it. If P is the number of pins needed to operate N stepper motors, the way we're doing it right now is such that

P = 3N

Whereas using common pins would be

P = 2 + N

For operating more than 1 motor, this saves pins. It does limit what you can do if you want to turn off motors, though. But on most machines you don't run all of the steppers all of the time, we can mix and match to get around this. Is this idea worth thinking about or is it completely DERP?






EDIT: I just checked the smoothieboard v2 page for the first time. the V2 pro looks awesome, it may allow as many steppers as needed with chainable expansions.
http://smoothieware.org/blog:13
Check out the Tri hotend!
User avatar
Captain Starfish
Printmaster!
Posts: 962
Joined: Tue Dec 10, 2013 5:24 am

Re: DIY Mill Turn Center

Post by Captain Starfish »

Common DIR pin is fine until you want one (not all) motors to go backwards.

I don't know whether EN enables the driver (ie powers the stepper) or tells it to listen to the other two pins but I suspect it's the former.

If that's the case you could probably gang the ENable pins up together giving you P= 2N+1 pins required, the EN output turning on or off all the motors.
User avatar
Generic Default
Printmaster!
Posts: 558
Joined: Mon Jun 03, 2013 6:56 pm
Contact:

Re: DIY Mill Turn Center

Post by Generic Default »

At first I thought it would be better to use common step and DIR pins and use individual EN pins for each stepper driver, but I checked out the data sheet and it looks like EN must be on for the motor power to work.

Using a common DIR should work, since the driver doesn't recognize the change in DIR until it gets a STEP pulse. So you set the DIR for the motor you want, then immediately set the STEP if the motor is going to take a step. Every other motor is not moving (since they have low on the STEP), and by the time you want to control those other motors, you can change the DIR to what that motor needs. Since this whole method is done directly from IO pins without communications protocols, you don't have to worry about wasting data space with addresses and stuff. At least that's the theory, programming this would take a while!
Check out the Tri hotend!
Polygonhell
ULTIMATE 3D JEDI
Posts: 2430
Joined: Mon Mar 26, 2012 1:44 pm
Location: Redmond WA

Re: DIY Mill Turn Center

Post by Polygonhell »

There is a minimum time between setting the dir pin and applying a step pulse.
Most of my firmware experiments use a common EN pin and a pair of pins for each axis, I usually hard wire the uStepping jumpers, most ARM processors (LPC/STM or whatever) have more than enough IO for that.
User avatar
626Pilot
ULTIMATE 3D JEDI
Posts: 1720
Joined: Tue May 14, 2013 12:52 pm

Re: DIY Mill Turn Center

Post by 626Pilot »

Captain Starfish wrote:Or use their command protocol to say "Get your arse to X (Mars?), in this amount of time / at this speed". Which to me is a much, much nicer way of doing it - no need for ridiculously fast interrupts to get smooth step rate variations at higher speeds, just the 10kHz or so g-code processing loop. Now these things are ridonkulously expensive for what they are, but surely there are driver boards out there that support this kind of techno magic?
That isn't a half-bad idea. A cheap ATMEGA chip coupled to a stepper driver could have its own native code that lets it control its own motion locally. Would be computationally much easier for the controller. The only trouble is that you'd have to find a way to synchronize execution. I would still use SPI over I2C because the latency is over ten times less.

For something out of the box, the Dynamixel is one option, although they are pretty expensive. Then again, these are actual geared DC servomotors with onboard positioning control, PID, etc. - they have already done all the hard work. The firmware would only need to know how to send commands using their bus protocol.

I think for my efforts, it will be simpler to use the three-wire shift register protocol. In the first iteration, I would use StepSticks. Later on, I'd try micropots and non-StepStick driver solutions. If the firmware simply couldn't keep up with the refresh rate - not enough clock cycles left to do the extra work, or whatever - then I would look into other solutions.
User avatar
Captain Starfish
Printmaster!
Posts: 962
Joined: Tue Dec 10, 2013 5:24 am

Re: DIY Mill Turn Center

Post by Captain Starfish »

Something like the equivalent of a SMPTE heartbeat broadcast on the bus could keep all the processors in sync.

Hey, like I said, the shift register will work until something seriously glitches then the downside is you've got no recovery. I used them for years driving LCDs from two pins on a micro. Only very occasionally would things get confused. If you're going down this road, something worth considering is a shift register that has an address reset pin wired back to a third pin on the micro. A pin that lets you leave all the outputs as is, but forces the 'current' output selection on the clock back to zero. Belt that pin at the start of every output run, and you'll at worst only throw things out by a step. The challenge is to find a chip that will give you that type of reset without zeroing all the outputs as well.
User avatar
Generic Default
Printmaster!
Posts: 558
Joined: Mon Jun 03, 2013 6:56 pm
Contact:

Re: DIY Mill Turn Center

Post by Generic Default »

OK so a few design changes that I need to bring up here. I know I haven't shown the full machine yet, but I will soon enough. For now, I need your advice on the headstock and spindle designs. For the next few months I will have access to a full sized CNC lathe, so I can do full sized parts with THREADS and stuff!

In a nutshell, my latest (iteration 3) headstock is made of 4 main parts. The base, a 90 degree aluminum angle bar, a half inch flat plate, and a large 3.5" OD tube with wall thickness of half an inch. The tube is the orange part. It will be made in a single chucking on a CNC lathe. The OD will be turned, the face will be faced, then two bearing seats will be bored with an inside grooving tool (at least, all this is the plan). Then it will be parted off. My idea is that by making the entire thing in one clamping operation, all of the mating faces will be very perpendicular and precise. It's an aluminum tube so I plan on installing the precision bearings by heating the aluminum and exploiting the thermal expansion difference. The tube is 5 inches long.

The new iteration 3 headstock is a lot more simple and easy to machine and assemble compared to iteration 2. It should also be much more rigid and strong since it has so few pieces. Iteration 2 had two separate bearing seats, each of which would be positioned on the XY plane of the headstock, then locked in place with bolts. The bearings would be seated with thermal expansion in an aluminum tube.

headstock and spindle comparison.jpg
new headstock and spindle collet and chuck.jpg
2nd iteration headstock and spindle collet and plain.jpg
Spindle Tube Cross Section Comparison.jpg
headstock iteration 3 cutaway.jpg


Iteration 3 of the spindle will be machined in 1 piece from a foot of 2.25" 513 DOM steel tube. The spindle tube is only about 7 inches long, so it will be turned between centers then parted off. The bearing surfaces must be quite accurate, Iteration 2 of the spindle had a 40mm bearing tube fit, iteration 3 fits in 45mm bearings. Iteration 3 has a much larger face on the front, which has bolt holes in it so the faceplate that the chuck/ER collet nose bolts to has a way to take force or torque in any direction without coming loose.


Iteration 3 only has 0.125" wall thickness between the bearing ID and the inside of the tube. It has a bigger capacity for bar, though. Iteration 3 can fit 1.5 inch bar stock while iteration 2 can only fit 1.125 bar stock.


I am mainly concerned with overall system rigidity and strength, specifically the wall thickness of the spindle tube in iteration 3 being only 0.125 inch. Is this enough? I don't want it to fatigue or bend, but the forces on it will always be fairly low. I figure a 1.75 inch steel tube should not break.

In the machine assembly, iteration 3 headstock and spindle looks significantly more rigid and strong, it also has a cleaner, smoother look to it and fewer parts. There appears to be less overhang, so the work is being held closer to the bearings.

Give me feedback and questions please!
Check out the Tri hotend!
Post Reply

Return to “What are YOU making?”