The sketch rotates servo back and forth with buttons. When I rotate servo MG 995/996R 2-4 times Arduino stops working. Its voltage step-down transformer switches from ~9V to ~3.7V which is not enough for Arduino. To make it work again, I must turn off-on the device.

There is no such a glitch with smaller servos such as SG90.

enter image description here

  • Show us your sketch. Throwing an exception in the code has very similar symptoms. I also don't like that your servo ground is connected to the Arduino. It's much safer for it to be completely disconnected and using an optoisolator to send the PWM to it safely. Are you certain that your 12V power supply keeps at 12V when the problem happens? Sep 25 '19 at 9:47
  • " a few rotations" sounds strange, as such a servo can't rotate much more than 180° And I do not see nor understand your term "3.7 V". Please clarify. Sep 25 '19 at 9:58
  • @FilipFranik There is no any exception. As I said, everything perfectly works with smaller servo. Therefore the problem not in the sketch.
    – zhekaus
    Sep 25 '19 at 11:15
  • @DataFiddler I haven't said any about the angle. The bottom transformer set to 9V. After rotations it becomes set to ~3.7V which is not enough to power-up the arduino via VIN pin. And btw, your're wrong about angles. There are servors with greater that 180 rotation.
    – zhekaus
    Sep 25 '19 at 11:17
  • 1
    Test for eventual clarification: What if you don't connect the servo control line (orange) to Arduino D9 ? What if you don't use the two different GND connections (already mentioned) Sep 25 '19 at 13:54

Ground loops can be bad. Do follow up as suggested in the comments regarding ensuring the power supply grounds are the same. To be specific, connecting the power supply grounds through the Arduino is a bad idea! The trace size should not be assumed adequate for the unknown amount of current passing between the ground outputs of the power supplies. And a voltage potential can develop causing the processor to behave unexpectedly or worse burn out components.

Also, consider that some Arduino platforms regulate power to 5 volts on the board and that many servos run fine at 5 volts. If this is true here, you could greatly simplify and possibly solve the describe problem by using a single 5 volt power supply.

Lastly, ensure there is a pull up on the 2 inputs connected to the (assumed) normally-open-momentary-contact switches. There are none in the diagram. So it is assumed pull ups have been activated in the code such as explained here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.