Is there a time limit between servo position changes?
Ragtop
Posts: 406
Thanks to octanetripledax I am trying to move the mouth of my halloween project in relation to audio that is being processed through a ADC.
I know the servo is limited to how fast it can move from position to position, but at times it just seems locked up. The longer I make waitcnt(clkfreq/15 + cnt) the better it gets, but it still seems to not move as often as mouthposition is changing.
I am assuming because the servo is reading pulses, there has to be some time period between changing the pulse widths?
I am using a JrSport ST126MG at 6v.
repeat while routine < 90 'servo mouth action routine++ if routine == 50 outa[barking] := 0 'give the pin a period of being on to trigger mp3 and reset to zero now waitcnt(clkfreq/15 + cnt) volume := ADC.getval(0) case volume 30..46: mouthposition := 158 + (43-volume) 'closed 43..49: mouthposition := 155 'center 50..70: mouthposition := 155 - (2*(volume-49)) 'open
I know the servo is limited to how fast it can move from position to position, but at times it just seems locked up. The longer I make waitcnt(clkfreq/15 + cnt) the better it gets, but it still seems to not move as often as mouthposition is changing.
I am assuming because the servo is reading pulses, there has to be some time period between changing the pulse widths?
I am using a JrSport ST126MG at 6v.
Comments
What happens when volume is below 30 or above 70?
It should keep the last valid position. The audio file I am sending it had a high of 70 and a low of 30 with ~46 when no sound is being played when I viewed the value changes in viewport.
I could add two more case lines to cover values outside that range with a set fully closed or open value.
http://www.scary-terry.com/audioservo/audioservo.htm
Works very well, and there are some upgrades and a way to edit your audio to produce better results.
Jim