Week of 3/3
- lincolndbell9
- Mar 6
- 1 min read
This week I continued trying to get my PID balance ramp to work. Originally, I was trying to use a quadratic equation to control my servo's position, so that the further the ball got from the sensor, the more of a response the servo would give, which I thought would keep it in the center.
This didn't work, because I didn't realize that the servo was already moving at its fastest speed, and so trying to make it go even faster was not possible, and the result was the exact same as the function I was using before, which just moved the servo 1 tick for every millimeter the ball moved.
I've moved on to trying to make my own PD controller from scratch, which combines my original code with another function that will account for the speed of the ball and react to that instead of just the balls position.



I decided to with with PD controller, as I don't think that I'll need to use Integer values in the final version. With a PD controller, the microcontroller takes the proportional data (changing the motor's position up and down based on the distance of the ball from the sensor) and the Derivitive, which takes the ball's speed and adds it to the variable that controls the servo's position. This means that the motor will still oscillate back and forth. but will move faster when the ball speeds up, causing it to rest in the center



Comments