In the thread Unique Servo Control Requirement rob43 reported that on an 08M2 at the default 4MHz with the servo output on pin C.4 when servos were held at a stationary position they were "twitching" every 1-2s.
This prompted me to investigate servo twitching and this thread is to describe what I found and give the results of the testing I did.
I am only documenting the twitching that occurs continuously while the servo is in a fixed position. I have ignored the twitches that can occur when a new program is downloaded.
Here is a video of the showing the most comment type of twitching I've observed. This example occurs with a period of about 1s but the twitches can occur once per 1s, once per 2s, once per 4s, once per 8s and about 5 times per 1s.
⦁ Note: This means that if you are moving the servo by changing its position more frequenty than the glitch occurs then you may not get any twitching. I did not try to test this proposition.

These are screenshots from the servo signal captured using DPScope:
This screenshot above shows the normal servo pulse

This screenshot shows one of the glitches I captured

This screenshot shows a second type of glitch that that was captured.

These may not be all the possible glitches because we are not capturing all the servo pulses with DPScope.
⦁ The servo pulses are happening at 50 times per second.
⦁ DPScope is refreshing the screen at 40 times per second, so is sampling the servo pulses.
⦁ The Windows video capture is at 30 frames per second, so is sampling the DPScope screen.
Summary
⦁ With the sole exception of the 28X2, I have observed the servo twitching on all the other X2 & M2 chips I own, 08M2, 14M2, 18M2 and 20X2. All my M2 & X2 chips have the current firmware version listed on picaxe.com.
⦁ On the chips where twitching does occur, the combination of some pins, some SERVO settings & some CPU frequencies twitch while others do not.
⦁ On the 28X2 I did some more detailed testing and still did not see any twitching
⦁ Servos have different sensitivities to glitches in the signal. I test with a very old Futaba FP-S148 standard sized analog servo and a current Emax ES 9051 micro digital servo and on some tests where my analog servo was twitching I could not detect my digital servo twitching. This occurred in rob43's original thread where his servo had a distinct twitch at 4MHz that I was not able to reproduce using the same code, pin & CPU frequency but I was able to reproduce it at 16MHz and I attribute this to my servos having a different sensitivity to rob43's.
⦁ My results only apply to the servos I have tested. You cannot assume my results will apply to your servos. You will have to test them to find out for yourself.
⦁ My results also only apply to the very simple test programs I have used. When I repeated my tests with different programs I sometimes got different results, so you should not assume my results will apply to your program, even if you are using one of the servos that I tested with.
⦁ I did not test on a 20M2 or 40X2 chip. If you are using one of these chips then you will have to test them to find out for yourself. However, I found this post on another forum discussing servo twitches using the 40X2 chip https://community.robotshop.com/forum/t/picaxe-40x2-servo-control/9173/2
⦁ I've only tested at limited set of servo positions, 100, 110, 120, etc, so I don't know whether there will be glitches between these tests at 111, 112, 113, etc
I plan to do some more posts in this thread:
⦁ This first post is the overview with my summary.
⦁ The second post will give the results of my testing on all the chips I own.
⦁ The third post will give the results of my testing showing that changing the main program can change the glitching behaviour when using both SERVO and SERVOPOS
⦁ The fourth post will discuss possible workarounds when using SERVO+SERVOPOS and provide links to the alternative techniques for driving servos using the PULSOUT+PAUSEUS, PULSOUT+SANDWICH TIMER or PWMOUT+PWMDUTY commands.
⦁ The fifth post describes a fix for the servo kick that happens when power is first applied to the servo.
EDITED: Added the PULSOUT+SANDWICH TIMER technique
EDITED: Updated the description for my fifth post.
This prompted me to investigate servo twitching and this thread is to describe what I found and give the results of the testing I did.
I am only documenting the twitching that occurs continuously while the servo is in a fixed position. I have ignored the twitches that can occur when a new program is downloaded.
Here is a video of the showing the most comment type of twitching I've observed. This example occurs with a period of about 1s but the twitches can occur once per 1s, once per 2s, once per 4s, once per 8s and about 5 times per 1s.
⦁ Note: This means that if you are moving the servo by changing its position more frequenty than the glitch occurs then you may not get any twitching. I did not try to test this proposition.

These are screenshots from the servo signal captured using DPScope:
This screenshot above shows the normal servo pulse

This screenshot shows one of the glitches I captured

This screenshot shows a second type of glitch that that was captured.

These may not be all the possible glitches because we are not capturing all the servo pulses with DPScope.
⦁ The servo pulses are happening at 50 times per second.
⦁ DPScope is refreshing the screen at 40 times per second, so is sampling the servo pulses.
⦁ The Windows video capture is at 30 frames per second, so is sampling the DPScope screen.
Summary
⦁ With the sole exception of the 28X2, I have observed the servo twitching on all the other X2 & M2 chips I own, 08M2, 14M2, 18M2 and 20X2. All my M2 & X2 chips have the current firmware version listed on picaxe.com.
⦁ On the chips where twitching does occur, the combination of some pins, some SERVO settings & some CPU frequencies twitch while others do not.
⦁ On the 28X2 I did some more detailed testing and still did not see any twitching
⦁ Servos have different sensitivities to glitches in the signal. I test with a very old Futaba FP-S148 standard sized analog servo and a current Emax ES 9051 micro digital servo and on some tests where my analog servo was twitching I could not detect my digital servo twitching. This occurred in rob43's original thread where his servo had a distinct twitch at 4MHz that I was not able to reproduce using the same code, pin & CPU frequency but I was able to reproduce it at 16MHz and I attribute this to my servos having a different sensitivity to rob43's.
⦁ My results only apply to the servos I have tested. You cannot assume my results will apply to your servos. You will have to test them to find out for yourself.
⦁ My results also only apply to the very simple test programs I have used. When I repeated my tests with different programs I sometimes got different results, so you should not assume my results will apply to your program, even if you are using one of the servos that I tested with.
⦁ I did not test on a 20M2 or 40X2 chip. If you are using one of these chips then you will have to test them to find out for yourself. However, I found this post on another forum discussing servo twitches using the 40X2 chip https://community.robotshop.com/forum/t/picaxe-40x2-servo-control/9173/2
⦁ I've only tested at limited set of servo positions, 100, 110, 120, etc, so I don't know whether there will be glitches between these tests at 111, 112, 113, etc
I plan to do some more posts in this thread:
⦁ This first post is the overview with my summary.
⦁ The second post will give the results of my testing on all the chips I own.
⦁ The third post will give the results of my testing showing that changing the main program can change the glitching behaviour when using both SERVO and SERVOPOS
⦁ The fourth post will discuss possible workarounds when using SERVO+SERVOPOS and provide links to the alternative techniques for driving servos using the PULSOUT+PAUSEUS, PULSOUT+SANDWICH TIMER or PWMOUT+PWMDUTY commands.
⦁ The fifth post describes a fix for the servo kick that happens when power is first applied to the servo.
EDITED: Added the PULSOUT+SANDWICH TIMER technique
EDITED: Updated the description for my fifth post.
Last edited:
