Go Down

Topic: How to prevent stall on servo when returning to position 0 (Read 3695 times) previous topic - next topic


nerixs ..... in general, it's best to start a new thread and then ask your question in the new thread. Maybe you have done that already by now.

the writeMicroseconds function takes in a value between say 1000 and 2000, with the middle position between 1500. The units of these values are in microseconds. If the typical servo has 90 degrees as the middle position, then put in a value of '1500'. If you put in a value of 2000 instead, then the servo would move to one of the max limits .... possibly 180 degree. And putting in 1000 would move to the other limit...such as 0 degree.

The actual 'physical' angle that the servo shaft will move may depend on the quality and type of servo. A super cheap 'toy' servo might not 'actually' move to 180 degree if you write '2000' microseconds. Instead....it might move to some angle below 180 degree. Whereas a relatively more expensive servo may move really close to 180 degree if you write '2000'.

The 'write' (not writeMicroseconds) function is a higher level function which is supposed to handle the 'angle'. It allows you to put values like '90' or '180' etc units of degrees into the 'write' function. However, the control of these sorts of servos are really based on the duration (pulse width) of a square pulse waveform. So if the actual servo you have doesn't truly have physical movable limits of 0 degrees and 180 degrees, then putting in a value of 0 or 180 into the 'write' function might not actually give you physical 0 degrees or physical 180 degrees on the actual servo.

I think the same thing applies to the writeMicroseconds function. That is.... sure, we could put in a microseconds value of 2000 .... but the servo might not go to 180 degrees if the actual servo motor doesn't actually cover up to 180 degrees (physically).

In my code, I remember I got the code from somewhere, and just modified it a bit. The lines where it has writeMicroseconds should all be writeMicroseconds --- which I've now corrected. So the 'write' that was there is now changed to writeMicroseconds.

You have chosen 100 as the starting value.
The code came from the internet somewhere. You can choose any suitable starting value, and you can also choose any suitable incrementing value. If you wanted to start from 1000, then that's ok too. And you the increment could be '50' instead of '64'.

Go Up