the continuing MG1/Prius Brick adventure: ID spline, inertia dyno, analog hall noise

whoops, this is backlogged post from 2 weeks ago.  my face has been buried in embedded programming and current control implementation.  there will be an update on that goofy thread soon.

With velocity control and working rotor position detection, it was time to move on to current control.  Since testing a current controller involves putting significant current through the motor, it was necessary to make some kind of load for the motor to dump energy into.  I figured an inertia dyno would be a good start.

PART 1: SPLINE TIME

I needed to attach a pulley to the spline on the motor shaft.  While a pulley with a circular bore and a couple of set screws probably would've been OK for the relatively low power bench testing, I figured I'd prove out the machining process for an inside diameter spline since I'd probably be doing it again in the future.

First up, make a form tool.  I found a broken end mill and took a molding of the motor shaft spline with some modeling clay.  I ground the end mill shank into the shape of a spline tooth.

IMG_0460 IMG_0461 IMG_0462 IMG_0488IMG_0490

I dug around until I found some belt pulleys that would fit.  One of them was a “QD” style pulley.  It has a tapered bore.  When it is tightened against the shoulder of a shaft collar that has the same taper and a slit, it closes the slit in the shaft collar and tightens it around the shaft.  Pretty nifty.

I need a large chunk of something to couple the output spline to the belt pulley.  I considered making this part out of steel since it's taking sick gnarly torque out of that rather small motor shaft, but I ran some FEA on a model of a spline tooth and found that aluminum would do just fine.

spline_tooth_250N

(deflection highly exaggerated)

Luckily, the ABSURD ROUND THINGS drawer at MITERS had an even larger belt pulley to offer.  That would do just fine.

IMG_0475 IMG_0476 IMG_0477 IMG_0478

I turned off the teeth, faced one side, and made a bore to clear the step on the motor shaft behind the spline teeth.  None of these surfaces are critical bearing surfaces, so it was OK to take the workpiece out of the chuck and flip it around without reindicating.  To get disc shaped things aligned with the lathe axis, I use parallels against the chuck face.IMG_0479

next up, figuring the taper.  I took measurements on the pulley and computed an angle.  I set up the compound on the lathe to match that angle and used a dial indicator to get the alignment just right before making the cut.

IMG_0481 IMG_0480

the fit is gud.

IMG_0482 IMG_0483

with the mission critical taper cutting part out of the way, I bored the adapter to the motor spline's minor diameter.

IMG_0484 IMG_0485 IMG_0486 IMG_0487

Here's the form tool mounted in a holder.  The holder is a piece of stainless turned to 3/4″ on one end to fit in an R8 collet.  The other end has a cross-drilled hole for the cutter and a tapped hole for a set screw.

IMG_0577

I put it in the mill, unplugged the motor, and locked the spindle by meshing the back gears without dropping the spindle pulley into mesh.

IMG_0578

centered and set up on the rotary table, I made cuts by lowering the quill.  I used the DRO to measure the depth of cut.  Single point broaching of a spline sounds slow, but this went pretty quick in aluminum.  The fit on the motor shaft was too snug the first few times, so I went back over to the rotary table, rechucked the piece, and cut the detents deeper and wider.

IMG_0491

I cut off the end of the motor shaft because it stuck out.  It had some mystery seals on it, perhaps related to how oil used to flow around this thing.

IMG_0470

The ID of the hole in the motor shaft was darn close to an M8 tap drill, so I enlarged it slightly and tapped it.  I used one of those goofy strap wrenches to hold the rotor while tapping.

IMG_0517 IMG_0518

The Inertia Dyno…

was glued and nailed together as wood screws seem to be a rarity at MITERS.  The only times I ever find myself needing them are in the early morning hours when hardware stores are closed.

I repurposed the flywheel that came with the Baldor treadmill motor that Dane graciously donated to The BremsChopper Foundation for Stupid Electric Vehicle Studies.  Little to no thought went into pulley or flywheel sizing, it was made with available components.  All we need is some extra inertia to dump energy into.

IMG_0532 IMG_0533

it even rotates.  in the last clip you can see the 5A current limited supply kick into current mode during hard acceleration.  This sags the bus voltage.  During deceleration, the motor dumps the stored flywheel energy back into the bus, raising the voltage on the supply.  I hear power supplies don't like getting current pumped back into them.  We'll try to avoid that in future.  (the two halves of the supply are in series, so they sum to about 65 volts)

a novel method for robust more legit rotor position detection

So those analog hall sensors work great, except when you hold a magnet up to them.  That saturates a sensor and confuses the controller leading to excess current draw and sadness.  A magnetically permeable shield should redirect outside magnetic fields away from the sensors, yeah?

I figured it might as well be legitimate and less prone to being smashed than the previous setup.  I printed a fresh magnet array on one of the UP! printers in the IDC.  Them things are fiine.  Nice breakaway support material and a box to keep consistent temperatures and avoid warping.  Lots of folks around here agree that the UP! is one of the better FDM hobbyist printers.

IMG_0536

The steel box can thing is a machined weldment.  I turned the ID and OD on some DOM pipe.

IMG_0537 IMG_0538

then cut out some feet and a hat.  This thing will eventually have a DB9 connector sticking out of it, so that's in there too for scale.

IMG_0539

Got it welded up thanks to Jack up in D-Lab who maintains order on a beautiful welding setup.

IMG_0542

I welded the cap on the ID.  Here I'm turning down the OD until it's flush.  I did some flipping and reorienting of the workpiece to trim both sides of the feet.  They warped a bit while welding.  I removed material until they were all coplanar.

IMG_0543 IMG_0544 IMG_0546

for the third time now, I did the super silly piece of wire center finding thing.

IMG_0547

I even ebay'd a super cheap $12 dial indicator just prior to this.  The listing showed a no-name dial, but when it arrived, I found a genuine mitutoyo mitu..togo?

IMG_0579 IMG_0580

It only required slight filing of the burrs on the dovetails to become a usable dial indicator.  I didn't yet have a good way to mount it to the mill spindle and I was in a rush, so I stuck with the wire method for this job.

I paid little respect to the angular alignment of the weldment when fixing it in the mill vise.  I used the DRO to find the coordinates of an eyeballed hole location (with respect to the cap's center), then computed where the other two holes should go.  All the holes are at the same radius, and are spaced 120 degrees apart.  I found the cartesian coordinates of the other holes and steered over there with the help of the DRO.  Hole locations were recorded for the purpose of drilling a matching set on the motor back plate.

IMG_0549

A slot and some tapped holes were added for the DB9 connector

IMG_0550 IMG_0551 IMG_0553

not wanting to remove the back plate, I stuck the whole motor on the mill in this horrendous setup to drill and tap the holes for mounting the end cap.  A few shavings in the airgap?  ehh, probably OK.  If it was steel instead of aluminum chips I might take more caution here.

IMG_0556 IMG_0557 IMG_0558

here's one last look at the old setup: digital halls on the left and analog on the right.

IMG_0559

the new ones are super glued into a printed ring.  tiny wires connect them to the DB9 connector.

IMG_0561 IMG_0562 IMG_0563

I went through a couple revisions of plastic ring trying to get the magnet to hall sensor spacing right.  Too close and the signal clips when the sensor saturates, too far and there's not much of a signal.

IMG_0566

After functionality is confirmed, the whole thing is potted in MITERS Extra High Strength Engineering Glitter Glue

IMG_0567 IMG_0568

we were having some sooper lame noise issues in the sensors when the steel endcap was electrically connected to the motor housing.  We hadn't had them before, so it was almost certainly related to the endcap being a conductive thing.  I tried electrically isolating the cap with painters tape and hot glue.  That fixed it OK, however, touching both the can and the motor housing with one hand was enough to transform the left hall sensor output into the right one.

DS1Z_QucikPrint27  DS1Z_QucikPrint28

The noise propagated through the system to the angle estimator where it produced erroneous angles.  This made the motor click and pop in unhappy sounding ways.  The angle estimate in the code could should be low pass filtered.  Since it would be nice to keep the noise out in the first place, we goofed around grounding the motor housing to different things with mixed results.

Adding 10nF of filter capacitance to the resistor divider where the signal comes through helped a bit, but the noise was still bad enough to make the motor sound bad when shorting the can to the housing.

IMG_0581

The cutoff frequency was specified to be half an order of magnitude higher than the maximum anticipated frequency of the desired signal.  When goofing with different capacitor values, I found that the phase lag caused by a very slow LPF was enough to knock the angle estimate way out of reality, causing the controller to draw a ton of current.  The Right Cap Value was about 10nF in series with a 19K resistor – a compromise between filtering ability and added phase lag.

The (kind of derpy) solution was to print some plastic doobobs to electrically isolate the can from the housing.  Shoulder washers stop the cap screws from coming in electrical contact with the cap.

IMG_0575 IMG_0576

that worked fine.  The cap could use a lick of paint to give it some protection.  It does a good job blocking stray magnetic fields.

I've been thinking about a way to recalibrate the hall sensor endpoints on the fly.  It assumes that a zero crossing can be measured and that a velocity can be calculated from that.  When velocity is above a threshold, the controller will find min and max in the hall sensor waveforms and use those to either replace or adjust the existing waveforms.