Skip to main content
geeks have feelings

BabyCorntrolling

So I totally ditched Corntroller for its hot redesigned (square!) little sibling, BabyCorntroller.

BabyCorntroller!

The control (corntrol?) logic board is called MiniCob*. I shrunk down Corntroller’s Tassel from credit card size (3.4″ × 2.1″) to just 1.95″ × 1.95″, while adding a wireless radio, doubling the number of power stages and analog frontends (so I can control two motors), and still keeping the micro-SD card slot. Oh, and going from a four-layer to two-layer layout yet keeping all components on one side.

MiniCob layout

To perform this miniaturization magic, I switched from the 100-pin STM32F103VG to a 64-pin STM32F205RC, which has more flexible pin assignments (every GPIO pin can be muxed to a variety of peripheral functions), supports bootloading on IO interfaces other 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 actually 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 Shenzhen-direct PCB services, in case I want to make like, ten of these.

Meanwhile, the power stage/analog frontend board (HexHusk -> TinyHusk) got a makeover as well. Though Corntroller is a blatant and outright intentional (and very poorly done) clone of 3ph Duo, BabyCorntroller is merely a blatant and accidental clone of Flying Flux. Shane and I had both started our boards before we realized we both had:

So of course, Shane & I declared motor control design war on Facebook, and finished our boards in record time. Think hackathons, except with hardware, less sleeping, and a whole week in length.

TinyHusk layout

It also goes without saying that I’ve stuffed TinyHusk full of advanced BLDCM/PMSM controller things:

All of this should allow me to do field-oriented control (sensored or sensorless) with current (torque-mode) control. Regenerative braking, as I understand, comes with the package.

So all this functionality is laid out onto 16 pins on the left side of TinyHusk. So what’s the right-side 16-pin header on MiniCob for? It’s a friggin’ second motor’s worth of pins! It’s rotated 180 degrees so that I can stack two TinyHusks onto one MiniCob, and just rotate one husk board so that they use different headers.

DAT STACK

Unfortunately because of school, I didn’t have time to test BabyCorntroller until finals week. So I had less than a week to run them in the Invention Studio before I got shipped out to war an internship in California.

However, before that, I done spant a motor! I implemented six-step sensored commutation with bipolar PWM and ran it up to 32V on a pretty boring BLDC motor.

v9r7dk_m11U thumbnail

WOOO IT SPINS. By the way, notice that the motor setup isn’t actually connected to my computer. Wireless trolling opportunities abound. 😉

Full duty commutation

The phase waveforms look hot. Textbook BLDC, Shane says. I was little worried about the reverse voltage spikes when a phase goes undriven—turns out they’re inductive flyback from the field in the phase collapsing then dumping current into the controller, and not some weird PWM glitch.

Low duty commutation

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

Regen braking works brilliantly, 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 detection kicking in, so I scoped my 5V and 3.3V logic buses with the switching waveform:

Logic power noise

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 microcontroller power supply. Now granted this is relative to power ground, not logic ground near the microcontroller, so it’s a bit exaggerated, but still. I think this is my fault; there’s just 10μF of logic power capacitance 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 implementing rotor angle extrapolation to do leading phase advance, writing a simultaneous sampling triple ADC driver for current control and sensorless six-step, and finding a nice electronics bench near Cupertino.

Every Post by Year

  1. 2023
    1. Ducati Timing Belt Replacement
    2. C++ Corrections
  2. 2016
    1. Liftlord
    2. Sensorless Brushless Can’t Even
  3. 2015
    1. Big Data: Test & Refresh
  4. 2014
    1. The Orange Involute
    2. Big Data EVT
  5. 2013
    1. Integer Arithmetic Continued
    2. Real Talk: Integer Arithmetic
    3. Why Microsoft’s 3D Printing Rocks
    4. Flapjack Stator Thoughts
    5. Delicious Axial Flux Flapjack
  6. 2012
    1. How to teach how to PCB?
    2. Fixed-point atan2
    3. It Was Never About the Mileage
    4. Trayrace
    5. BabyCorntrolling
    6. Conkers
    7. BabyCorntroller
    8. Templated numerical integrators in C++
  7. 2011
    1. Bringing up Corntroller
    2. Assembly-izing Tassel
    3. Corn-Troller: Tassel
    4. 5 V to 3.3 V with Preferred Resistors
  8. 2010
    1. HÄRDBÖRD: Interesting Bits
    2. HÄRDBÖRD: Hardcore Electric Longboard
    3. Mistakes to Make on a Raytracer
    4. US International Dvorak
  9. 2009
    1. Raxo
    2. Better Spheres, Fewer Triangles
    3. Donald Knuth Finally Sells Out
    4. Harpy – Sumo Bots 2009