## October 6, 2020

### Benchtop 5-Axis Mill

This was inevitable, but the pandemic has accelerated my home-shop setup.  What with leaving the lab almost a year ago (I miss you Lab Haas) and no MITERS for the foreseeable future, I haven't had access to any machine tools other than the tiny lathe for a while.  Time to fix that.

I've been following Pocket NC since 2012, after seeing them at the NY Maker Faire - they make a tiny but surprisingly capable 5-axis CNC mill.  It has basically the same layout as the big GROB machines, with a horizontal milling spindle moving in Z and X, and a cantilevered trunnion on the Y axis.   I was tempted to get one of their machines, but I think they're just too small and underpowered (and pretty expensive) for the sort of parts I make.  In my search for a small-enough-to-carry-upstairs-into-my-living-room-but-not-too-small CNC mill, I ran across a scaled-up Pocket NC clone made by a Chinese company, Xinshan Tech.  I couldn't find any examples of real people outside of China owning the machine, but after some emails back and forth with the company, including a bunch of videos, I was convinced that the machine was real and not a scam.  This machine was appealing, since it's a fair bit bigger than the Pocket NC, with ~50% more travel in each axis, all steel, servo (rather than stepper) driven, and much heavier (~70 kg).  I've gotten along just fine with 3-axis machines up until now, but I couldn't actually find any 3-axis mills that fit what I was looking for any better, and 5-axis opens up some interesting opportunities.

I decided to go for it, and a month later DHL showed up with a heavy crate:

Out of the crate and on the bench.  The machine is deceptively heavy given how small it looks, and is very awkward to hold onto.  Rigol scope in the background for scale.

Back side of the spindle visible:  It's a generic 800W ER-11 water cooled spindles.  Maybe something to upgrade in the future:

The three linear axes are driven by brushless servos with integrated controllers:

A peek under the bellows way covers at the (allegedly Hiwin) X-axis ballscrew and one of the linear guides:

The linear axis ballscrews are coupled to the servos with disc couplings, which is nice to see

The backside of the machine, where you can see the X,Y, and A axis servos.  The rotary axes are driven with harmonic drive reductions and supported by crossed roller bearings, which I'm surprised was possible given the cost.

When I unpacked the electronics box, a few screws had worked loose in shipping and were rattling around.  The inside of the electronics box was not confidence-inspiring.  There's a generic 36V DC supply to run the servos, a 1.5 kW VFD, and some pretty sketchy wiring.   The machine seems good mechanically, so I'm letting this slide for now....

I've been using the shipping crate it came in as an enclosure.  If I fold the door up it keeps the chips in and the noise down a little, at the cost of seeing what's going on.  Eventually I'll build a proper enclosure.  I set the crate on top of a Harbor Freight rolling tool cart, which stores the power supply box, water cooling, and related tools:

Screenshot of the the control software below.  The software isn't anything fancy, but does the job.  There are amusingly mis-translated buttons like "Knife", which actually runs the tool probing macro, "overrate", which is the feed override, and "Cold Fog", which presumably would turn on mist coolant if the machine had it.

Not particularly exciting, but here was my first working attempt at a multi-axis toolpath (video at 16x):

Here's one of the first "real" parts I've made - the front side of a motor housing.  Most of the material removal was done with a Datron 3mm single-flute end mill.  Thanks to the rotary table I could do this part in one setup, rather than machining one side, machining a fixture, and machining the other side like I would on a 3-axis machine.  Video at 8x speed.

Here's pretending the mill is a lathe and machining a shaft for said motor, including a lock ring thread cut with a 60 degree chamfer mill.  HSMWorks, which I've been using for CAM since the beginning, is pretty terrible for this style of toolpath, so the surface finish is a little weird.  It buffed out easily though.  In this picture the part is done and being parted off:

And here's that half-a-motor-housing and shaft with a rotor for a frameless motor installed (held on by a threaded lockring also made on the mill), and bearings and commutation encoder magnet pressed in.

I haven't pushed the machine too hard yet, in the interest of keeping noise down.  It's in my 2nd floor living room, and not very well enclosed, so I've been making the toolpaths conservative to avoid complaints from my neighbors.

Amusing setup from today - a part in the tiny lathe 3-jaw chuck, held in an ER-40 collet chuck, bolted to the table.  Milling a circular dovetail in the part (which is a fixture for yet another part), to match the dovetails milled into the lathe chuck soft jaws:  No dovetail cutter required.

Summary of thoughts/impressions so far:
• The core mechanical pieces of the machine seem pretty good.  Brushless servos, linear guides, ballscrews, and harmonic drives, on a steel structure is impressive at this price point.
• The less-critical hardware is a little janky - the bellows way covers, the sheet metal spindle cover, the electronics box, the water cooling loop.  But those are all relatively straightforward to re-do or repair if needed.
• With good tools (I've been having great luck with Datron single flute cutters for roughing), it performs pretty well cutting aluminum.  I've been roughing with a 3mm endmill at 20k RPM, 2.5mm stepover, .5mm stepdown, and 2000mm/min feed with no problem.  It could definitely be pushed harder but it gets loud.  I haven't tried harder materials yet.
• I haven't done a ton of experimenting yet, but "conventional" style toolpaths with large stepover and small stepdown seem to perform better than "adaptive" or "trochoidal" style toolpaths with a large stepdown and small stepover.  Needs more testing though.
• I wish I had a way to pre-set tool lengths with the ER-11 spindle.  The machine has a built-in tool probe, but swapping collets and probing takes a while.  I'm thinking about making a bunch of shrink-fit holders that all have the same shank diameter and bottom out in the spindle, so the collet and collet nut never have to come all the way off.
• There are a few vendors of the machine (It's even on Amazon, but also RobotDigg and a few other sites), but it's cheaper to get directly from Xinshan.
• Support has been really excellent so far.  I've had tons of questions about how things work, and I always get a response the next day.  When I've had g-code that behaves confusingly, they'll run the code on their machine and send me a video.
• CAM-wise, I've been using HSMWorks.  I think the kids these days are using Fusion 360 (Autodesk bought HSMWorks and I think has ported it into Fusion), but I've never tried it.  Solidworks integration is super nice since your CAM updates when your model updates, and I don't really want to switch to Fusion for CAD.  HSMWorks/Fusion 4/5-axis toolpaths are kind of a joke, but 3+2 (position the rotary axes then do a 3-axis toolpath) work great.  The "real" answer for good 5-axis toolpaths is probably a more legit stand-alone CAM software, but I'm going to stick to HSMWorks for everything I can.
• Cool feature, the machine can do TCP, Tool Point Center control - this means that the CAM origin does not need to be at the machine origin (the intersection of the two rotary axes).  You can put the CAM origin wherever, set the work coordinate system offsets by touching off to the part, and the machine will figure out the kinematics.  This makes CAM much simpler, since you don't have to know where the part/stock are on the machine when you're doing the CAM.  That's what you'd expect for 3-axis stuff, but with the two rotary axes, it's not just an offset in X, Y and Z anymore.  I haven't been to adventurous with this, but offsetting the Z at least seem to work just fine.

## August 30, 2020

### Varying pitch screw mechanism

I put together a mostly-3D-printed prototype of the variable-pitch screw idea.  Although it looked like it would work in CAD, I wanted to get a feel for the mechanism in real-life before designing anything around it:

The mechanism combines a cylindrical cam with linear motion constraint all on the same cylinder.

The main pieces besides the screw are shown below.  On the left is the linear constraint mechanism, which has 6 rollers in it.  In the center is the "nut" which has two cam followers pointing radially inwards.  The cam followers engage with the spiral slot around the screw.  On the right and left of the nut are bearings which take the thrust load from the screw, and constrain the nut.  On the right is a cap, which just supports one of the nut bearings.  It threads on to the linear mechanism, sandwiching the nut.

A better view of how the linear motion constraint works.  3 V-grooves go down the length of the screw.  6 plastic rollers on bearings ride in the V-grooves, preventing the screw from rotating or tilting:

The V-grooves are shallow enough that they don't interfere with the spiral cam slot:

Here's a cross section of the linear motion constraint.  There are 4 rollers per V-groove, and the rollers are carefully spaced such that 2 spaced far apart from each other are always engaged with the V-groove, even while one or two other roller is jumping over spiral slot.

Below you can see the makeshift cam followers inside the nut.  Each cam follower is a dowel pin pressed into a pair of flanged bearings.  For a "real" version of this I'll need to come up with something less janky, but this was good enough to check that the mechanism actually worked.

The linear constraint rollers were machined on the Tiny Lathe.  I used a diamond needle file to hand-grind a form tool out of an HSS blank.  The whole roller profile was turned in one pass by plunging the form tool in a set depth.  The bore for the bearings was also done in one pass, by offsetting the tailstock to one side, and boring it out with a ballnose end mill in the drill chuck.  Delrin is soft enough that you can get away with stuff like this.

Here's a picture of the form tool next to one of the rollers in the assembly:

The screw CAD was generated by creating a CSV of coordinates in MATLAB, importing it as a spline into SolidWorks, and sweep-cutting a small-diameter cylinder through a hollow tube, following the spline.  Kind of a finicky process, but it works.  If I decided to change the profile later on, I can replace the spline points with new set, and most of the dependent features are able to regenerate.

## July 22, 2020

### A decade of project blogging

I just noticed that as of this month, I've had build-its.blogspot.com for 10 years.  It's hard to believe how long it's been and how short it's felt.  Hopefully Blogger is still around in another 10.

For nostalgia's sake,  here's the oldest project-thing I've documented- strapping model rocket engines to a pinewood derby car:  This video predates the blog - I think it was filmed in 2007.

2nd place goes to this shot of me planing a railing on The Boat from 2009.

## June 6, 2020

### Simple Dynamics With Varying Transmission Ratios

An idea I've had in the back of my head for a while now is using varying transmission ratios to transfer kinetic energy between bodies.  That sounds really abstract, but I'll explain.

Here's a simple example that frames the problem.

There's a mass, $$m$$, which can translate in $$x$$.  Driving the mass is an actuator with inertia $$j$$ and angle $$\theta$$.  There's a transmission between the rotation of the actuator and the translation of the mass.  The transmission ratio, $$k$$, is the ratio between angular velocity of the actuator and linear velocity of the mass, i.e. a radius.  This radius varies as the angle of the actuator changes.

Below is a sketch of how a varying transmission ratio might look, with a pulley that changes radius as it winds up:

Start out with a low transmission ratio, so spinning the inertia doesn't move the mass very much.  "Spool up" the inertia to high speed.  Vary the transmission ratio so the mass accelerates at constant power, but the inertia speed is constant.  Then, rapidly increase the transmission ratio.  This should cause the inertia to decelerate, transferring its kinetic energy to the mass.

At least, that's intuitively what I would expect to happen.  It's similar to the idea of revving up an engine and dumping the clutch to accelerate hard (or do a burnout), but in the clutch case, half of the kinetic energy is necessarily dissipated by slip in the clutch.  In the variable transmission ratio case, there's no slip, so there shouldn't be any energy loss.

Jumping into the dynamics:
Instantaneously, the relationship between angular velocity and linear velocity is:
$$\dot{x} = k\dot{\theta}$$
Differentiating, the relationship between accelerations is:
$$\ddot{x} = k\ddot{\theta} + \dot{k}\dot{\theta}$$
Normally, with a fixed transmission ratio, $$\ddot{x} = k\ddot{\theta}$$.  But if the transmission ratio isn't constant, another term shows up.  If the transmission ratio is increasing and there's positive angular velocity, there's an additional positive acceleration.  That's in-line with the intuition so far.

If a constant torque $$\tau$$ is applied to the actuator, the acceleration of the mass works out to the following:

$$\ddot{x} = \frac{k\tau + j\dot{k}\dot{\theta}}{j + k^{2}m}$$

Rather than the transmission ratio being time-varying, say it's position-varying.  Imagine a cable spooling up on a variable-radius pulley, or a cam follower rolling along a cam.  Recognizing that if $$k = k(\theta)$$, then $$\dot{k} = \dot{\theta}\frac{dk}{d\theta}$$, the acceleration is:

$$\ddot{x} = \frac{k\tau + j\dot{\theta}^{2}\frac{dk}{d\theta}}{j + k^{2}m}$$

This position-derivative variant is nice because it can be pre-computed from k vs position, rather than requiring time-differentiation to get.

Going back to the idea I wanted to test: Spool up the motor to high speed.  Operate at constant speed and power.  Then spool down the motor to transfer the actuator's kinetic energy to the mass.

I roughly hand-designed a varying transmission ratio to do this.  At the beginning, there's a constant, small transmission ratio.  Then it switches to a logarithmic curve -  A log curve results in constant power output at constant actuator angular velocity, although I'm not going to justify that here.  At the end, it rapidly increases to slow down the actuator.

Here's a plot of the example transmission ratio vs motor angle.  Polar version of the plot on the right:

And a rotating GIF for good measure:

Simulating the dynamics, here's what I get when applying a constant torque to the actuator.  Actuator angular velocity and speed of the mass are plotted below.  First, when the transmission ratio is tiny, the angular velocity ramps up but the mass barely moves.  Then when the transmission reaches the logarithmic section, the angular velocity becomes roughly constant.  The mass accelerates at constant power.  Finally, the steep end section of the transmission is reached, the actuator angular velocity quickly decreases, and there is a corresponding jump in mass linear velocity.

Plotting the kinetic energies of the actuator and mass, vs the input energy, $$\int{\tau\omega}$$, you can clearly see energy trading off between the actuator and mass.  No energy is lost - the kinetic energies at the end are equal to the input energy:

Changing gears (ha), here's what a solid model of a pulley with profile this looks like:

And rather than a variable-radius pulley, the same transmission profile can also be implemented as a variable-pitch screw (or maybe technically a barrel cam).  A pair of cam followers ride in the grooves and act as the nut:

Stay tuned, prototypes coming up soon.

## April 18, 2020

### Titanium anodizing experiment

A month or two back I tried out anodizing a titanium bicycle fork.  Eventually I want to anodize, mask, and bead blast a frame along the same lines as Firefly , so the fork was a test-run to get a feel for the anodizing and masking process.

I did the anodizing by soaking a foam brush in a water and baking soda mixture, clipping one power supply lead to the brush, and one to the part, and brushing the part.

If you're good at this, you can get nice gradients by adjusting the power supply voltage as you move along the part, but I definitely need more practice.  I love the purple and dark blue parts:

I used some vinyl tape to mask out a pattern, and then bead blasted to strip the anodizing where it wasn't masked.  I didn't put any effort into this pattern since this was a test, but eventually I'll make a mask on a CNC vinyl cutter.  I need to find a blasting cabinet with a gentler media in it as well.

## January 20, 2020

### New High Power Motor Drive

I've been working on a large robot-size motor drive, with a design target of 75V, >70A (peak phase) continuous with heatsinking, and >150A peak.  In order to make the drive as compact as possible, it's split into three separate boards stacked on top of each other.  The bottom layer is the power layer with MOSFETs, ceramic DC link capacitors, and current shunts.  To minimize the thermal resistance between all the heat generating components to the world, the power layer is built on a 2-layer aluminum substrate board.  Above the power board is the logic board with microcontroller and gate-drive, built on a normal 4-layer 1 oz board.   On the very top is a breakout board with connectors for DC power input, the 3 phases, and communication/encoder

To get a better feel for how well the aluminum power board will work, I built a simple half-bridge using the same FETs as I plan on using for the final motor drive.

Here's the first test-board, affectionately named The Half Bridge of Science.  It's just 2 parallel TPW3R70APL FETs per side, some 250V .47 uF ceramic caps, and a couple TLP152 gate-drive optocouplers to drive the gates.

Here's my dummy load for the half-bridge:  4 big "Pickle" resistors in a 2S2P arrangement for 1 ohm and lots of watts, with the boost converter inductor from a Ford Fusion hybrid in series.

Here it is with 55 DC amps (equivalent to 77 peak sinusoidal amps) going out of it at 50V on the input at a 50% duty cycle, basically perfectly maxing out the MITERS Lambda 50V 30A supplies.

Here are side-by-side shots of the board with a thermal camera at 55A switching at 10 kHz on the left, and 20 kHz on the right.  Here's it's poorly  clamped to a heatsink with no thermal paste.  At 10 kHz, the FETs (Sp2) ran at 57 C, and the ceramic capacitors (Sp1) at 55.  At 20 kHz, the FETs were at 65 C and the hottest of the ceramics at 75 C.  Looks like I need more DC link ceramics to handle the ripple current.

There were a few mistakes with this board, so I expect thermal performance to only get better from here - I accidentally used the 1 W/m-K insulator instead of the 2 W/m-K insulator that's also available, and I misinterpreted the minimum via size, so the thermal vias were huge and sparse.  This seemed pretty promising, so I designed 3-phase version

Here's the populated 3-phase power board.  For testing, I got a normal FR4 board to confirm that everything works.  The copper power links between the boards were custom-machined, since I couldn't find any COTS pins that were as compact.

Here's the logic board, minus gate driver.  To start out, I'm trying the DRV8353S gate drive IC.  It's very similar to the DRV8323 I used on my smaller motor drives.  I went for the version without a built-in buck converter and use an external 15V and 5V buck to power everything.  Since the DRV8323 was good for driving 2 FETs very similar to these at 40 kHz, it should be able to drive twice as many FETs at 20 kHz.

The top of the stack has Wurth terminals to get power in and out, and some JST-SH's for logic.  I plan on replacing the logic connectors with something more robust like the Harwin Datamate L-Tek's I used on the Mini Cheetah, once everything is up and running.

The assembled stack:

Next time it will be a little bit thinner - I ordered the wrong male header for the board-to-board connectors, so the boards sit a little further apart than I originally intended.

Next to a coke can for a sense of scale.  The footprint of the drive is 45x45mm.

Hooked into a giant T-motor U15 I'm using for testing:

That's all for now.  There were two swapped pins on the logic board I had to fix with air-wires, but other than that everything seems to work.  Unfortunately I made some dumb testing mistakes and blew up the controller before I could push it too hard, and the stacked construction is almost impossible to disassemble.  But now that I know the board layout works I'm going to send out for the aluminum power boards.  Stay tuned.

## December 15, 2019

### Furuta Pendulum(s): Building some more

I built 6 furuta pendulums for a university controls class:

Since the original furuta pendulum was all built out of scrap I had lying around, I had to redesign pretty much everything from scratch.

Instead of using a hand-skewed motor like the original, I used a custom-wind of a T-motor gimbal motor.  These have low enough cogging torque to work pretty well:

Each motor gets a Microfit connector crimped on the leads, and a hollow shaft retaining-compounded in, for the encoder wheel to attach to:

The spindle has a pair of bearings very lightly preloaded by a wavy washer, and a diametrically magnetized magnet in the back which is read by a hall encoder:

In the base is a US digital 20k count/rev optical encoder which the wires for the pendulum hall encoder pass through:

SPI to the pendulum encoder gets passed over a 12-pin slip ring, with each pin doubled-up for (hopefully) better reliability:

In the base there's a board with power switch, mode switch, DC input jack, USB connector for serial communication, and programming header on it.  The mode switch allows the pendulum control to be done by the on-board motor controller, or by taking commands and passing back sensor outputs over serial to a computer running the controller.

I didn't want any screws to show, so the top is held on by 4 magnets:

Next to the original: