out-of-control servos, servo parameters


i have several 180-degree servos elegoo arduino kits, , go out of control when commanded with

     myservo.write(0);

they spin continuously until sent new command.  problem not occur sending 30, 90, 180 degrees, etc.

the problem turns out default parameters in servo package not appropriate these servos.  fixed problem attaching them with

     myservo.attach(3, 800, 2500);

instead of default of

     myservo.attach(3);

the last 2 parameters set width of control pulses in microseconds.  default values, given in servo package documentation, 544 , 2400. 

generic servo documentation says pulse widths should between 1000 , 2000 microseconds, 20 msec period.  using 1000 & 2000 in attach call works, results in less 180 degrees rotation.  adjusting minimum , maximum pulse widths lets control both range of motion , location of endpoints in standard servo.write(...) call. 

the exact parameters vary manufacturer manufacturer, , possibly within individual devices, since control hardware analog circuitry.  specific devices have labeled ""tower pro micro-serv 99  sg99".  presumably using 544 zero-point rotates motor past point @ internal comparison voltage wraps around, causing device think @ 180 degrees instead of 0, , starting new rotation.  using 800 , 2500 keeps device in range.

interestingly, "sweep.ino" tutorial works these devices, because after slewing motor down 0 degrees, starts sweeping in positive direction.  adding delay when device reaches 0 sends motors spinning out of control.  sweep rotates bit more 180 degrees default parameters.



Arduino Forum > Using Arduino > Motors, Mechanics, and Power (Moderator: fabioc84) > out-of-control servos, servo parameters


arduino

Comments

Popular posts from this blog

Error compiling for board Arduino/Genuino Uno.

Installation database is corrupt

esp8266 (nodemcu 0.9) client.write très lent ???