Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 5 months ago.
Servo only move 90 deg
Hi Simon
I have tested the servotest program, but it only move 90deg with value 0.0 - 1.0
I have also try to use -1.0 - 1.0... but seems to ignore values <0
can you help me :-)
Best regards
Tue
Do you have some way of examining the PWM waveform that is controlling the servo?
posted by Stephen Paulger 29 Jul 2015Yes! period= 20ms pulswidth 0.0= 1ms, 0.5= 1,5ms 1,0= 2ms
posted by Tue Myren 29 Jul 2015It may be because the PWM output is only 3,3v?? But movement is not random, but always 0 - 90deg, so it seems it is not the problem
posted by Tue Myren 29 Jul 2015Funny... I found this video... only moving 90deg ?? https://www.youtube.com/watch?v=_OXCMLXBIdE
posted by Tue Myren 29 Jul 2015you probably need to do the following
myservo.calibrate((float)range,(float)degrees);
Check Servo.h and Servo.cpp in Simon's api page
https://developer.mbed.org/users/simon/code/Servo/#36b69a7ced07
Regards Martin
PS default is mid range 45degs +/- would give 90 degs over all
posted by Martin Simpson 29 Jul 2015Hi Martin I dont think you are right... a servo move 180deg. http://www.mitchr.me/SS/batteriesRequired/RCcontrolTheory/ I will try the calibrate method! Regards
Tue
posted by Tue Myren 29 Jul 2015Your servo may be Capable of moving 180degs but you have to calibrate
servo.h Defaults to 1.5ms mid range */- 0.5ms or a range of 1.0 to 2.0ms and that is translated as +/-45 or 90degs
posted by Martin Simpson 29 Jul 2015Hmm... i tried something like this, but it still ignore 180deg... so I doubt the library can move the servo 180deg
myservo.calibrate(0.0005, 180.0);
while(1) { myservo.position(0.0); wait(1); myservo.position(45.0); wait(1); myservo.position(90.0); wait(1); myservo.position(135.0); wait(1); myservo.position(180.0); wait(1); }
posted by Tue Myren 29 Jul 2015Hi Again I tried another library (Servo on any pin)... it works!... because I can go from 8ms to 2,5ms So I am able to control the movement exactly as i want
Regards
Tue
Servo Servo1(p21);
int main() { Servo1.Enable(1650,20000); Set the start position in us (1,65ms) and the period (20ms)
while(1) { Servo1.SetPosition(800); Set 0deg for my servo wait(1); Servo1.SetPosition(1650); Set 90deg for my servo wait(1); Servo1.SetPosition(2500); Set 180deg for my servo wait(1); } }
posted by Tue Myren 29 Jul 2015good so you could use from the original:- Servo1.calibrate(0.00085,90.0); and change lines 44 and 50 of Simon's Servo.cpp from 0.0015 to 0.00165 (would be better if this was more generic in the source library) This would have allowed the full range for your servo for the 0 to 1.0 ranging
kind regards
posted by Martin Simpson 29 Jul 2015