I've set up a PID controller to control the shaft position of a brushed DC motor that I control via PWM and an optical encoder. I'm basically reconstructing an RC servo.
Now that I think I've found the correct tuning parameters (all three parameters non-zero), I'm facing with another problem: the shaft arrives at the desired angle with some approximation (look at the black stick at https://www.instagram.com/p/BTg25HngIDo/), then stops moving further. I hear a "buzzing crescendo" from the motor, that ends after some seconds with it moving a little further, but now too much. So there's another buzzing crescendo, and so on. It almost never reaches the target angle exactly.
By looking at the output/error output, I see that during the buzzing the controller is sending small PWM values, too small to start the motor (as I could experiment by myself, see https://www.instagram.com/p/BQYBZsShq9x/). I guess this is some kind of non-linearity, while a PID can only work with linear processes. Because the motor is stopped at a nearby position, the error accumulates in the I branch and so does the output, until a threshold is reached.
What is the usual approach to solve this issue? I'm thinking about linearizing the output as suggested in this answer (i.e. implementing a "dead zone" function so that the motor never receives small PWM values), but I'm worried that the linearizer will add more independent variables in the system.