Floating Makes Me Nervous

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
bumba000
 
Posts: 128
Joined: Sat Sep 05, 2015 12:10 pm

Floating Makes Me Nervous

Post by bumba000 »

Hello All,
I have the ProTrinket. I'm using pin10 to drive n-mosfet at specific times using analogWrite(10, someval);. Just for kicks I'm doing an anologRead on 10 when it's not in use and it's showing anywhere from 100 to 900 (floating??).

Does this mean that even when I'm not using pin10 it's still signaling the mosfet or am I just getting a reading of like static elec from around the board? Any way to stop this from happening?

Measuring pin10 with a volt meter it reads zero, but the mosfet reads 3.9v.

Thank You, John

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Floating Makes Me Nervous

Post by zener »

Some questions and comments:

Why are you doing that and what did you expect to read?

Sometimes the first ad read is bad. I usually average

You would need to turn the pin back into an input for that to work at all I think.

The fet gate is a capacitor. You need a pull down resistor or drive it low to turn it off.

User avatar
bumba000
 
Posts: 128
Joined: Sat Sep 05, 2015 12:10 pm

Re: Floating Makes Me Nervous

Post by bumba000 »

I did it just to see what pin 10's value would be if not set at all. So a pulldown huh? I'm having a bit of trouble understanding this. If I connect the gate of the mosfet to pin10 and connect that to a resistor to ground, what happens when I want to drive the mosfet? Does all of the driving signal/power go to the mosfet because it's easier than going to ground??

Thank You, John

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Floating Makes Me Nervous

Post by zener »

The io pin can source an amount of current up to around 20 ma I think. As long as the resistor value is large enough (10k is typical) then it has no trouble driving the voltage high. The mosfet gate requires essentially no current, other than a little to charge the very small gate capacitance.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”