Mosfet switches without a cause

Hi!

I made a "quizshow-Buzzer" for a friend consisting of 4 rigid pushbuttons hooked up to the interrupt-pins of an arduino Leonardo, 4 LED-Lights inside the pushbuttons powered by IRF 830 Mosfets hooked up to the arduino like in this picture:

http://bildr.org/blog/wp-content/uploads/2012/03/rfp30n06le-arduino-motor-400x218.png

The cables between the central unit and the buttons are 10m long - I used cat5 Ethernetcables for this.

Now my friend tells me that the buzzer works pretty well, but very rarely the light on a button will start glowing without a button being pressed.
Could that be caused by capacities of the long cables or does anybody have another idea?

I'm waiting for a few more informations from my friend for now (especially if it's only the light that glows or if there is also a "beep" and an output on the central units display!) , but I'm wondering already...

zimbosmurf:
Could that be caused by capacities of the long cables

No.

Either a fault in the wiring or a software problem.

That is very much the wrong type of MOSFET to be using.

The resistance of it is 1.5? at a gate voltage of 10V. That's a huge gate voltage, and a huge resistance. The Arduino can only supply half that voltage!

You need "Logic Level" FETs. They are typically "IRL" not "IRF" and turn on much more fully with a much lower voltage. You should have a resistance of a few milliohms at just a few volts.

Also, the gate pull-down resistor (10K?) should be at the MOSFET end of the cable, not the Arduino end of the cable, and there should be a small resistor (typically 100? or so) between the Arduino and the gate to limit the inrush current caused by the capacitance of the gate.

As a child I built an "electrostatic charge detector" with a mosfet and a 3.5V bulb powered from 4.5V battery. There was a 30cm long wire on the gate wired. I can remember a simple manipulating with clothing switched the bulb on/off from a fair distance.. :slight_smile:
At that time the mosfets were sold with their legs shorted with a metallic spring, as they were not equipped with gate protection diodes as they are today.

The MOSFET is not logic level, you can't use it from an Arduino without adding a MOSFET driver
circuit of some sort.

Furthermore its simply the wrong device. For 60V operation go for something with about 100 to 120V rating max,
the performance of MOSFETs is worse the higher the rated voltage, its best to choose one with sufficient voltage
rating for your supply (plus a safety factor for transients), but no more.

But is your circuit really 60V that diagram isn't yours is it? If its say a 12V buzzer then your choice is even worse!

1.5 ohms is way way out there, modern devices at 100V or so Vds can be sourced at 0.01 ohms, at 20V
down to 0.004 ohms, two to three orders of magnitude better - the IRF530 is a museum piece nowadays :wink:

For lower voltage MOSFETs there are logic-level ones available too, much easier to use.

If you can tolerate a 1.5ohm on resistance (you may need heat sinking), then you can add a driver
circuit running at 12V or so using an NPN transistor to switch the gate at 12V - there are examples
on the Arduino website.

As for the light glowing, you haven't described the button side of your circuit yet, quick guess though:
pull-up resistors?

No, that is not my circuit, I just posted that image as it is where I took my wiring from. The Buzzer and the lights work on 12V, pretty low current (The Lights are 12W 0,1A E10 LED-Bulbs, the siren is 12V 0,3A) and the switching of the Light and Buzzer works pretty well.

The gate-pulldown-resistor is at the MOSFET-end - there is only 5cm between arduino-output and the MOSFET. The 10m cable is between the drain and the light.

Are you guys afraid that the MOSFET might break the Arduinos outputs or do you expect the whole thing just not to work?

The button-side of the circuits consists of a pull-down-resistor, the Button connects to +5V, also with a 10m-cable.

As i talked to my friend a little longer, the problem seems to be input-related or software related.

  • The light glows
  • the siren screams for 1 sec (another output, software-driven)
  • there is output on the display

And it seems always to be the same input that causes the trouble. Sounds like a software-bug to me.

What value pull-down resistor do you have on the input? 10M is quite a long length of cable.

You might be better off using pull-up instead of pull-down, and using a smaller resistor, say 1K?.

@MarkT would this one be better?
Transistor IRL540N 100V 36A 140W 0,044Ohm (Logic Level MOS-N-FET, TO-220)
I used the IRF because it was the cheapest N-MOS that my local electronics-dealer could offer me...

@majenko
I used a 10k pulldown for the input. Just out of curiosity:
What effect does a lower pulldown-resistor have and what is the difference between pulldown and pullup - or why do you think, a pullup would be better?

OK, I thought a bit about the whole "long cable => low pulldown" theme - and I don't get it.

As long as my button is not pressed, the pulldown resistor pulls my input-pin to ground. At that moment the value of the resistor is completely irrelevant.

As soon as my button is pressed, I have a series of resistors between 5V and GND:

R(C) is the cable resistance and R(P) is the pulldown-resistor.

That is a voltage-divider, the voltage "x" that is applied to my input is as follows:

x = 5V/(RC+RP) * RP

As long as RC is as small as possible, we have

x = 5V / RP * RP = 5V

As soon as I have a hiogher value for my cable-resistance, let's say RC = 1k (which is far beyond realistic!), my RP gets interesting:

x = 5V / (1k+RP) * RP

let's fill in some values:

100o => x = 5V / (1k+0,1k) * 0,1k = 0,45 V
1k => x = 5V / (1k+1k) * 1k = 5V / 2k * 1k = 2,5V
10k => x = 5V / (1k+10k) * 10k = 5V / 11k * 10k = 4,54V
100k => x = 5V / (1k+100k) * 100k = 5V / 101k * 100k = 4,95V

So in my opinion, the higher the resistor is, the better my input-value should be.

Realistic, cat5-cables have a DC-resistance of 50-150Ohm/km, so anything above 1k should be perfect.

So why do you say that I should try a lower pulldown-resistor because of the long cables? I don't want to argue, but I'd love to understand! :slight_smile:

zimbosmurf:
OK, I thought a bit about the whole "long cable => low pulldown" theme - and I don't get it.

As long as my button is not pressed, the pulldown resistor pulls my input-pin to ground. At that moment the value of the resistor is completely irrelevant.

As soon as my button is pressed, I have a series of resistors between 5V and GND:

R(C) is the cable resistance and R(P) is the pulldown-resistor.

That is a voltage-divider, the voltage "x" that is applied to my input is as follows:

x = 5V/(RC+RP) * RP

As long as RC is as small as possible, we have

x = 5V / RP * RP = 5V

As soon as I have a hiogher value for my cable-resistance, let's say RC = 1k (which is far beyond realistic!), my RP gets interesting:

x = 5V / (1k+RP) * RP

let's fill in some values:

100o => x = 5V / (1k+0,1k) * 0,1k = 0,45 V
1k => x = 5V / (1k+1k) * 1k = 5V / 2k * 1k = 2,5V
10k => x = 5V / (1k+10k) * 10k = 5V / 11k * 10k = 4,54V
100k => x = 5V / (1k+100k) * 100k = 5V / 101k * 100k = 4,95V

So in my opinion, the higher the resistor is, the better my input-value should be.

Realistic, cat5-cables have a DC-resistance of 50-150Ohm/km, so anything above 1k should be perfect.

So why do you say that I should try a lower pulldown-resistor because of the long cables? I don't want to argue, but I'd love to understand! :slight_smile:

It's all to do with current flow and noise rejection. A lower resistance causes more current to flow. That's what the "strength" of a pull up or pull down resistor is all about. A "weak" one, like inside the Atmel chip, is typically 20K. "Average" is 10K. "Strong" is 1K-4K7.

When you press the button, the button, cable and resistor form a voltage divider. That mid point of that divider is then connected to the gate of a MOSFET, which is a capacitative element. Current needs to flow into that gate to turn it on, or out of it to turn it off. The more current you have available in the voltage divider to turn it on, and the lower the resistance on the pull-down to turn it off, the better it is. But at the same time you don't want to waste current :wink:

Ahhh...thanks, I got it!

++++!