# Testing alternate magnetic encoders

The moteus controller, uses an absolute magnetic encoder to sense the position of the rotor and thus be capable of field oriented control FOC of brushless motors. To date, all the iterations of the controller have used the AS5047P encoder from ams. This is relatively common, works fine over SPI and hasn’t caused any problems. While investigating some other issues, I decided to take a stab at trying some alternate encoders. First, I tried the AS5047U, which is the same basic encoder, but incorporates a digital filter. I also tried the MA732, from Monolithic Power, which uses a different operating principle and also includes a digital filter. The plus side of the MA732 is that it reports full 16 bit values, even if not all of them provide a lot of value.

Testing the MA732 wasn’t as easy as the AS5047U, since it doesn’t have the same pinout as the AS5047 family. Fortunately, the footprint is smaller, so I was able to make my first “castellated” adapter board:

It is from oshpark — I had to hand dremel the edges to get all the vias exposed. Since it was a one-off, I didn’t worry too much about getting perfect alignment when soldering it up. Here’s a microscope image of the side with the best alignment.

And finally with the MA732 installed:

It worked the first time, although I had to tweak the code slightly to use the alternate SPI protocol of the MA732. I’ll write up the results in a later post.

# Initial dynamometer assembly

Earlier I showed off a torque transducer and the calibration fixture I used for it. I’ve now got enough assembled to make an entire dynamometer:

This has the torque transducer on one end, coupled to the “fixture” moteus controller through a bearing support. Then that is connected via a 3d printed coupler to the “device under test” moteus controller, which is hard mounted to the base plate. Any net torque between the two controllers will be coupled back to the transducer resulting in a measured torque.

I mounted it all to a nicely machined fixture plate I got from ebay. It’s flexible enough that I can build one for the qdd100 on it as well, although I might just get an entire second setup so that I can leave them both assembled all the time.

# Spring and damping constants

I’ve had a lot of discord questions lately! Here’s a video with the answer to another common question, can the moteus controller be set to purely damp:

# Measuring voltage ripple on moteus r4.3

In another discord moment, someone was asking about the difference between electrolytic capacitors and multi-layer ceramic capacitors. That, plus some desire to re-rate the moteus, inspired me to do another sweep and measure the DC bus voltage ripple for various power levels. I captured this plot with a 24V power supply, with a 5008 motor with 0.061 ohm of winding resistance or so, and each current being applied for 300ms. The voltage ripple is peak to peak measured at the power connector.

At the peak power I tested of around 740W, the phase current was 114A. At that level, the motor coil was getting hot much faster than the FETs on the moteus, which implies I need even more capacitance to take advantage of the full current capability of the FETs on the board. Also, the voltage ripple at the peak power I tested was higher than some applications could support.

# Torque transducer

I’ve been wanting to build a dynamometer for a while to better characterize the performance of the direct drive and geared versions of the moteus controller. I have now started down that path with a torque transducer, which I calibrated with the below fixture:

I got a what ended up being a low quality load cell amplifier to use with it from the same supplier, although discovered it was total garbage and am now using a SparkFun OpenScale board which seems to be working much better. Soon I’ll hopefully have something wired up that actually has a controller or two on it.

# First look at higher speed gaits

I’ve started some development on higher speed gaits for the quad A1! No real details to report now, just a video showing the first time I tested it not in simulation. I will admit these clips were cherry-picked, as there are problems still, but it is a start!

# Up-rating the qdd100 beta thermal bounds

When I first posted the qdd100 beta on mjbots.com, I performed a simple “continuous torque” test where I measured the torque that could be applied indefinitely without thermal limiting in a lab environment. It has come to my attention that other servos rate their “continuous torque” for a much lower value of “continuous”, sometimes only 30s. To make the situation clearer, I measured the time to thermal limiting at a range of torques and updated the product page.

For this test, at each torque value I started with the qdd100 in thermal equilibrium with an ambient 20C lab environment, then applied the given torque and waited until thermal throttling set in. No forced airflow was present and no conductive or radiative cooling enhancements were used.

# qdd100 telepresence demo

I saw a recent Skyentific video and decided to have a try at it myself, check out the result:

# quad A1 stand-up sequence part N

I’ve worked through a number of different iterations of the stand-up sequence for the quad A1 (2019-05, 2019-09). The version I’ve been using for the last 6 months or so works pretty well, but because it drags the legs along the ground to get them into position, it can have problems when operating on surfaces with a lot of traction, like EVA foam, besides being uselessly noisy.

To make things just a bit more robust, I’ve now tweaked the startup routine so that the shoulders lift legs clear off the ground before positioning the legs, then lowers them back down into place. This makes the stand up routine much more likely to succeed on just about any surface:

# Dealing with stator magnetic saturation

In my previous experiments demonstrating torque feedback (full rate inverse dynamics, ground truth torque testing), I’ve glossed over the fact that as the stator approaches magnetic saturation, the linear relationship between torque and current breaks down. Now finally I’ll take at least one step towards allowing moteus to accurately work in the torque domain as motors reach saturation.

## Background

The stator in a rotor consists of windings wrapped around usually an iron core. The iron in the core consists of lots of little sub-domains of magnetized material, that normally are randomly oriented resulting in a net zero magnetic field. As current is applied to the windings, those domains line up, greatly magnifying the resulting magnetic field. Eventually most of the sub-domains are aligned, at which point you don’t get any more magnifying effect from the iron core. In this region, the stator is said to be “saturated”. You can read about it in much more depth on wikipedia or with even more detail here. The end result is a curve of magnetic field versus applied current that looks something like this:

To date, moteus assumes that you are operating completely in the “Linear” region, where the torque and current are linearly related.

## Operating in the Rotation Region

To operate in the “rotation” region I ended up using the following formula:

$\tau = K_T * I_c + ts * log2(1 + (I - I_c) * is)$

Where $I$ is the input current, $K_T$ is the motor torque constant, $ts$, $I_c$ and $is$ are three constants that I fit to measured torque data. With some approximations, this can be calculated relatively efficiently on the STM32G4 that drives the moteus controller, adding only a microsecond to the overall loop time to go in both directions.

I then ran a torque sweep with my load-cell fixture from before, and sure enough, the input and output torque match much better now across the entire range of operation, despite the fact that the phase current needs to start growing very rapidly near the top end: