I am trying to move a servo by an outside force, but it is locked in place. Is it possible for me to unlock it?
Use the detach() function but be aware that servos are not generally designed to be moved to a new position by rotating their output shaft so it could be damaged,
Be aware also that when you attach() the servo again it will immediately move to the most recently commanded angle
Oh ok thanks!
If I detach the servo, the arduino wouldn't be able to move it right?
Not until you attach() it again, but note the warning in my previous post
If it's an RC servo you'll grind it's teeth, with or without detach(). You must remove power, otherwise it's most likely dead servo turning ...
Is there a way to do this through the code?
Not so
If you detach() a servo then it can be moved by turning its output shaft even if still powered. Whether this is a good idea is another matter
Is that quite right?
If you manage to move a servo by hand then the feedback resistor is also moved. So on reattachment, after a power cycle, the servo will move to the default position that the servo library uses. If you don't use a power cycle then yes it will return to the last commanded angle.
This is because the Arduino has no way of actually measuring the value of the feedback resistor. The much misunderstood servo.read command
Only returns the value which was last sent by the Arduino to the servo.
The reason servos are easily damaged when move by hand is that they all contain a worm gear. If it is a metal worm gear then you probably will not be able to move it by hand, and if it is a plastic gear then you probably can only move it by the gear skipping threads. Which results in none fatal damage for a while, and then will eventually fail due to a stripped thread.
You could measure the current drawn by the serve to detect an overload condition. E.g. HiTec https://hitecrcd.com does this on their programmable servo lines.
I was specifically talking about what happened if you attach a servo, write an angle, detach the servo, move it by hand and then attach it again.
That does not involve a power cycle
Whether or not you power cycle the servo should make no difference in the position it is moved to when reattached, that should only depend on the pulse width being sent by the servo library. Power cycling the arduino itself would of course set the position back to default, unless the last commanded position was saved in EEPROM or other non-volatile storage and set in the servo library before attaching.
Sorry to spoil the fun, but these are all assumptions. Your servos datasheet tells you if it has a failsave behaviour (power off, position hold, failsave position) that is programmable or not. Generic "brand names" are just vapourware, you need tolook what you have - and the datasheet is most likely written in chinese.
Oh, and rc-servos do not have a worm gear.
Often the first gears are metal. The last gears are nylon. Those may easily loose teeth...
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.