Hello! Unfortunately, my micro servo responds inconsistently to commands. Is there a way to fix the micro servo?
It worked perfectly fine for a year, but just recently it has become “lazy” and only drives to the correct position sometimes. In this video, the intended operation is for the servo to move about 15 degrees counterclockwise while I am holding down the push button. As you can see, it gets stuck at random, and I need to manually wiggle the gear to free it. Then, it works for a few more commands until it gets stuck again.
I didn’t change anything about my circuit since I first started using it, and the circuit works perfectly when I swap my old servo for a new one. Therefore, the issue must be my old micro servo itself; I’m hoping there’s a way to fix it.
Specifications:
-Microcontroller: Elegoo Arduino Uno R3
-Micro Servo: SMRAZA Micro Servo 9g S51
-Power Source for Servo: USB+5V
"stuck" could be the way your button is configured and your button-press routine with a bouncing button press telling the servo to start/stop many times. Here is a simulation of reading button presses... buttonPress - Wokwi ESP32, STM32, Arduino Simulator
Your code solution could be better, but the main fault is the cheap servo. It lasted a year? That's it's life. Either replace with more every year, or buy higher quality like those used in 3D printers.
#include <Servo.h> // Library for controlling servos
Servo Servo1; // Establish the Jaw servo and its default value.
int Button = A0; // Button is in port A0.
int valButton = 0; // Set initial value of button to 0
void setup() {
Serial.begin(9600);
Servo1.attach(10);
delay(1000);
}
void loop(){
valButton = digitalRead(Button);
if (valButton<1){
Servo1.write(90);
}
if (valButton>0){
Servo1.write(105);
}
}