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

real-time with Raspberry Pi

In the previous post I described a PID controller tested with randomly generated data in a controlled range. The simulation phase is now complete and the results look promising. Time to move to real hardware: connecting the algorithm to an actual pH probe. critical requirement: galvanic isolation Due to very low signal levels and extremely high input impedance of typical pH electrodes, full galvanic isolation between the probe circuitry and the rest of the system is mandatory. Any ground loop or leakage current destroys measurement accuracy. ...

March 29, 2025 · 3 min · Hax0rZmr0cku

dsp in pid regulators

Recently, I have been developing a PID controller class for my Qt projects. During implementation, I encountered a very interesting problem from the field of signal theory that I believe is worth sharing. A classic PID controller works in fixed time steps dt. At each step it compares the current process value with the setpoint, considers the previous value and computes the output. And right here the first serious problem shows up - the inertia inherent in real-world measurement system. ...

March 27, 2025 · 4 min · Hax0rZmr0cku

the real embedded project lifecycle - beyond influencer hype

New MCU on the market? Cue the influencer unboxing frenzy. Meanwhile in real commercial projects? Nobody cares about the hype. Here’s what actually happens when you take an embedded product from idea to mass production. Market trends are just one factor – and usually not even the most important one. The consecutive iteration of a prototype that gives satisfactory results is ready for extensive testings define the scope of the project Everything starts with a meeting with the product manager. ...

February 28, 2025 · 5 min · Hax0rZmr0cku

malloc() in embedded systems: curse or blessing? (5-byte case study)

Most embedded developers treat malloc() like a poison: “Tiny RAM + dynamic allocation = instant disaster”. But is this really true? Let me show you a real project where malloc() made life’s better. a real project: a real case One of my recent projects was a fertilizer mixer controller. Its job is to mix fertilizers and acid with water to achieve the desired electroconductivity and pH for irrigation in the field. During feature research, one obvious requirement emerged: recipe selection based on timetables. ...

January 30, 2025 · 3 min · Hax0rZmr0cku