I'm controlling a standards TowerPro SG90 servo engine with my Arduino Uno, simply using the Servor.write() function on pin 3. The thing is that I control my Arduino with a raspberry (python program) via a serial connection. I simply send a number, which gets translated by the Arduino and should then be send via the function.
Problems occur when the changes the servo needs to make come too fast. I get a full error destroying my serial connection and I basically have to reboot my Arduino. Using big number changes (0 deg to 90 deg) is fine, rapid small changes too. It seems that the error occurs when I send a new position when the old position isn't reached yet, as if the servo "isn't done yet".
[my trouble shooting]
I'm using the Arduino to also control three ESC's, for which the Arduino receives the commands from the raspberry in the same messages as the commands for the servo. The ESC's are also controlled using the Servo.writeMocroseconds() which is the core of what the .servo() function does. Controlling the ESC's works just fine!
Just to be sure I've made the signals incremental, meaning the raspberry sends numbers changing only one step at the time, which the Arduino (the signal that will be send to the servo) will approach only one step at the time.
About the serial connection, I've made sure the Raspberry only sends a message after the Arduino has send a message back, and vise versa. So that should eliminate any differences in speed between the two. Secondly, the Arduino only uses the message when it starts and ends with specific characters at specific places, so it shouldn't listen to corrupt messages.
Last, the problem vanishes when I simply take out the power of the servo, leaving everything else the same. This makes me think the problem must be a hardware one, which I find strange since the Arduino shouldn't be affected by the servo.
My theory now is that the Arduino's attempt to change the PWM signal somehow collides with whatever the servo does to the signal.
Does any of you have a clue, and perhaps a solution?