[Solved]Help a noob with transistors please.

So a long story short, I have a transistor BS170 that acts as if always on when using 12 power supply (for led strip) but acts appropriately if connected to arduino 5v pin. I also have 10k resistor between arduino and gate.
Attached picture shows what I have so far, I am new to the point of not really knowing if drain is supposed to connect to ground and source to led or other way around, but both ways the problem is exactly the same. If anyone can point out the mistakes I would appreciate it.

Photo: Screenshot by Lightshot (too large file to upload here apparently, whoops)

Additional info: Intended use for transistor is to act as switch for about 35 cm strip of led, it should be pulling under 0.2amp at 12v This BS170 resistor looked good enough for my needs but let me know if it has to be changed out.

For testing it was connected to 10cm strip of led (6 leds total).

Thank you for you time ~!

Problem solved, I also had to connect the arduino ground to the main power supply ground for it to work as intended.

Source to GND, drain to V- of leds. Reduce resistor of the gate to 100Ω (or remove it altogether, it's just a small mosfet).

35cm is about borderline what you can drive. And you will loose in the order of a volt across the transistor.

Use cct. Q3 but cct. Q4 would be better as this transistor is not a logic level MOSFET.

Obviously your strip replaces the loads in the schematics.

Suggest you get a Logic Level MOSFET.

Show us a good schematic of your circuit.
Show us a good image of your wiring.
Give links to components.
Posting images:
https://forum.arduino.cc/index.php?topic=519037.0

Try this configuration:

The 3000 pf is optional.

The 1k should remain. Its goal is to save the arduino in the event something goes wrong.

I've successfully used this FET device many times with a 5V arduino. I don't think it will work with a 3.3v arduino

@johnrob,
Are you aware that your schematic has no part number for the mosfet so your statement:

I've successfully used this FET device many times with a 5V arduino. I don't think it will work with a 3.3v arduino

has no meaning. (or should I search for a Q1B datasheet ?)

Do not place an input capacitor to GND in MOSFET switching applications.

Adding an input capacitor to GND slows down the switching action and keeps the transistor in linear conduction thus heating the device.

During Arduino power up, I/O pins float.

This will make the input to your circuit be at non logic levels that can lead to component failure.

In this case, you should place a resistor from the input to GND, ~10k should work in most conditions.

Reduced your series resistor to 220 ohms.

raschemmel:
@johnrob,
Are you aware that your schematic has no part number for the mosfet so your statement:

has no meaning. (or should I search for a Q1B datasheet ?)

I was referring to the original post referencing the BS170. I guess It would have been clearer if I modified the schematic to match.

larryd:
Do not place an input capacitor to GND in MOSFET switching applications.

Adding an input capacitor to GND slows down the switching action and keeps the transistor in linear conduction thus heating the device.

During Arduino power up, I/O pins float.

This will make the input to your circuit be at non logic levels that can lead to component failure.

In this case, you should place a resistor from the input to GND, ~10k should work in most conditions.

Reduced your series resistor to 220 ohms.

The 1000 ohm and 3300 pf capacitor is there for a reason. This "smoothing" of the gate drive edges will significantly reduce RF noise generated by the MosFet switching. If you look at the time constant of the RC (ignoring the gate charge for now) the RC is 0.033 µS. Hardly enough to Heat the MosFet. Especially if the switching frequency is in the order of 200 Hz.

The 10k from gate to ground is probably a good idea. However if the OP follows my recommendations this resistor should be more like 50k. I've had a LED driver with 3 output channels working in my home for about 4 years without the gate to ground resistor and have no issues.
Personally I think the gate to ground resistor is a very good idea during the prototype phase when the connection to the MosFET could be an open circuit (i.e. not connected to the Arduino or anything else) Once the circuit is finalized it should be omitted because it does reduce the gate voltage a slight bit. And with the BS170 there is just enough gate voltage to begin with.

“The 1000 ohm and 3300 pf capacitor is there for a reason. This "smoothing" of the gate drive edges will significantly reduce RF noise generated by the MosFet switching. If you look at the time constant of the RC (ignoring the gate charge for now) the RC is 0.033 µS. Hardly enough to Heat the MosFet. Especially if the switching frequency is in the order of 200 Hz.”

This is just misleading and deceptive, it belongs on the Instructables web site along with all the other information they spew there.

Many users use PWM with LEDs, the frequency is 490Hz and 976Hz on the UNO.

God knows we hate inaccurate information on the forum. It's like cancer , you have to remove it
before it spreads...

This is just misleading and deceptive, it belongs on the Instructables web site along with all the other information they spew there.

Everyone must make their own final design decisions. This would be mine. However I can assure you the concept I describe is not misleading nor deceptive. The additional heat generated is trivial even at 1000 Hz, you can calculate it for your self.

Most people on this site know how to make a band pass filter to remove frequency components.

Doing so using a MOSFET operating in its knee/linear region is stupid, miss leading to new people making them think this is proper design guidelines, not needed to remove higher frequencies as there is no need in a LED application like this, can lead to component failure if applied to other situations.

We can all show new people short cuts in electronics design but volunteers here have gone through a huge effort to instruct new people in proper design techniques. To have someone like yourself come and spew nonsense undermines all our efforts.

Look at the OP user name !

JohnRob:
The 1000 ohm and 3300 pf capacitor is there for a reason. This "smoothing" of the gate drive edges will significantly reduce RF noise generated by the MosFet switching. If you look at the time constant of the RC (ignoring the gate charge for now) the RC is 0.033 µS. Hardly enough to Heat the MosFet. Especially if the switching frequency is in the order of 200 Hz.

The FET already has significant gate capacitance - that is the basis of the whole discussion about switching speed.

It is therefore entirely unnecessary to add capacitance.

If you want slower switching, simply increase the value of the resistance - which should in any case be directly adjacent to the FET.

JohnRob:
The 10k from gate to ground is probably a good idea. However if the OP follows my recommendations this resistor should be more like 50k.

This resistor should not be connected at the gate of the FET. It should be on the source side of the series resistor. It is a default to determine the gate voltage when the microcontroller is not doing so due to a reset or abnormal state. So it should be between that microcontroller output and ground, not at the gate of the FET. It then does not diminish the drive voltage whatever its value.

larryd:
not needed to remove higher frequencies as there is no need in a LED application like this

Interesting. One of reasons for "you must always use a Gate resistor" rule is reduction of the noise caused by inrush current into the Gate capacitance. Here OP is switching hundreds of mAs or even amperes but noise is suddenly no problem? You want to protect the MOSFET from an imaginary harm but do not care about the poor power supply which has to deal with the abrupt changes of load?

I don't want to say I would use a cap on the gate but it is interesting point of view and it should be considered carefully. Not "removed before it spreads".

@Smajdalf

A gate resistor is used in these Arduino applications to protect the output transistors inside the Arduino/micro-controller.

Your statement is misleading.
“ One of reasons for "you must always use a Gate resistor" rule is reduction of the noise caused by inrush current into the Gate capacitance.”

“You want to protect the MOSFET from an imaginary harm but do not care about the poor power supply which has to deal with the abrupt changes of load?”
OMG, it must be a full moon all kinds of crap coming out.

@Smajdalf

From the OP:
“Additional info: Intended use for transistor is to act as switch for about 35 cm strip of led, it should be pulling under 0.2amp at 12v This BS170 resistor looked good enough for my needs but let me know if it has to be changed out.“

“Here OP is switching hundreds of mAs or even amperes”

Amperes :o OMG, where are you get this from did you look at the data sheet for the BS170 ?

500 mA, 60 Volts RDS(on) = 5.0 W
1.8 - 5 ohms @ 10Vgs.

The OP’s transistor isn’t even a logic level MOSFET.

OK...so here's what I know.

  1. Within reason one cannot supply too much current to the gate. Power MosFets are typically driver with 2 to 10 amps from a specialized driver.

  2. The noise I was referring to is that created by a fast switching drain, resulting from a good amount of current supplied to the Gate.

  3. As the Gate voltage rises from Zero, the gate voltage will rise as well until the drain starts to reduce in voltage. For the time the drain is switching from off to on, the gate voltage changes very little. The more current you supply to the gate, the faster the drain will switch. Conversly lowering the gate drive capability will slow down the switching time resulting in less generated noise (EMI)

  4. The -3db point of the generated noise frequencies caused by a fast switching time at the drain is approximately 0.35/rise time. So one can see fast switching times causes radiated noise that can be picked up by nearly anything close by. With a reduction in switching time, the radiated noise can be reduced significantly.

For a simple test I would use a cheap AM radio (hard to find these days). I would tune to the lower portion of the AM band and hold it near the switching device. If the noise could not be heard above hiss on the AM band the design is close and worth testing in the screen room (an RF sealed room used for testing EMC emissions)

NEW SUBJECT:

Component datasheets are written under "ideal" or maybe "unrealistic" conditions. A seasoned designer knows how to interpret these characteristics and can apply them to the design. The novice will eventually learn but for the moment one should assume the MosFet should have a max current of at least 10X the expected current. This 10X number is not cast in concrete but it gives the novice some place to start.

On your part (BS170) The OnSemi data sheet has a note by the max current. "NOTE: The Power Dissipation of the package may result in a lower continuous drain current." This means the heat generated in the MosFet trying to drive 500 ma will cause the MosFet to be damaged as the heat causes the device to exceed its maximum temperature.

This is just the tip of the iceberg regarding the application of a MosFet. You should try to find a good application primer.

larryd:
A gate resistor is used in these Arduino applications to protect the output transistors inside the Arduino/micro-controller.

This is one of the cancer-like misinterpretations spread commonly on this forum. There is loooong topic about this which IMHO proves a pin driver damage is not a valid reason for a gate resistor. Maybe if the MOSFET were really huge and it were switching very light load. Otherwise you damage the MOSFET by slow switching before any damage to the pin may be done.

Smajdalf:
This is one of the cancer-like misinterpretations spread commonly on this forum. There is loooong topic about this which IMHO proves a pin driver damage is not a valid reason for a gate resistor. Maybe if the MOSFET were really huge and it were switching very light load. Otherwise you damage the MOSFET by slow switching before any damage to the pin may be done.

My main reason for suggesting a series gate resistor is in the event the MosFet is wired incorrectly causing a 12V supply into an output pin of the arduino with no current limiting.

Secondly it (when chosen properly) can reduce slightly the rise and fall times and thereby reducing generated EMI a significant amount. This has worked well for me in a number of automotive designs where the EMC requirements rival those of the Military.

You can find this information presented in a more formal manner in the Ott book on EMC.

Smajdalf:
This is one of the cancer-like misinterpretations spread commonly on this forum. There is loooong topic about this which IMHO proves a pin driver damage is not a valid reason for a gate resistor. Maybe if the MOSFET were really huge and it were switching very light load. Otherwise you damage the MOSFET by slow switching before any damage to the pin may be done.

First you say “cancer-like . . .”, you obviously have not had any exposure to cancer otherwise you would not have made this glib statement.

Second you say “Maybe if the . . .”, which says well maybe it is necessary in some situation. Realizing we get all kinds of applications proposed on this web site, best practises are given to new inexperienced users that they can use to succeed in their purpose. Will adding a (example) 220R as a series resistor cause a problem, No! Will this resistor prevent damage to the output to the Arduino, YES, (you, yourself said “Maybe. . .”) Will this resistor lower the rise time of the driven MOSFET output, YES. This is not noise, it can prevent high frequency components from being generated. Noise is viewed from the receiver. Does this resistor dampen/stop the MOSFET from oscillating due to parasitic elements, YES. Does this resistor give ‘some’ sort of protection if the MOSFET shorts, possibly, but that’s a possible side effect and just like a fuse, doesn’t guarantee that protection will work.

Is the series resistor necessary in new user designs? Let’s see, it protects Arduino output over driving, it limits the generation of high frequencies, it dampens/prevents oscillations and yes can give some limited protection when the new user miss wires a cct.
Yes, this resistor is necessary, highly recommended, is best practice for new users, can be used in ‘most’ MOSFET applications that a new user will be exposed to, has no negative side effects and all at the cost of a fraction of one cent.

“This is one of the, . . . , misinterpretations spread commonly on this forum”
No one is forcing you to endure.

Apologies to the OP :frowning: