Youtube

How to properly tune a PID

There are hundreds of guides on the Internet on how to adjust a PID and they can all be summarized in the following simple steps:

  • Set KD and KI to zero and increase KP until the system corrects the error and starts oscillating. That would be the maximum KP
  • Increase KD until the KP oscillation stops.
  • Increase KI slightly so that the system fully corrects the error.

They seem like three simple and quick steps, but the reality is that in the end it becomes a sort of trying to guess the constants and after hundreds of tests and hours, if you are lucky, you get a relatively stable PID. It is a rather cumbersome task that rarely achieves a completely satisfactory result.

Let's forget about all that and try to obtain KP and KD mathematically.


PID comparison video

New version of the 3D encoder parts


LibreServo encoder assembly video

To know the position of the servomotor axis, LibreServo uses the AEAT-8800 16-bit encoder. This encoder replaces the potentiometer that the servomotors have and with it we get much more precision and allows the servomotor to rotate 360 degrees.

To achieve this, LibreServo makes use of a tiny 10.2x11.2 mm PCB to which a 3D printed part of the same size and shape as the original potentiometer is attached. This 3D printed part consists of 3 small parts, a 4x7x2mm bearing and a small 6x2.5mm diametrically magnetized magnet. Only a glue point is needed to fix the magnet. The rest of the parts, bearing and PCB are designed to be snap-fitted and fixed.

Last steps for first official release


Music with LibreServo

Although I had many parts of the code already done, the truth is that putting all the code together and making all the functions and internal structure non-blocking has been a much more laborious task than expected. In addition, I have programmed dozens of commands and the first version of the LibreServo Software is much more complete than I had originally anticipated.

We have a winner. Test results in PCB test 2


LibreServo sending data via RS485 to Arduino plotter

After several tests, the LibreServo hardware is finally chosen and it's working, even the H-bridge that gave me a lot of problems! In general, all the parts of LibreServo remain as they were, because they were already working correctly, except the parts are discussed in this article.

New PCB Test v2 for LibreServo


Hello World in LibreServo PCB test v2

A month ago I was analyzing the results and conclusions obtained with the LibreServo test PCB v1 and trying not to lose momentum this month I have designed, I have ordered new PCBs and I have already assembled the LibreServo test PCB v2! 🥳

It is the first PCB that I have designed with 4 layers for LibreServo and I hope that this will mitigates some issues with the H-bridge that I think comes, in part, from electronic noise. For the rest, it is a PCB with the final components, it is closer to the final design in which I have forced myself to put the components as close as possible to each other to see the real limit between what is designed and what can be easily welded without overcomplicating things, everything holds up on paper but then you have to bring it to reality.