controlling a servo

Im under the assumption that a servo is always on so if this is the case and I have a project that there will be times when I don't want to use the servo for several days I don't want to ware the servo out. Instead of powering the servo from the 5 volt pin can I power it from another pin and in the sketch when I want to use the servo I will first set that pin high.
Rick

No, you cannot power a servo from a digital I/O pin.

Trickyrick:
Im under the assumption that a servo is always on so if this is the case and I have a project that there will be times when I don't want to use the servo for several days I don't want to ware the servo out. Instead of powering the servo from the 5 volt pin can I power it from another pin and in the sketch when I want to use the servo I will first set that pin high.
Rick

All true, except the part about "powering" the servo from an Arduino pin. Unless the servo is tiny, perhaps a low power RC servo, you must power the servo separately. You may use an arduino pin to control the power to the servo using a relay or a MOSFET as a switch.

Paul

(deleted)

The servo is a tiny RC servo Im powering in now on the 5 volt power pin on the arduino so I thought I could power it from another pin that I could turn on and off with the sketch
. Is this not right

Trickyrick:
The servo is a tiny RC servo Im powering in now on the 5 volt power pin on the arduino so I thought I could power it from another pin. Is this not right

Does it consume, under load, CONSIDERABLY less than 40mA?

Nope looked up specs for my servo its a Tower Pro MG996R it states running current as 500mA

So I suppose I can use a TIP 122 NPN transistor to power the servo.

So in the sketch is that what I do
Just before I want to use the servo I write the pin high then rotate the servo then write the pin low

Will that work

You may need a PNP or P channel transistor as a high side switch for the servo power. The electronics in the servo may not like having ground switched.

Thanks
Ive never use a PNP
Is this right
An NPN switches the neg side of the circuit on when you apply voltage to the base of the transistor
An PNP switches the pos side of the circuit but on when there is no voltage applied to the base
Can you suggest what PNP to get
Thanks
Rick

Trickyrick:
Nope looked up specs for my servo its a Tower Pro MG996R it states running current as 500mA

So I suppose I can use a TIP 122 NPN transistor to power the servo.

So in the sketch is that what I do
Just before I want to use the servo I write the pin high then rotate the servo then write the pin low

Will that work

Will work, unless you want the servo to stay in that position.

Paul

Thanks Paul
So using a PNP transistor to power the servo will not keep it in position
The sketch is turning on the servo and then turning it 180 degrees then back to 0 then powering off the servo. Y will it now stay in place

If the servo is not powered any load applied to the servo arm can move it round (and may damage the servo). Without power the servo cannot control its position.

Steve

Trickyrick:
Nope looked up specs for my servo its a Tower Pro MG996R it states running current as 500mA

So I suppose I can use a TIP 122 NPN transistor to power the servo.

Only the stall current is relevant, and that's 2.5Amp for this servo.

Nope, you need to switch high-side (supply +), with a PNP transistor or p-channel fet or relay.
Third diagram.
Leo..

Thanks Guys
There is no load on the servo when its off. I'm using it to pull the flapper up in a toilet and a z wave momentary switch as the push button to start the servo connected to a google home to flush the toilet. I think that Im going to use a Mosfet N Channel IRF630 to power the servo on and off.

I think that Im going to use a Mosfet N Channel IRF630 to power the servo on and off.

Have you looked at the data sheet for the IRF630 data sheet.

RDS(on) Static drain-source on resistance VGS= 10V, ID= 4.5A ----0.35Ω

That is not a logic level MOSFET. Look for a MOSFET that has the Vgs spec at 5V or less.

That said, I think that you should reconsider using an N channel low side switch. Read this post. Google "arduino servo low side switch" for more information.

groundFungus:
That said, I think that you should reconsider using an N channel low side switch.

That would put negative 5volt on the control pin of the servo when the n-channel mosfet is off.
Not sure if the servo would like that.
Leo..

I said that poorly. I meant that he should not use a low side switch as pointed out in the linked page.