MOSFET with floating gate = bad.... But 2xfloating gate = good?

So I'm working on a project that I have little time to finish it.

I'm basically making a soil moisture sensor. No time to explain, just look at this schematic:

The BS170 is a mosfet that I'm using as a switch (5V=ON, 0V=OFF)
But since the soil, when wet, has a resistance of about 1k, and if my arduino is switched off, I have a drain source voltage of 5V and a floating gate pin on my transistor.
I learned the hard way, on previous projects, that that's the fastest way to kill your mosfet.
If you touch it in this configuration, it will short itself out and die.

Now, since I have very little time, I thought of a quick fix:
(Drum roll please)

Now, I'm not really sure this will actually work, that's why I need someone to look it over before I go and buy the components tomorrow morning (it's almost 4am here).

So is my thinking ok?
If not, is there a quick fix for this?

Limiting factor: I have only 1 pin available for this, on my arduino.

Why not pull the gate down with a 10K (or higher) resistor? Not floating then. And a resistor between the output and gate is often recommended to limit the current charging the gate capacitance.

Yep..... the general way.... a pulldown resistor... aka a resistor to ground.

Nothing in post#0 makes sense.

The mosfet is not used as a switch. It's a source follower, leaving 5volt - Vgt on the probe.
That makes the analogue read signal basically useless.

You probably have killed the mosfet with a static charge.
The gate can withstand a Vgs of +/- 20volt.

Why use a mosfet anyway.
You can power a soil probe directly from an Arduino pin.
1k resistor from an output pin to the "hot" probe, same probe to an analogue input.
Set ouput pin HIGH, measure, set output pin LOW.
Leo..

Probably depends on how much current goes to the soil probe.

Southpark:
Probably depends on how much current goes to the soil probe.

What do you mean.
The output pin drives a voltage divider. Current is limited by the 1k resistor.
Even is the probes are shorted together (max current), pin current is <= 5mA.

Edit:
Maybe OP should try to drive both probes to lower corrosion even further.
Two output pins connected to the two probes via 1k resistors.
And two analogue pins connected to the probes.
Normal condition: both probes LOW (no potential between them).
During measuring: probe1 HIGH, and record the two analogue inputs. Then probe1 LOW.
Then probe2 HIGH, and record the two analogue inputs. Then probe2 LOW.
Pause for as long as you want.
You should be able to calculate soil humidity from the four analogue values.
Shorted probes should give a value of ~511 from both probes, 0 and 1023 is open ciruit (dry).
Leo..

Not likely. There's a resistor in series designed to limit the current.

Wawa:
What do you mean.
The output pin drives a voltage divider. Current is limited by the 1k resistor.
Even is the probes are shorted together (max current), pin current is <= 5mA.

Yeah.... I think you're right wawa. Just checked their post again and they reckon around 1 kOhm for the wet soil...and then they got some resistor in the circuit as well.

I agree.... the arduino output should do the trick.

Thank you so much for all your answers!!!

Bingo! The pulldown resistor was the most obvious solution that never occurred to me.

Also, regarding the other things:

Wawa:
The mosfet is not used as a switch. It's a source follower, leaving 5volt - Vgt on the probe.

Yes, my bad. I will move the mosfet to the second probe. Between the second probe and GND.
Then it will behave more like a switch.

Wawa:
Why use a mosfet anyway.
You can power a soil probe directly from an Arduino pin.

No I can't. Because I lied. I'm not using an arduino (I am for prototyping).
I will actually be using a standalone micro.
I could still hook up the probes directly to the battery, but I don't want constant electrolysis to be happening.

The resistor behind the analogue read pin is there to limit the current in case of probe shorting, and also to create a voltage divider so I can read the voltage drop.
In my tests, with the probes about 2cm appart:
Relatively dry soil has a resistance of about 10 kΩ.
Very wet soil has a resistance of about 200Ω.

If I put a 1k resistor before the probe, I will be able to interpret the analogue readings as:
slightly below Vcc=super dry soil
slightly above GND=super wet soil
And interpolate everything between.

Again, thanks everyone!

chocolatesheep:
No I can't. Because I lied. I'm not using an arduino (I am for prototyping).
I will actually be using a standalone micro.

So? Still no difference... Just drive it from a pin and Bob is your uncle.

chocolatesheep:
No I can't. Because I lied.

I'm not using an arduino (I am for prototyping).
I will actually be using a standalone micro.

I could still hook up the probes directly to the battery, but I don't want constant electrolysis to be happening.

In my tests, with the probes about 2cm appart:
Relatively dry soil has a resistance of about 10 kΩ.
Very wet soil has a resistance of about 200Ω.

If I put a 1k resistor before the probe, I will be able to interpret the analogue readings as:
slightly below Vcc=super dry soil
slightly above GND=super wet soil
And interpolate everything between.

  1. Hmmmm. You didn't listen to your mother?

  2. This is an Arduino forum, but same story for any micro.

  3. Electrolysis happens when there is potential difference between the probes.
    Best to keep the differential voltage when measuring as low as possible. And use an alternating signal (AC) from two micro pins, as I explained in post#5.

  4. Seems 1k is a good choice when two probes are actively driven, and ~2k2 if only one is switched.

  5. A mosfet is NOT needed. When the first probe is switched LOW with an MCU pin (MCU ground), and the second probe is grounded (to MCU ground), there is NO potential difference between the probes.
    Leo..

P.S. Corrosion is still possible if the Arduino is grounded (to mains power), and "soil" is not a potplant.

Hi,
Your BS170 is a N_CH MosFet, not P-CH. as you have drawn it.

https://www.fairchildsemi.com/datasheets/BS/BS170.pdf

Tom... :slight_smile:

I find mosfet symbols a bit confusing as well but that IS a the symbol for a N-channel :smiley: Arrow pointing out on the Source.

Hi,
Yep.

Confusing ain't it...

Thanks.. Tom... :slight_smile:

Just a comment. Two FETs in series with the gates tied together is equivalent to one FET with twice the channel length. You wind up with twice the channel resistance, Rds. It does nothing to change the circuit topology.

Yes, my bad. I will move the mosfet to the second probe. Between the second probe and GND.
Then it will behave more like a switch.

That is not necessary. Think about it . What is the function of a switch ?
Answer: To turn something on or off.
Is the sensor a load that would be turned on or off ?
Answer: Of course not. It is not a load at all. It is a sensor, an INPUT, not a LOAD.
You don't turn OFF a sensor, do you ?
All you need to use a P-channel mosfet and use the analog values measured to direct program execution using IF or CASE statements.
It is not necessary to move the mosfet, but if you using it as a source follower it is necessary to use a P-channel mosfet, instead of an N-channel. The symbol you used is an N-channel (from Tom George's table)

Just a comment. Two FETs in series with the gates tied together is equivalent to one FET with twice the channel length. You wind up with twice the channel resistance, Rds. It does nothing to change the circuit topology.

I was wondering how long it was going to take for someone to say that.

BTW, the only reason I can think of for the use of the fet is to reduce power consumption by only turning on the sensor twice a day to check the moisture and then turning it off.

raschemmel:
BTW, the only reason I can think of for the use of the fet is to reduce power consumption by only turning on the sensor twice a day to check the moisture and then turning it off.

Minor point, but I presumed that the original poster was trying to mitigate electrolysis eroding the electrodes by removing power from the sensor.

Minor point, but I presumed that the original poster was trying to mitigate electrolysis eroding the electrodes by removing power from the sensor.

I wouldn't know since I have no experience or knowledge of electrolysis. (not yet anyway), but old dogs can learn new tricks... ;D

None of those symbols is a power MOSFET:

Note the body-diode. The diode is the easiest clue to p-channel v. n-channel, so its useful to
show it in the symbol. The body diode is always present in power MOSFETs due to the layered
vertical current flow architecture.

The diode is the easiest clue to p-channel v. n-channel,

Meaning the cathode is at the bottom and the anode is at the top on a P-channel, right