Go Down

Topic: TowerPro 9g servo + P2N2222AG transistor (Read 2639 times) previous topic - next topic

kaploink

Hi all

Is the p2n2222ag suitable for cutting off power to a 9g servo?  According to http://oomlout.com/a/products/ardx/circ-03/ it's good for 40V and 600mA, but it's only passing along about 2V, regardless of whether I give it 4.5V or 6V.

- the servo requires at least 3-4V
- I can hear the servo trying to move
- current is sufficient (with direct power moves under 70mA; is getting 70mA through transistor)

The reason for adding a transistor is just to cut down on servo glitches.

Cheers
Matt

zoomkat

Quote
The reason for adding a transistor is just to cut down on servo glitches.


Servo issues are usually the result of bad code, bad wiring, or power issues. Never heard using a transistor with a servo.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

kaploink


Servo issues are usually the result of bad code, bad wiring, or power issues. Never heard using a transistor with a servo.


To be more specific, the glitching I'm trying to avoid is when I connect the power to a servo.  It jumps a few degrees, even if the servo's not attached in code, and I think even if the signal wire's not plugged in.  Looking at http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1262273017/all it seems to be a common issue, however haven't seen a common solution for it.  The transistor is to keep the power off until I actually want the servo to move.

The other reason for using the transistors is that I'll be using lots of servos (>100) so need a bit more control over power usage.  All on idle might use up too much.  Also want to avoid getting into a stuck state if they erroneously all receive a signal to move at the same time - they all just sit there because the 1A of current gets split to say 10mA each which isn't enough for any of them to move to their target angle.

zoomkat

Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

terryking228

Hi,
I think you are saying you want to be able to remove +5V (or possibly 6V if you're using that) from a servo or a group of servos, and then apply it when you want. Is that correct?

If so, you need a "high-side-switch" .  This means the switch connects to +5V and it's output goes to the load (your servo) which is connected to ground.

Typically you use a PNP  transistor or, better, a P-FET (Field Effect Transistor).

How much maximum current can the servos you have draw?? They are considered "micro" servos like these: http://arduino-direct.com/sunshop/index.php?l=product_detail&p=238

A good overall discussion of servos is:

http://www.pololu.com/blog/16/electrical-characteristics-of-servos-and-introduction-to-the-servo-control-interface

That says: 
Quote
a micro servo will need a few hundred milliamps


So you probably need a "Logic-level P-FET power transistor".   (Can anyone give a suggestion for a easy one to get??)

The connections would be:

- PFET SOURCE to +5V
- PFET DRAIN to servo power
- PFET GATE to Arduino I/O pin.  (10K resistor from Gate to Source would be good also).

Other suggestions, anyone??

Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

kaploink

Thanks heaps for the reply!

Yep, just want to let code be like follows:
- moveServo(int servoId, int angle)
     - allow power to flow to it (by setting transistor state)
     - attach it
     - set target angle
     - wait a bit for it to move there
     - detach it
     - stop power flowing to it (by setting transistor state)

Yep, they're micro servos that look exactly the same as the ones in that pic.  They pull maximum 200mA (eg going straight from 0 degrees to 180).

The circuit I'm trying to use currently is the same as http://oomlout.com/a/products/ardx/circ-03/, but with the motor and diode swapped for a servo (and its signal connected to the arduino).

What's the advantage of switching high side (pnp) instead of low (npn)?  I read that switching high side means power flows when transistor is off - is that true?

Cheers

kf2qd

You probably won't get rid of servo glitches on startup. What you are most likely seeing is that the H-Bridge that drives the motor, along with other circuitry inside the servo is not turning on cleanly and this is what causes the servo to jump. In many applications this is not a problem because, if the transmitter is on the servos quickly respond to the current control positions. You are going to get some twitch, it just depends how quickly teh control signal is there to move them where you want them.

You might also look into a small relay. Would handle power to all you servos with one device.

kaploink


You are going to get some twitch, it just depends how quickly teh control signal is there to move them where you want them.

You might also look into a small relay. Would handle power to all you servos with one device.

Thanks.  So, basically you should usually set the signal first, then turn on power.  This application involves 100-2000 servos, of which only about 5% are in use at any point in time.  So really my issue is power - I don't have enough power to control them all at once, so when I go "attach all servos; set all servo angles to init angle; power on all servos" they all just get stuck because none have enough power to move.

I'm initially just doing about 80 servos, so if I just got a bigger power supply then I could go with your suggestion and avoid the transistors.  The power supply I have at the moment is 1A, which can move about 20 at once, so 10A should cover it easily.  Might do that for the moment thanks.

terryking228

For some How-To on Arduino power and relays: http://arduino-info.wikispaces.com/ArduinoPower
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

kaploink

Cool thanks for that.

For anyone with similar issues, could probably also split up the servos into groups of 20 and use 1 relay for each.  Then can init and power on one group at a time.

kf2qd



Thanks.  So, basically you should usually set the signal first, then turn on power.  This application involves 100-2000 servos, of which only about 5% are in use at any point in time.  So really my issue is power - I don't have enough power to control them all at once, so when I go "attach all servos; set all servo angles to init angle; power on all servos" they all just get stuck because none have enough power to move.

I'm initially just doing about 80 servos, so if I just got a bigger power supply then I could go with your suggestion and avoid the transistors.  The power supply I have at the moment is 1A, which can move about 20 at once, so 10A should cover it easily.  Might do that for the moment thanks.


Sounds like you need to look into multiple power supplies. I am assuming that these servos are distributed around some structure and multiple supplies would make for more reliability.

kaploink




Thanks.  So, basically you should usually set the signal first, then turn on power.  This application involves 100-2000 servos, of which only about 5% are in use at any point in time.  So really my issue is power - I don't have enough power to control them all at once, so when I go "attach all servos; set all servo angles to init angle; power on all servos" they all just get stuck because none have enough power to move.

I'm initially just doing about 80 servos, so if I just got a bigger power supply then I could go with your suggestion and avoid the transistors.  The power supply I have at the moment is 1A, which can move about 20 at once, so 10A should cover it easily.  Might do that for the moment thanks.


Sounds like you need to look into multiple power supplies. I am assuming that these servos are distributed around some structure and multiple supplies would make for more reliability.


You mean one 1A power supply per 20 servos?  For the 2000-servo version that seems expensive (even compared to the cost of the servos).

For full scale - still need to find a way to avoid idle servo power usage, as for this application it'd be far higher than active servo usage (40x).  99% of the time all servos will be idle; 1% of the time 5% will be in use.  So idle power usage is 4mA * 2000 = 8A; average active is 200mA * 2000 * 1% * 5% = 200mA.

The active servos may be fairly randomly distributed, so can't power them in groups.

Yep they're all mounted to the same structure - can't say much more on the application as it's still top secret :smiley-zipper:

kaploink


For full scale - still need to find a way to avoid idle servo power usage, as for this application it'd be far higher than active servo usage (40x).  99% of the time all servos will be idle; 1% of the time 5% will be in use.  So idle power usage is 4mA * 2000 = 8A; average active is 200mA * 2000 * 1% * 5% = 200mA.


Oops, I missed something there - can address the "99% of the time all are idle" by just turning off all the power supplies for that period...  Hmm.   :smiley-roll:  So remaining average idle usage would be just 80mA, less than the 200mA active average.

Can the power supplies you're talking about easily be turned on/off with the arduino?

Go Up