Switching power for a servo

My project includes a servo (microservo SG90) which is used very occasionally. I don't want to keep it powered and buzzing all the time and would like to turn its power on only when needed, using a digital I/O pin. I have checked that it stays put, where I want it, when I unplug it. I have thought of the following solutions: a) a relay b) a transistor (e.g. 2N4401) powered from the Arduino 5V c) a transistor powered externally (or a ULN2803 port)

a) looks like a serious overkill b) would be fairly simple but is it risky? Could this fry the digital output pin? c) is this a good one?

Any other ideas? Thanks for your help!

Some servo motors have a standby mode, when there is no signal received. A Servo.detach() is all that is needed for those. I think the SG90 is not such a servo motor, but could you try it. Perhaps you could also try to make the signal output LOW and check if it is still buzzing.

Perhaps a Servo.attach() after a detach() will set it back to the middle position. I'm not sure about that.

Could you solve the problem of the buzzing ? Perhaps a 1000uF to the power of the servo, or better grounding ?

How do you power the servo motor ? with the Arduino 5V pin ? Do you know the peak current of the servo motor ? I read that the current peak of the SG90 can be 500mA. That is more than the Arduino can supply.

The SG90 can have different brands, what is the brand ?

If you use a NPN or N-channel mosfet to the ground, the servo is no longer connected to ground and the signal might get wrong somehow. I would use a PNP or P-channel mosfet in the 5V power to the servo motor, that can handle 5V and 1 or 2A. And a protection resistor is needed from the Arduino signal pin to the servo, perhaps 1k or so.

What did you pay for the SG90 ? It is 1.60 dollars on Ebay or 1.19 dollars on Aliexpress (and that is inclusive shipping). I think you better buy a good quality servo motor, instead of spending money and a lot of time to make the cheapest servo motor on this planet work better.

Never remove the power from a servo without disconnecting the signal. Best is making the signal pin into an input or setting it low. Otherwise you can get latch up.

I do think all "instructables" articles referencing ULN2803s should be summarily deleted!

Don't try to switch servo power between the servo and servo ground. The servo might be damaged due to current trying to go thru the servo control wire to ground.

The servo power line is noisy so shouldn’t be connected direct to an input (which would be the case
if you used low-side switching for the power).

You can high-side switch using an NPN to level shift and P-MOSFET to do the switching. There are
also dedicated high-side switch chips that do everything in one device.

Many thanks to all for your inputs. That's a lot to digest... What is the issue re: ULN2803?

What is the issue re: ULN2803?

1) It switches the ground line - not good. 2) It is a darlington so when it turns on the servo ground is only at 1.2V, so the signal will be lower than the supply voltage - really not good.

Hi,

My project includes a servo (microservo SG90) which is used very occasionally. I don't want to keep it powered and buzzing all the time and would like to turn its power on only when needed, using a digital I/O pin.

What is your real need here? Is this battery powered? If it's main powered and you don't need the last bit of current saved, the servo "detach" should work OK...