I have an MG996R servo motor connected to an STM32. I am programming the micro with the Arduino programmer.
The servo motor is used to open a lock.
After testing the servo with the lock, because the lock was stuck at certain angles, a noise was coming from the servo and after a few minutes the servo stopped working and it seemed that it was broken (also, smoke came out of it).
Is it possible to stop the servo at angles other than 90°?
Thanks in advance.
A servo is not stopped at a certain degree it is driven to a certain angle by providing a specific duty cycle with the PWM control signal.
On a standard servo the PWM frequency is 50Hz. An on-time of 1ms is full travel in one direction, 2ms is full travel in the other direction, 1.5ms is mid position. For most servos this is 0°, 90°, 180°.
According to the datasheet of your servo it has a travel of ±60°
Read this:
https://www.arduino.cc/reference/en/libraries/servo/
If your gear train breaks and the motor releases its magic smoke just because the lock is a little stuck you're certainly doing something wrong. At least limit the motor current.
Stall current for this motor is 2.5A at 6V.