So im using a mosfet to drop voltage from 12v to 5v to use for a servo. using pwm from the arduino. the servo doesnt move correctly when using the mosfet but does using arduino 5v and ground. the mosfet puts out 5v so its getting power. all the servo does when powered by the mosfet is go to one side and try to go past 0 degrees.
Perhaps it's because PWM output isn't really at the voltage you think it is or hope for: it will be varying between 0V and 12V (albeit very quickly) and be at an average of 5V, but it's not actually at 5V ever. That works for speed control of a DC motor, but for a servo, I don't know: it might be getting confused.
JimboZA:
Perhaps it's because PWM output isn't really at the voltage you think it is or hope for: it will be varying between 0V and 12V (albeit very quickly) and be at an average of 5V, but it's not actually at 5V ever. That works for speed control of a DC motor, but for a servo, I don't know: it might be getting confused.
Hmmmm what you said is what i have found from researching mosfets but i hoped the average voltage would be fine for servos.
What other options do i have. i dont care to use a regulator like the L7805 due to heat. I prefer to use 1 psu hence using mosfet.
I do think the average is where it needs to be because when i put a 100 ohm resistor across the + and - terminals the voltage is spot on.
cbrunnem:
What other options do i have. i dont care to use a regulator like the L7805 due to heat.
More modern regulators aren't linear and don't have that heat problem. I have a Pololu 2120: while it won't work for you since its current supply is probably too low at 300mA, it's a good example of what's available. Have a dig around at Pololu and see what others they have.
PWM may be alright for controlling a simple motor, but a servo has an electronic control circuit built into it.
In normal operation of a servo, you control the position by applying a pulse of a certain width to the control input, this pulse has 2 binary states, low or high, 0V or 5V.
By using PWM in the way that you are the ground connection to the servo is being switched on and off. When the N channel FET is non conducting, the servo's ground pin goes up towards the +12V supply.
So if you consider what the control input is now seeing, you have introduced a third state that it can be in, that is negative with respect to it's ground pin.
I can't imagine that the PWM and servo pulses are synchronised in any way, so your control pin will be seeing a random cycling of these 3 states high, low and negative.
It is not surprising that the servo can't now detect pulses in the correct range of pulse widths is it?
Ah John, when I said the servo might be "confused" I envisaged some kind of interference on the control line, but had no idea how that would actually have come about, so thanks for that explanation.
You might be more successful, if you connect the ground connection as normal, and use a P channel FET to switch the positive supply to the servo. (but I'm not holding my breath).
I tried 4 AA batteries in series to get 6.4v and when i hook it up the servo starts moving in the right direction but doesnt move. just like in the mosfet case. im woundering if this is a current issue. Ive used multiple servos/brands too.
Out of interest, I looked at both an Arduino servo output, and the PWM signal at the drain of an N channel FET on an oscilloscope.
By subtracting one channel from the other, I was able to see that my suspicion was correct.
I realise that the situation will be modified by the fact that i didn't have a servo connected, but the attached oscilloscope trace will give a visual indication of what is going on.