Category Archives: robots

Controller r3 and endurance testing

After my self-education on MLCC derating I spun yet another low-volume prototype run of the servo controller.  This one has more than double the effective capacitance by doubling the number of capacitors and by selecting capacitors that have less derating.  I also fixed an incorrect pad geometry for the 6 pin ZH connector, optimized the BOM count a bit and reselected parts that were no longer available.

controller r3
2x fully assembled controller r3

Endurance Testing

To validate that this controller revision was robust enough to get a full mech’s worth of them made, I wrote up a simple test tool which ran the leg through a continuous jump cycle.  The goal was to validate the thermal design of the controller and motor, and while I’m at it, test the robustness of the 3d printed mechanical leg parts.

I knew endurance testing would be a process.  That said, this was a pretty interesting one.

First up: The RS485 cable joined into a screw terminal in part of the cable that moved up and down during a jump.  This had been coming loose on and off for me previously, and now was a limiting factor.  The fix was simple, move the terminal block further down the cable harness so that it didn’t move during a jump.

RS485 USB adapter
Inline RS485 USB adapter

Next, an even simpler problem.  The leg wore through some gaffer tape I had on my sheet of jumping foam and it became stuck to the adhesive.  I just moved the leg so that it didn’t jump on tape.

Now, an exercise in thermal management.  I gradually decreased the current used during the jump and landing phase until the steady state temperature of the controllers didn’t exceed my somewhat arbitrary 60C.  At that point, the 3d printed parts were starting to outgas a bit, so I figured that was a decent upper limit.

With those changes, I was able to get it pogo-sticking pretty reliably for 6 or 7 minutes at a time.  Here’s a video of the end of one of those runs, at which point you can see the next problem.

A more vexing problem

As seen above, after jumping for approximately 6 or 7 minutes, eventually the yaw axis would fail in a way that resulted in the electrical phase detection becoming offset.  The offset appeared to grow over time.  Eventually, this resulted in a loss of control in the lateral axis servo, when the D and Q currents became swapped.

This problem was most mysterious.  The lateral motor is basically doing nothing in these tests, the overall torque applied is maybe 1/50th of that which the upper and lower leg motors are generating.  My first thought was that perhaps the magnet which was attached to the shaft was faulty or had become demagnetized.  So I swapped it out, and while I was at it, added a spacer so that the magnet was closer to the magnetic encoder.

BLDC motor with magnet on axle
New magnet installed on axle

No dice.  Same failure, although this time I got 15 minutes of jumping in before it failed.

Another thought was that the rotor was somehow slipping on the axle.  However, the set screw was definitely still firmly in place, and this seemed pretty unlikely anyhow, since there was almost no torque on it.  The upper and lower leg motor with 100x the torque were not slipping.

Finally, I concluded that the bracket itself was deforming, resulting in the magnet changing alignment with the magnetic sensor.  In this configuration, the entire leg is cantilevered out.  Additionally, the linear rail fixture results in a large amount of torque being applied to the yaw bracket.


I already had beefier brackets coming in for other reasons.  I swapped them in, along with some new leg hardware to be described later.  Now with some forced air cooling I was able to even jump a reasonable height without stopping.  Here’s an endurance run showing the most aggressive jumping it could do indefinitely.

And here’s another video showing the max height I could get on this jumping fixture, which it could do for about 2 minutes before exceeding my safe temperature limit.

And for fun, a snapshot of my desk while recording one of the endurance videos.  It is quite tedious to let the leg jump for hours at a time while hoping nothing goes wrong!


Mammal geometry leg revision

After getting the first version of the mammal geometry leg working and jumping I worked on a second revision.  At a minimum, I wanted to fix all the problems that required hand machining, however I also decided it was trivial enough to add a reduction ratio to the tibia through the belt drive, that I should just go ahead and do it.  My inverse kinematics calculations showed that this would make a big difference in average power consumption.

The first revision of the leg in CAD looked like:


The second revision looks like:


The major differences are:

  • The lower leg has a 44 tooth pulley, which combined with the upper 24 tooth pulley results in a 1.83x reduction ratio.
  • The upper leg is taller to accommodate the belt path to the new lower pulley.  This includes some weight reduction “truss” cutouts.
  • The top of the upper leg is rounded off, expanded, and has observation cutouts.  This facilitates installing the belt and giving it sufficient room to actually mate with the upper pulley.
  • I actually included access holes so that you could fit a driver in to attach the upper leg to the BE8108 with bolts, while still leaving most of a mating surface for the pulley bearing.
  • The lower leg clamp attaches with bolts instead of just pins.
  • A lot of other tolerances were tweaked to make things fit better.  These are all mostly specific to the Shapeways production machines.

Of course, I managed to mess up about a dozen things on the second revision, and had to spin a third.  Here’s a video showing the process of replacing the leg with new parts in fast forward so that you can enjoy the two hour long procedure in mere minutes!

Welcome Mini Cheetah!

It is great to see that Ben Katz was finally able to announce his work on the MIT Mini Cheetah!  I’m looking forward to reading their ICRA paper, if nothing else to figure out what motor selection they made and how to design a more compact gearing system.  My current prototypes rely exclusively on belts for reduction, as I decided that my current geared prototypes were too cumbersome.

UPDATE 2019-03-06: I now see that Ben’s thesis in his post is actually his master’s thesis, which fully describes the actuators and robots.  I had erroneously thought it was just his undergrad thesis.  Thanks for publishing so much!

New machine day – Prusa i3 MK3S

While designing the improved actuators for SMMB I’ve given Shapeways a lot of business.  I can definitely recommend it, their selective laser sintering (SLS) parts are easy to order, their website gives plenty of control, and you can expedite things to your hearts content.

That said, with the amount of 3d printing I am doing, I could have already paid for a fused deposition modeling printer several times over.  Thus, I recently acquired a Prusa i3 MK3S.  It certainly can’t print everything that you can do with an SLS process, but with slightly tweaks to the models it can do a lot of it.  The biggest upsides of course are the lower per-part costs… something like 20-100x cheaper, and the faster turnaround time.  Nearly anything I care about I can have a draft of overnight.

My first impressions are very positive.  After printing the test PRUSA panel, I CADed up two more quick name panels that printed flawlessly.  A simple flexi-dragon (thanks TheBeyonder!) also came out perfect on the first try.  It really is as easy as flexing the print sheet, popping off the part, wiping it down with IPA and kicking off another print.

Next up is switching from PLA to PETG and trying to get the mech chassis designed and printed.

Motor controller heatsinking

The controllers for the improved actuators for SMMB have a moderate amount of power to deal with.  During jump maneuvers they can put 60 amps of phase current into the motor, and I’ve applied for very short intervals over 500W of power to a motor.  The FETs on the board are relatively high performance, but there is still a fair amount of heat that has to be dissipated.

When getting started, I knew I would likely have to do something to get heat out of the board and had a two stage plan.  The first was to heatsink the back of the controller board and second, if that wasn’t enough, heat sink the front of the board.


The back of the board has copper planes on the bottom-most layer which are connected by many vias to the primary FETs, with the express intent of heatsinking to them.  A heatsink on that side can thermally couple the control board, through the solder mask, to the motor mounting bracket and the motor itself.


I went with just a simple waterjet cut aluminum plate of appropriate thickness and some kapton tape covering the holes that lacked soldermask on the back of the board.  Here’s a bunch of the first revision back from eMachineShop:


Installed onto the controller and motor, this looks like:

I tested thermal dissipation of the controller with no back heatsink, with a back heatsink but no thermal paste, and with the heatsink and thermal paste. In each case, I tried to let the temperature reach steady state while wiggling the motor around to apply approximately equal power to all phases.

No Backplate Backplate w/o Paste Backplate w/ Thermal Paste
5A 35C 31C 32C
10A 47C 36C 35C
15A 65C 47C 40C
20A >70C 57C 47C
25A N/A >70C 59C
30A N/A N/A >70C

For these motors, the motors themselves have thermal problems even at 25A continuous, so this means that just the back plate with thermal paste is enough to make the controller not be the limiting factor.  Thus there’s no need to mess with what would be a more complex to design and manufacture front heatsink as well.

Mammal geometry 2d inverse kinematics

Now that I have a mammal geometry leg moving, I wanted to get a better feel for what the overall performance would be in various gaits.  I had already derived position based inverse kinematics for Super Mega Microbot, but had no such derivation for force.  Here’s my jupyter notebook with derivations for both position and force (in 2D), along with average power consumption for various forms of straight walking gait with my current draft motor selections.

And because I couldn’t get the notebook to embed a video through a github gist, here is a youtube video of the animation that is commented out in the middle of the notebook.


Mammal geometry legs

Before committing to the side-by-side 4-bar linkage leg for SMMB’s new actuators, I wanted to give a try with a more traditional mammal geometry.  That was my preference to begin with, but my initial motor evaluation didn’t find any motors which had sufficient torque without a gearbox, and adding a gearbox in a simple way changed the dimensions enough that mammal geometries weren’t feasible.  I spent some time looking for new options, and I found at least one which was promising, the XOAR Titan 6008.

XOAR Titan 6008
XOAR Titan 6008

On paper it provides the same order of magnitude of torque as the 3508 without needing a gearbox.  It’s diameter is of course larger, but not actually that much once you consider the gearbox hardware I had developed for the Turnigy 3508.  I’ve drafted up a test leg geometry, and the overall dimensions are about the same as for the 3508 variant.  Here you can see a side-by-side CAD model of the gearbox leg vs the direct drive leg.

The first sample, as usual with my 3d printing efforts, needed a moderate amount of whittling and post-machining, but does fit together and operate.

Next up is installing it in the jumping fixture and seeing what it can do there.


MLCC ceramic capacitor DC bias derating

While testing SMMBs new actuator under load, I kept getting faults from overvoltage that I had not anticipated.  The firmware only samples voltage once per control cycle, and while that plot did look very interesting, it probably wasn’t representative.  I wired up the scope to be able to sample the voltage and FET control signals during operation and sure enough, the voltage ripple was way higher than I had predicted based on the original design.  Even at only 30A phase current, the voltage ripple on the main power bus was 4.2V.  Note that this was with a nominal operating voltage of only 13V!  I had been trying to operate at 40A, for which it must have only been worse.


When I originally laid out the board, I used approximately the same bulk capacitance as Ben K. had in his third revision board; my r2 board contained 6x 22uF 35V MLCC (multi-layer ceramic capacitors) from TDK.  However, the voltage ripple observed in the plots was consistent with a much lower overall bulk capacitance.

And now begins another self-education session.  I had always assumed that modern MLCC ceramic capacitors were made of magic pixie dust and had somehow managed to achieve near capacity parity with electrolytic capacitors with no real downsides.  However, after looking into it, I found that in fact, the capacitance of a MLCC capacitor needs to be derated by the DC voltage applied to it.  The derating curve can be quite significant.  For the capacitors I had chosen, at 12V DC bias, the actual capacitance was only 20% of the top line value!  :theresyerproblem:

Fortunately TDK has a handy feature on their website which lets you sort capacitors based on their effective capacitance at any DC operating point.  I found some 10uF options that have about a 20% higher effective capacitance than the 22uF I had selected previously, and in the next revision of the control board I will just need to add a lot more of them.  In the meantime, I’ve double stacked up capacitors to get closer to something reasonable, and increased the switching frequency to 60kHz from 40kHz.  Here’s a plot of 30A when I was testing it at 80kHz, which shows a much more manageable 0.6V ripple.  Hopefully that can be reduced even further with a bit more capacitance in the next revision.


Reworked control board
Two stories of MLCCs


Encoder autocalibration

I have been continuing to iterate on the control and mechanical aspects of the improved actuators for SMMB.  While working on an alternate board mounting strategy, I ended up with a magnet that was much much further from the absolute encoder than before.  This resulted in significant errors in the estimated motor phase at various points in the revolution of the absolute encoder.  In the spirit of copying every single thing Ben Katz did in his project, I implemented a piecewise linear encoder calibration technique.

My effort largely uses the same approach: The virtual “d-axis” current is advanced through phase space at a constant rate and the encoder is sampled simultaneously.  This proceeds until the encoder has advanced through one full revolution.  It then reverses direction and does it again.  Then, a script consumes those values, and first determines the number of poles and the encoder direction.  Then for each encoder value, it estimates what the phase should have been and computes the difference between the actual commanded phase and what was measured.  The approach here is slightly different from Ben’s approach, as it works in the encoder space instead of the phase space.  As with Ben’s work though, this difference has a moving window average applied to it with a size equal to one electrical phase.


The plot above shows one run of the calibration.  The top plot shows the phase value in radians plotted against the absolute encoder value as a uint16.  The bottom plot shows the difference between the perfect mapping and what was actually measured, with the moving average in orange.

For this particular mounting configuration, the peak to peak phase error was almost 0.5 radians, or 28 degrees, which results in a fair amount of torque ripple.  Automated calibration also gives significantly more repeatable performance than my previous approach of “command a few phases and eyeball a suitable average”.  This does still leave two other parameters to auto-calibrate, the motor resistance and kV rating.  However, both of those are much easier to measure reliably by hand so fixing them is not as urgent.