FFT: drawing the perfect circle using a bunch of random-length sticks

I came up with the idea of expanding the “PID vs ML” article series to seriously investigate what are the real-world possibilities of augmenting classical PID controllers with self-diagnostics capabilities using FFT (unbalanced motor torque, gearbox damage, bearing faults, etc.). Of course my nature immediately kicked in. Instead of just slapping FFT onto the PID routines, calling it a day and ticking the ‘done’ box like a normal person, I did what I always do - tore the whole thing apart into pieces and started cursing stupid imperfection of the real computer world (as opposed to that beautiful, clean mathematical fantasy we all pretend exists). We’re talking about a finite number of samples, precision butchered by IEEE 754 float/double quirks, rounding errors that sneak in like uninvited guests, and … You think I’m nitpicking again…? Yeah, probably. My nature. But hold my coffee - I’ve got a perfect real-world example coming right up that shows why sometimes being this pedantic actually saves your ass. ...

February 23, 2026 · 11 min · Hax0rZmr0cku

„Screw PID, it's for boomers” – challenge accepted (part 3)

As I said in Part 2, I tried to keep it dead simple: how to actually train your own ML model. I know ML purists would call it superficial - but let’s face it: I’m not here to teach you the secrets of deep learning. I want hardware devs to see a real-world way that works on actual silicon – without drowning in theory rabbit holes. Let’s move on. From ONNX to C code – let’s see what X-CUBE-AI does with it Open CubeMX. Make sure you have X-CUBE-AI installed (the add-on that turns ONNX models into C code – the language the MCU compiler actually speaks). It should show up in the Middleware section. Click “Add network”, name it something like “pid”, switch format from Keras to ONNX, browse to your file, set compression and optimization options, then hit “Analyze”. ...

January 23, 2026 · 6 min · Hax0rZmr0cku

„Screw PID, it's for boomers” - challenge accepted (part 2)

As menioned in part 1 I wasn’t in the mood for classic Hardware-in-the-Loop (where the model learns to regulate speed entirely on its own), I took a shortcut. I logged several hundred thousand records of the running PID regulator in different conditions: no load constant load ramping load up ramping load down and a few cases in between All done with simple Python scripts dumping values via UART/DMA. Zero CPU overhead on the MCU side. ...

January 22, 2026 · 4 min · Hax0rZmr0cku

„Screw PID, it's for boomers” - challenge accepted (part 1)

A few days ago someone casually dropped the line online: „f%$# PID, that’s good for boomers.” PID regulation has been the daily bread of process automation for decades. Has something really changed, or are the boomers just stuck in the previous century…? I’ve been doing electronics for a long time, so that jab hit home. I raised my hand and said: „Challenge accepted. Let’s see.” test setup I was already working on a PID regulator for a commercial project. Since commercial projects live and die by price, I picked the cheapest possible MCU that could still do the job: STM32F051 (Cortex-M0, 16 kB Flash). The rest of the hardware: DRV8842 H-bridge driver chip. Hardware setup: DRV8842 driver chip + STM32F051 ...

January 21, 2026 · 3 min · Hax0rZmr0cku