Searching \ for '[EE] Problem using logic level MOSFET as a PIC con' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Problem using logic level MOSFET as a PIC con'.

Exact match. Not showing close matches.
PICList Thread
'[EE] Problem using logic level MOSFET as a PIC con'
2007\02\14@111337 by Chris Piclist

flavicon
face
part 1 2678 bytes content-type:text/plain; (decoded quoted-printable)

Hi Group.
I have been designing and building a small PIC based robot for my
daughter. To save power, I decided to create two power busses, one for a
pair of wheel servos and one for the robot's sensors (right now the
robot only has an ultrasonic rangefinder). The bus power is controlled
by the PIC. It turns a pair of BUZ-72L MOSFETS on and off. The BUZ72L is
an N-channel logic-level MOSFET. This plan seemed to work just fine. My
code turns the busses on as needed and the wheel servos and sensors are
working as expected.
I ran into a problem when I implemented the robot's sleep code. The idea
is to turn off the busses, do some cleanup and place the PIC in SLEEP
mode until the user (my daughter) wakes up the robot with a button
press. I discovered that the two busses are ON when the PIC is sleeping.
I found this problem the hard way - dead batteries.
I took some measurements at the connectors that supply power to the
servos and sensors and discovered that the busses are at least partially
on even though the gate of each MOSFET is connected to ground. I say
partially because I'm not seeing the expected current draw I'd see if
the servos and ultrasonic sensor where powered up but idle. I have not
had a chance to setup a test board yet for further measurements but will
do so in the next few days. Here are the measurements I've made so far:
       (All measurements taken at the servo and        sensor connectors, pin 2 and 3, with the load disconnected.)

       PIC on and bus on:
               I see 5 volts across the power (pin 2 - to 5 volt rail)
               and ground (pin 3 - to MOSFET drain) pins on the                connector. This is as expected.
       PIC in sleep mode and bus off:
               Pins appear to be floating.                I see a "noise" voltage of a                few hundred millivolts.
I also verified that my firmware is working as designed. Before the PIC
enters sleep mode, it drives the IO pins connected to the MOSFET gates
low. The MOSFET gates are also connected to ground via a 22k ohm
resistor.

The attached schematic shows how the MOSFETS, pic and power connectors
are wired. There is a full-size version of the attachment as well as a
complete schematic on my web site. The URL is
downloads.rocklizard.org/ElectronicsAndEmbedded/TagBot/
If anyone has any circuit advice, design tips or
measurement/troubleshooting suggestions, I would appreciate it. I will
post more information once I take additional measurements. I do not have
a lot of experience using MOSFETS for switching. I've been reading about
them in the Art of Electronics and as far as I can tell, the design I've
come up with should work.
Thanks in advance.
Chris Levin


part 2 40041 bytes content-type:image/jpeg; (decode)


part 3 35 bytes content-type:text/plain; charset="us-ascii"
(decoded 7bit)

2007\02\14@134042 by Marcel duchamp

picon face
What are the two pic lines that control the servos doing in sleep?

Are they set high?

If they are low, they will probably provide a current path through back
biased diodes in the servos.


Chris Piclist wrote:
{Quote hidden}

2007\02\14@140717 by Rolf

face picon face
I second what Marcel says, and raise you the fact that your schematic
has your LED's wired in the wrong way... ;-)

I would attach an ammeter between RD2 and Pin1 of Left Servo, or RD3 and
Right servo. Could also be pin RB3.

Rolf

Chris Piclist wrote:
>  
> Hi Group.
>  
>
>  
[snip]
{Quote hidden}

2007\02\14@142249 by Chris Piclist

flavicon
face
part 1 768 bytes content-type:text/plain; (decoded quoted-printable)


________________________________

From: spam_OUTpiclist-bouncesTakeThisOuTspammit.edu on behalf of Marcel duchamp
Sent: Wed 2/14/2007 11:40 AM
To: Microcontroller discussion list - Public.
Subject: Re: [EE] Problem using logic level MOSFET as a PIC controlled powerswitch



>What are the two pic lines that control the servos doing in sleep?
>
>Are they set high?
>
>If they are low, they will probably provide a current path through back
>biased diodes in the servos.
>
>

Hi,
The control pins for both servos and the ultrasonic sensor are LOW during sleep. I never thought of this being an issue. I will check it tonight or tomorrow and see if setting them HIGH fixes the problem.
Thanks for the tip.
CHRIS





part 2 4395 bytes content-type:application/ms-tnef; (decode)

part 3 35 bytes content-type:text/plain; charset="us-ascii"
(decoded 7bit)

2007\02\14@143422 by David VanHorn

picon face
On 2/14/07, Rolf <.....learrKILLspamspam@spam@rogers.com> wrote:
>
> I second what Marcel says, and raise you the fact that your schematic
> has your LED's wired in the wrong way... ;-)


Your 5V is going right to the servos.
In the "off" state, the servo circuit will leak power into the pic through
the pulse lines.

2007\02\14@144022 by David VanHorn

picon face
>
> The control pins for both servos and the ultrasonic sensor are LOW during
> sleep. I never thought of this being an issue. I will check it tonight or
> tomorrow and see if setting them HIGH fixes the problem.


Either way, this looks like a problem.

I wouldn't gate the power to the servos this way, nor would I run them from
the same VCC that runs the micro.
A separate battery for the servos, or heavy filtering, with a series diode
to prevent load on the servos from crashing VCC.
P-fets in series with the + lead on the servos would be a more conventional
way to fly, you'd need NPN open collector drivers between the pic and the
Pfets.

2007\02\16@203439 by Chris Piclist

flavicon
face


{Quote hidden}

Hi,

Sorry for the long delay in my reply. Work was hell this week.

Setting the control pins for the servos and sensors high before putting
the pic to sleep has solved the problem. With the pic sleeping, I
measure about 325 microamps. That's still too high according to my
calculations but acceptable. Now I need to figure out if I've left a pic
peripheral active or something. The 18F4520 has a much more complex
power management system than I'm used to dealing with. I expect to have
a fun time with the datasheet :)

Dave - you mention that a P-FET is the more conventional switching
method. I'd like to know why? My understanding is that the N channel
devices are better because of lower Ron. They are also simpler to
control - no transistor interface required. I would be interested in
hearing why this is not the best choice.

As for connecting the servos directly to the pic's Vcc rail, I know this
is an issue. I wanted the first prototype to be as simple as possible
and I did not see or measure any serious noise issues while testing this
on a breadboard - so I left out the filtering being lazy!) I am
currently working on an improved power system. For starters, I'm working
on a small boost regulator (mainly because I've really wanted to try
making one) to drive the sensor bus. I don't have much headroom with 4
NiMH batteries and the ultrasonic sensor does not work well when the
voltage drops below about 4.5 volts. I have not decided what to do with
the pic power yet, but I do plan on adding filtering to the servo
connectors since I know that other servos will not be as clean as the
ones I'm using now. I just lucked out with this particular pair.

Rolf - thanks for catching the backwards leds on the schematic. Because
of the board layout, I'm driving these with inverted logic - I was not
thinking when I drew them on the schematic I posted.

Thanks to everyone for your comments.
Chris


2007\02\16@210800 by David VanHorn

picon face
>
>
> Setting the control pins for the servos and sensors high before putting
> the pic to sleep has solved the problem. With the pic sleeping, I
> measure about 325 microamps. That's still too high according to my
> calculations but acceptable.


I'm not surprised, see below.


> Dave - you mention that a P-FET is the more conventional switching
> method. I'd like to know why? My understanding is that the N channel
> devices are better because of lower Ron. They are also simpler to
> control - no transistor interface required. I would be interested in
> hearing why this is not the best choice.


It's not the parts, it's how you're using them.
Interrupting the ground lead on the servos will means that the circuit
inside the servo is now in a really unusual state.  If you interrupted the +
lead, then we could count on the pulse lead just being a load to ground on
the PIC outputs, and taking them low during sleep would eliminate that
issue.
With ground interrupted, we may be seeing current leaking back into the pic
through the pulse leads. Your observation that setting those ouputs high
reduces sleep current confirms this.
We don't know what this might be doing to the servo circuits, or the
protection diodes in the PIC.
SCR latchup is a distinct possibility.

In general, with any circuit of more than two leads, interrupting ground,
and leaving power and other leads connected, is a "BAD IDEA (tm)"  Ground
should always be the first connection made, and the last connection broken.



As for connecting the servos directly to the pic's Vcc rail, I know this
> is an issue. I wanted the first prototype to be as simple as possible
> and I did not see or measure any serious noise issues while testing this
> on a breadboard - so I left out the filtering being lazy!)


"It worked on the bench!"  Famous last words.. :)

2007\02\17@124609 by Chris Piclist

flavicon
face


{Quote hidden}

Hi David,

Thanks for your comments. I want to clarify a few things and see if I'm
right or wrong.

When I say that the pic is drawing 325 uA when sleeping I do mean just
the pic. With the sensors/servos connected or disconnected the current
consumption is the same. I've also measured current at the connectors
and confirmed that there is no current flowing through the control
lines. On the SCR latchup issue, I think you might be wrong. I just
double checked in Art of Electronics (page 138, top of column 2) and I
think I'm ok. The SLEEP code sets the control pins for the servos and
sensors HIGH, turns off the MOSFETS then enters sleep mode. In this
state, no current can be forced into the pic's output pins. Were you
mistaken or have I missed something else? I've looked inside the servos
and they have filter capacitors between the power and ground connection
which may explain the lack of noise on the Vcc bus. I know I still need
a better solution and that's my plan for this weekend.

Thanks again for all the great info!
Chris

More... (looser matching)
- Last day of these posts
- In 2007 , 2008 only
- Today
- New search...