Hi everyone, I'm making a project where I need 2 servos. I got 4 MG995 (Ordered from amazon.ae and they did not come all identical) I chose the most identical ones to use, by identical I mean the speed, gears... but one of the them randomly starts spinning 360° without any apparent reason. I connected each one to a pin of an STM32. There's always the same one that turns 360°. Does someone know what's the issue and how to solve it please !?
Without seeing the code or the wiring diagram it is not possible to help you, otherwise we would have to guess and it is not one of our greatest skills.
If you are expecting to be able to control the angle of the servo rather than its speed and direction then you have got a "continuous rotation servo" (not really a servo at all) rather than an actual servo
How does it behave if you use it with the Servo example from the Servo library ?
@MaximoEsfuerzo The diagram is Red to 5v, (actually using a breadbord power thing but correctly grounded to the STM32) brown to GND, and Orange to a pin on the STM32. For the code, I'm using the knob example from the default servo library, a bit modified to work with the NRF24L01. @UKHeliBob I'm trying to control the angle. The servo even when sitting without any pwm signal change, rotating continuously on its own, even when send another angle to go to. I thought maybe it's a power issue, so I added a 100uF capacitor in the power line of the breadboard, but I did not solve the problem, then I removed the crazy servo and tested with the good one alone, the good one did behave like expected, but when I tried the opposite(remove the good and put the crazy one) it started rotating randomly 360° and it does not stop when I send another angle or press the reset button on the STM32 Board. Only when I unplug it and plug it again from the 5V wire
Sounds like you received a defective servo. Send it back for a replacement.
If a "normal" (standard hobby) servo rotates 360 degrees, it is broken.
Words do not a diagram make.
A 100uF capacitor is not going to fix an inadequate power supply. You need an external power supply for two servos.
I cant send it for replacement
The strange part is that after unplugging it and plugging it again, it knows its position and behaves normally, before going crazy again. It's very unfortunate since I don't have an identical one, since on the 4 servos, one is defective (this one) another is clicking, and the last one has a gray gear and not the same speed...
I have a separate power source, the breadbord thing that's separately plugged to a wall outlet and grounded to the STM32. For the diagram, I cant draw one but I plugged it exactly like I said
Pencil and paper, take a photo and upload it
It is broken, regardless.
It is either broken or you have a "continuous rotation servo". As previously requested, please report what happens when you run the Sweep example using the suspect servo
From what I found the MG995 is NOT a continuous rotation (360 degree) servo. If that's true it's broken. There should be mechanical stops, plus the built-in logic should stop it from going all the way around.
...Another (probably unrelated) possible concern - Is the STM32 a 3.3V device? I think most servos want a 5V data-control pulse.
You are missing the point.
A "continuous rotation servo" can move freely through 360 degrees and keep going round in the same direction forever. It has no mechanical stops and no feedback pot so that its internal electronics can sense its angle
Please run the Sweep example. It will provide clues as to what is going on
Here is the diagram, I hope that the colors are visible. The wires going from the servos to the STM32 are the signal wires, it's just that the colors aren't visible !
@DVDdoug the servos that I have do not have any mechanical stops, even the good ones unfortunately.
Please wait so that I can run the sweep code while you see the diagram
@UKHeliBob The sweep code is working perfectly fine. I think it's a power issue since the servo adds 1deg every 15ms so it's very slow, hence it consumes less. If that's true, how can I slow the servo down when using the knob code, without a for loop because it will stop the whole code until the servo reaches it's position. I think that I'll open the servos and check the pcb (if the pot is well soldered, is the chip well soldered too...) and I'll try resoldering the mis-soldered components on the pcb
Are you saying that using the suspect servo the Sweep example causes it to sweep backwards and forwards, albeit slowly ?
If so, does it move through an arc of 180 degrees or some other angle ?
I did not understand your first sentence, but the servo rotates in a range of 180°
Does the servo move to 0 degrees then sweep to 180 degrees then repeat over and over again ?
Does it behave the same as your other servos ?
Yepp (A bit less than 180 but it's okay). I did not mention this, but when using the sweep code vith a 5V power bank, both the servos went crazy after struggling to move, but when I switched to a more powerful power source, they did both behave like they shoud, so it's most likely a power issue. I'll power both of them with a single 6V regulated LM2596 connected to an AGM battery, so I think that that's solved ! Correct me if I'm wrong, and please give me what are your thoughts if I did not tell you my opinion (the power issue) But I'm still scared to use them, especially the bad one, because I don't want it breaking the mechanism that they'll be linked to ![]()
I told you that 14 posts ago.
