I'm working on a robot that is currently experiencing significant noise on its servos whenever the DC motors move. I'd like to be able to cut power to the servos when they're not moving since the parts they move are light enough that gravity won't affect them. I'm trying to use an N-channel MOSFET (FQP30N06L) to power the circuit from my Arduino Mega's 5V line (I have an external 5V supply if you think I should use that instead). Unfortunately, the MOSFET only works as expected when the servo is disconnected. What am I missing?
I've attached a schematic of the exact circuit but basically the control pin connects to the gate, the source connects to ground, and the output is connected to the drain and pulled up to 5V by a 10k resistor.
I am curious as to how you are using the mosfet. Normally it is used to switch the load to ground when turned on. Why the resistor to 5v? I would expect the R to be going to the gate from the arduino.
As described, you want the N-channel MOSFET in series between the GND pin of the servo and GND.
When N-channel MOSFET is Off, the servo GND is disconnected.
Most servos have some electronics in them. I would think a P-channel MOSFET in series with the supply voltage would be better - bring the servo control signal low and then the P-channel Gate high to turn the P-channel MOSFET off.
A Logic Level, Low Rds part like this would work well
You can use the N-channel to pull the Gate low to turn it on, and a 1K pullup resistor to the supply voltage to turn it off.
CrossRoads:
If just 5V, then only the P-channel might be enough.
The servos are running on 5V. In that case, what other parts of the circuit you described are kept? Do I keep the 220-ohm and 10-kiloohm resistors but remove the N-channel MOSFET and the 1-kiloohm resistor?
I'm trying to use an N-channel MOSFET (FQP30N06L) to power the circuit from my Arduino Mega's 5V line (I have an external 5V supply if you think I should use that instead).
Yes, use the external 5V supply to supply power to the motors.
I'm working on a robot that is currently experiencing significant noise on its servos whenever the DC motors move.
To improve noise, make sure there are no ground loops. Use separate ground wires connected in a "star" configuration (all gnd wires go to a common point).
P-channel, 10 K pullup to keep it off during Reset conditions, 220 to limit arduino current.
Servos, rule of thumb is 1A while moving for small servo. Got a link to yours?
Can put your meter in current mode and measure in series from supply to servo power in pin, take some readings.
I ran a quick test and it seems like my servos are drawing 200-300mA when moving.
That said, your circuit seems to have done the trick. When the control pin goes high, the voltage drops to about 1V and then VERY gradually continues down to 0 but that's probably an artifact of the specific MOSFET I'm using. And besides, according to my initial test, the servo doesn't twitch at 1V. Thanks!
KalebPSpector:
When the control pin goes high, the voltage drops to about 1V and then VERY gradually continues down to 0 but that's probably an artifact of the specific MOSFET I'm using.
That does not make sense. Nothing about the MOSFET should account for a slow decline in voltage; that would be a capacitor effect somewhere. If you have it switching off when the control pin goes high, you are clearly using only the P-channel MOSFET.
Note that if you are turning the servo(s) off, you must at the same time stop the servo control pulses and ensure that the control pins are either set low, or as inputs (not pull-up).
If the servos draw 200-300mA when moving, they may draw up to an Amp when blocked from moving.
As zoomkat said, we would really like to know what are you using to power the Arduino, servos, and motors? This is clearly the real cause of the original problem you described with the servos notwithstanding your "fudge".
Paul__B:
...what are you using to power the Arduino, servos, and motors?
I am using a 24 volt supply fed through a GE Hammerhead series DC-DC converter that steps it down to 12V. The motors are powered by Solarbotics L298 driver boards and the 5V regulated output of one of them is fed back to the servos. This is probably where the "noise" (I used quotation marks because the movement isn't exactly random; both servos move towards position 0) is coming from. That said, the regulators are showing no signs of excessive heat (I added heatsinks just in case) so I see no reason to alter that setup.
New question: if I wanted to control power to two servos, which of the following setups would be best:
Two MOSFET circuits each controlled by a different Arduino pin
Two MOSFET circuits controlled by the same Arduino pin
One MOSFET circuit controlling both servos
Ideally the answer would not be #1 but I can work with that if I have to.