So I totally ditched Corn­troller for its hot redesigned (square!) little sister, Baby­Corn­troller.

The control (corn­trol?) logic board is called Mini­Cob1. I shrunk down Corntroller’s Tassel from credit card size (3.4″ × 2.1″) to just 1.95″ × 1.95″, while adding a wire­less radio, doubling the number of power stages and analog fron­tends (so I can control two motors), and still keep­ing the micro-SD card slot. Oh, and going from a four-layer to two-layer layout yet keep­ing all compo­nents on one side.

To perform this minia­tur­iza­tion magic, I switched from the 100-pin STM32F103VG to a 64-pin STM32F205RC, which has more flex­i­ble pin assign­ments (every GPIO pin can be muxed to a vari­ety of periph­eral func­tions), supports boot­load­ing on IO inter­faces other than USART1, and is faster/has more SRAM for the same cost. Plus, it’s 100% pin-/code-compat­i­ble with STM32F4s which run even faster and have FPUs.

I actu­ally managed to use every single pin on the STM32. Wow.

But why 1.95″ square? Well, so I can put the boards through dirt cheap Shen­zhen-direct PCB services, in case I want to make like, ten of these.

Mean­while, the power stage/analog fron­tend board (HexHusk -> Tiny­Husk) got a makeover as well. Though Corn­troller is a blatant and outright inten­tional (and very poorly done) clone of 3ph Duo, Baby­Corn­troller is merely a blatant and acci­den­tal clone of Flying Flux. Shane and I had both started our boards before we real­ized we both had:

So of course, Shane & I declared motor control design war on Face­book, and finished our boards in record time. Think hackathons, except with hard­ware, less sleep­ing, and a whole week in length.

It also goes with­out saying that I’ve stuffed Tiny­Husk full of advanced BLDCM/PMSM controller things:

  • Six-input PWM so I can leave phases undriven (coast­ing, six-step commu­ta­tion, etc). Mini­Cob is laid out so that its 6-output TIM1/TIM8 PWM modules with dead­time push into these pins.
  • Dual-phase current sense (±66A) via ACS714 bidi­rec­tional hall-effect current sensors in paral­lel with 1mΩ jumpers, simul­ta­ne­ously sampled (hells yeah triple ADC) with power bus current sense provided by two low-side 1mΩ resis­tors in paral­lel.
  • Volt­age sense on all three phases, laid out to hit differ­ent ADCs so I can simul­ta­ne­ous sampling as well (not very useful, but at least I did it >.>). This is great if I want to do tradi­tional six-step sensor­less control.
  • Eigh­teen multi-layer ceramic 1210 50V 10µF caps. These are placed right next to the FETs and serve as the L1 cache of bus capac­i­tance, while two low-ESR/-ESL 680µF aluminum caps chill on the side of the board as my L2.

All of this should allow me to do field-oriented control (sensored or sensor­less) with current (torque-mode) control. Regen­er­a­tive brak­ing, as I under­stand, comes with the pack­age.

So all this func­tion­al­ity is laid out onto 16 pins on the left side of Tiny­Husk. So what’s the right-side 16-pin header on Mini­Cob for? It’s a frig­gin’ second motor’s worth of pins! It’s rotated 180 degrees so that I can stack two Tiny­Husks onto one Mini­Cob, and just rotate one husk board so that they use differ­ent head­ers.

Unfor­tu­nately because of school, I didn’t have time to test Baby­Corn­troller until finals week. So I had less than a week to run them in the Inven­tion Studio before I got shipped out to war an intern­ship in Cali.

However, before that, I done spanned a motor! I imple­mented six-step sensored commu­ta­tion with bipo­lar PWM and ran it up to 32V on a pretty boring BLDC motor.

WOOO IT SPINS. By the way, notice that the motor setup isn’t actu­ally connected to my computer. Wire­less trolling oppor­tu­ni­ties abound. 😉

The phase wave­forms look hot. Text­book BLDC, Shane says. I was little worried about the reverse volt­age spikes when a phase goes undriven—turns out they’re induc­tive flyback from the field in the phase collaps­ing then dump­ing current into the controller, and not some weird PWM glitch.

And some more wave­forms at a lower duty cycle. Still a nice slope on the undriven phase, though nois­ier. Now this measured at the motor terminals—my controller’s volt­age sampling is buffered and low-pass filtered, so what it sees will be a lot cleaner.

Regen brak­ing works bril­liantly, but big current changes (like full stop or full reverse) will spike the bus on my power supply and also cause my controller to get into a trap. I thought this could be the brownout detec­tion kick­ing in, so I scoped my 5V and 3.3V logic buses with the switch­ing wave­form:

DAT NOISE. The top is 5V, the middle is 3.3V, and the bottom is PWM output going to the driver. Holy crap 3.20V peak-to-peak on my micro­con­troller power supply. Now granted this is rela­tive to power ground, not logic ground near the micro­con­troller, so it’s a bit exag­ger­ated, but still. I think this is my fault; there’s just 10µF of logic power capac­i­tance coming out of my 3.3V LDO, plus a few 0.1µF caps the STM32 datasheet asked for. With a few cap upgrades I could make my logic supply a lot more stable.

What’s next? I’ll be imple­ment­ing rotor angle extrap­o­la­tion to do lead­ing phase advance, writ­ing a simul­ta­ne­ous sampling triple ADC driver for current control and sensor­less six-step, and find­ing a nice elec­tron­ics bench near Cuper­tino.

  1. v2.0, since it’s the second-gen board []