# creating a switch using arduino's digital outputs

I'm trying to charge a simple servo that only has + and - pins. Usually I would connect it's - pin to the ground and + pin to the digital output from Arduino. This works, but the servo turns weakly and can be stopped by hand. If i connect the servo directly to the battery or to 3.3 pin from the Arduino it turns strongly and i cannot stop it.

I tried an op-amp amplifier and a PMOS transistor in order to let the servo get power from 3.3V or the battery, but didn't work out.

Anyone has already did something similar and can share with me his/her design?

----- edit: this is the servo i'm talking about. https://solarbotics.com/product/gm20/

----- update: Now that I have worked on more projects, I think this kind of task should be done through an H Bridge as explained here: http://www.instructables.com/id/H-Bridge-on-a-Breadboard/ I tried it (obviously for another project) and it worked like a charm!

• For now stop directly connecting the servo to your Arduino. Let's make sure you do right things before you kill it. May 12 '13 at 8:53
• Please add a datasheet or at least a picture of your servo. Edit your question, hit Ctrl-M and add a circuit diagram of how you are connecting things together. May 12 '13 at 8:54
• If you use '@jippie' in a comment, I will be notified. May 12 '13 at 8:55
• I don't think you're using the word "servo" correctly, What is sounds like you have is a motor or some sort of actuator. May 12 '13 at 10:54
• @himura - Servo implies there is some feedback mechanism involved. A motor is not a servo, though it can be one part of a servo. Anything that is open-loop is not a servo. servo (plural servos) A servomechanism or servomotor. May 13 '13 at 2:36

That's not a servo, that's a straight up DC motor. Also @jippie's comment wasn't about burning out your motor, rather your Arduino.

I'm not sure what you mean by "Charging" it. If you want to control it in an on/off mode using your Arduino you can use the circuit below:

simulate this circuit – Schematic created using CircuitLab

The nice thing about this circuit is that you can drive higher voltage motors with it too. The PMOS is the ZXM part. If you want to get another PMOS make sure it's VGS is about 1/3 to 1/2 of your motor voltage (in this case 3.3V) and that it can handle 30%-50% more current than your motor needs. The NMOS is used to drive the PMOS since your motor voltage might be higher than 3.3V -- for some other use case. The only thing when selecting the NMOS is making sure it is rated for higher than your motor voltage and that it's VGS is less than 2V (since you are driving it from a 3.3V Arduino).