BabyCorntrolling

So I total­ly ditched Corn­troller for its hot redesigned (square!) lit­tle sis­ter, Baby­Corn­troller.

The con­trol (corn­trol?) log­ic board is called Mini­Cob1. I shrunk down Corntroller’s Tas­sel from cred­it card size (3.4″ × 2.1″) to just 1.95″ × 1.95″, while adding a wire­less radio, dou­bling the num­ber of pow­er stages and analog fron­tends (so I can con­trol two motors), and still keep­ing the micro-SD card slot. Oh, and going from a four-lay­er to two-lay­er lay­out yet keep­ing all com­po­nents on one side.

To per­form this minia­tur­iza­tion mag­ic, 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­er­al func­tions), sup­ports boot­load­ing on IO inter­faces oth­er than USART1, and is faster/has more SRAM for the same cost. Plus, it’s 100% pin-/code-compatible with STM32F4s which run even faster and have FPUs.

I actu­al­ly man­aged to use every sin­gle pin on the STM32. Wow.

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

Mean­while, the pow­er stage/analog fron­tend board (Hex­Husk -> Tiny­Husk) got a makeover as well. Though Corn­troller is a bla­tant and out­right inten­tion­al (and very poor­ly done) clone of 3ph Duo, Baby­Corn­troller is mere­ly a bla­tant and acci­den­tal clone of Fly­ing Flux. Shane and I had both start­ed our boards before we real­ized we both had:

So of course, Shane & I declared motor con­trol design war on Face­book, and fin­ished 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 say­ing that I’ve stuffed Tiny­Husk full of advanced BLDCM/PMSM con­troller things:

  • Six-input PWM so I can leave phas­es undriven (coast­ing, six-step com­mu­ta­tion, etc). Mini­Cob is laid out so that its 6-out­put TIM1/TIM8 PWM mod­ules with dead­time push into the­se pins.
  • Dual-phase cur­rent sense (±66A) via ACS714 bidi­rec­tion­al hall-effect cur­rent sen­sors in par­al­lel with 1mΩ jumpers, simul­ta­ne­ous­ly sam­pled (hells yeah triple ADC) with pow­er bus cur­rent sense pro­vid­ed by two low-side 1mΩ resis­tors in par­al­lel.
  • Volt­age sense on all three phas­es, laid out to hit dif­fer­ent ADCs so I can simul­ta­ne­ous sam­pling as well (not very use­ful, but at least I did it >.>). This is great if I want to do tra­di­tion­al six-step sen­sor­less con­trol.
  • Eigh­teen mul­ti-lay­er ceram­ic 1210 50V 10µF caps. The­se 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 alu­minum caps chill on the side of the board as my L2.

All of this should allow me to do field-ori­ent­ed con­trol (sen­sored or sen­sor­less) with cur­rent (torque-mode) con­trol. Regen­er­a­tive brak­ing, as I under­stand, comes with the pack­age.

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

Unfor­tu­nate­ly 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 Stu­dio before I got shipped out to war an intern­ship in Cali.

How­ev­er, before that, I done spanned a motor! I imple­ment­ed six-step sen­sored com­mu­ta­tion with bipo­lar PWM and ran it up to 32V on a pret­ty bor­ing BLDC motor.

WOOO IT SPINS. By the way, notice that the motor setup isn’t actu­al­ly con­nect­ed to my com­put­er. Wire­less trolling oppor­tu­ni­ties abound. 😉

The phase wave­forms look hot. Text­book BLDC, Shane says. I was lit­tle wor­ried about the reverse volt­age spikes when a phase goes undriven—turns out they’re induc­tive fly­back from the field in the phase col­laps­ing then dump­ing cur­rent into the con­troller, and not some weird PWM glitch.

And some more wave­forms at a low­er duty cycle. Still a nice slope on the undriven phase, though nois­ier. Now this mea­sured at the motor terminals—my controller’s volt­age sam­pling is buffered and low-pass fil­tered, so what it sees will be a lot clean­er.

Regen brak­ing works bril­liant­ly, but big cur­rent changes (like full stop or full reverse) will spike the bus on my pow­er sup­ply and also cause my con­troller 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 log­ic bus­es with the switch­ing wave­form:

DAT NOISE. The top is 5V, the mid­dle is 3.3V, and the bot­tom is PWM out­put going to the dri­ver. Holy crap 3.20V peak-to-peak on my micro­con­troller pow­er sup­ply. Now grant­ed this is rel­a­tive to pow­er ground, not log­ic ground near the micro­con­troller, so it’s a bit exag­ger­at­ed, but still. I think this is my fault; there’s just 10µF of log­ic pow­er capac­i­tance com­ing 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 log­ic sup­ply a lot more sta­ble.

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 sam­pling triple ADC dri­ver for cur­rent con­trol and sen­sor­less six-step, and find­ing a nice elec­tron­ics bench near Cuper­ti­no.

  1. v2.0, since it’s the sec­ond-gen board []