Only give power to the servo when needed

Hey guys,

I'm building a small device with a servo. It runs on battery so I want to save as much power as I can. Because of this I want to only give the servo current when I actually need to move it (There will be no power needed to keep the servo in place as there is no load on it).

So how do I only give power to the servo when I need it? I just need help in the electronic aspect, the programming shouldn't be a problem.

So I had two ideas:

  1. I just wire the 5v from the servo to an output pin and write a HIGH on that pin when I need it.
  2. I use a optocoupler to trigger pin 3 and 4 of it. To that pins I would attach the 5v line to the servo.

I'm not sure if either of this would work...

Thanks for any help

EDIT:
did some more research and found out that I could use a transistor for this operation, is that correct?

Servos take way more current than a microcontroller pin can source - never directly
power a servo from an Arduino pin, you'll burn it out.

You need some switching device that is capable of handling the current - thus you
need to know the current the servo takes - could measure it while stalling the servo
arm (though this might strip the gears).

For a small hobby servo you could estimate the current as about 1A.

So you then need a high-side switching device capable of that current. PNP switching
transistor or logic-level p-chan MOSFET are the obvious candidates. There aren't
many PNP switching devices that can switch 1A without needing at least 50mA base current,
which is above the absolute maximum for an Arduino pin.

logic-level p-channel MOSFET would seem a good choice.

Hmm I actually already wired it directly to the arduino pin and it worked fine :sweat_smile:

I will have a look into MOSFET, thanks

EDIT:

and there are actually a lot of tutorials wiring the servo directly ...
for example this here: http://ftp.isr.ist.utl.pt/pub/roswiki/rosserial_arduino(2f)Tutorials(2f)Servo(20)Controller.html

That example shows the servo being powered from the 5V rail, not an Arduino output pin.

(That's also a bad idea, not recommended)

There are a lot of tutorials out there, not all of them are great...

Ah, that's what i meant, i wired it to the 5v pin. Why is this a bad idea?

Thanks

Firstly the regulator on the Arduino will overheat and shutdown if you draw an
amp from it for any length of time. You might even damage it. You're likely to see
the 5V rail droop everytime the motor moves and it may cause the Arduino to reset
too.

Secondly the servo contains a motor, a motor is inductive and could be putting a
lot of noise and even large voltage spikes back onto the supply (though hopefully
there's enough protection on the servo to limit that). The absolute maximum
supply voltage for the Arduino is 6V, doesn't take that big a spike to push 5V rail
above this.

An Arduino pin can safely source 30mA or so (40mA is the absolute maximum)
so you really cannot hope to power a servo from one.

MarkT:
So you then need a high-side switching device capable of that current.

Can't / shouldn't switch the low side?

Open the ground wire on a servo and current may start flowing from the servo control line back to the servo possibly causing heating in the servo (been there, done that).

MarkT I am agree with that person about that topic.
MarkT have good experience!

zoomkat:
Open the ground wire on a servo and current may start flowing from the servo control line back to the servo possibly causing heating in the servo (been there, done that).

Thank you for the reply. Is there a problem if the signal is set to high impedance before disconnecting the servo's ground?