hz through IRLB8721PBF Mosfet

Hey! I am getting strange results.

I want to send out diffrent hz from an arduino uno and from the output I have the right hz but when going trough the IRLB8721 Mosfet it displays way of.
If I put 100 from arduino it displays 100 trough the mosfet, but if I go like 4500 it displays around 9000HZ, and still if I measure the outputpin from arduino it is the same as it should but not when it goes trough the transistor and is sutch a high hz. Is the mosfet bad for this things?

//Measuring on a multimeter.

Datasheet: https://www.tme.eu/Document/b69003e9a3061f81b201d4c8f0c01a07/irlb8721pbf.pdf

Please post your schematic.

Here is the schematic.

Er, um. 22uF on the MOSFET gate? Whaaaaaat??? You’re lucky if PB2 isn’t blown.

aarg:
Er, um. 22uF on the MOSFET gate? Whaaaaaat??? You're lucky if PB2 isn't blown.

Ough I wrote wrong on the shcematic... It is a 100uf! Sorry

That's even worse. Any other surprises?

You have 5v connected to the 328 pin 4, why ?

100µF :o, why ? very odd thing to do !

No decoupling capacitors :confused:

What should I have instead? It did not work without a capasitor?

maker-20_:
It did not work without a capasitor?

Is that a question, or statement?

And on the Gate. That does not look correct at all. Use a 100K resistor to keep the MOSFET off while the '328P is in reset state (and all IO become inputs).

Need 0.1uF caps on VCC and AVCC.

aarg:
Is that a question, or statement?

It did not work without a capasitor, so what would you do?

CrossRoads:
And on the Gate. That does not look correct at all. Use a 100K resistor to keep the MOSFET off while the '328P is in reset state (and all IO become inputs).

Need 0.1uF caps on VCC and AVCC.

Thanks CrossRoads! Will do that!
My battery is a 5.1v 2.1A powerbank, How should I do with that? Put 0.1uF cap between powerbank and the powerinput of this circuit?

0.1uF caps should ALWAYS be located as CLOSE
to digital ICs Vcc pin as physically possible.Typically
that means 1cm to 1" from the Vcc pin. This has been standard practice since the dawn of digital ICs
back in the early 70s. If you read Don Lancaster's
TTL COOKBOOK (the bible for digital logic ICs) you'll see him recommend that. (that looks like my
copy)

Don Lancaster's TTL COOKBOOK

(Is that better Paul_B?)

maker-20_:
It did not work without a capasitor, so what would you do?

I would scratch my head, check my wiring and sketch, read the MOSFET data sheet for clues (compare specs with my driving voltage/current/timing), if all that checks out I would then scope it. After that, it's hypothetical because it would depend on what I see on the scope traces.

The 0.1uF should be on the chip. Maybe mount them under the chip on the board.

If you connect the MOSFET correctly with no capacitance on the gate, and 150 ohm
gate resistor you'll be able to switch in less that one microsecond. Just use the standard
circuit.

Putting that huge capacitance on an output pin may have damaged it already though. Test the
pin with a resistor+LED perhaps?

Where did you buy the MOSFET? Could it be counterfeit?

Hi,
If you are measuring your output frequency at the MOSFET Drain.
Put a 1k LOAD resistor between the drain and 5V.
Measure between gnd and Drain.

Tom... :slight_smile:

MarkT:
Putting that huge capacitance on an output pin may have damaged it already though.

I wonder: did you (of anyone) ever managed to damage an AVR output by a capacitive load? I don't want to say it is a good idea but I doubt the described behaviour is due to a damaged output.

@raschemmel: TTL??? It is ancient! Don't you have the RTL cookbook?

@OP: you need some ceramic caps as close as reasonably possible to the ATMega power pins - between Vcc and GND. The cap on the Gate is a bad thing. What it does without it?

Smajdalf:
@raschemmel: TTL??? It is ancient! Don't you have the RTL cookbook?

I cry every time I think of the clean, thick hardcover edition of the TI TTL "yellow book" from the early 70's that I had, and lost to the moving wars. There was a time that every digital person had to have one on the shelf.

Putting that huge capacitance on an output pin may have damaged it already though. Test the
pin with a resistor+LED perhaps?

@MarkT,
Why would a 100uF cap on an arduino output pin damage it ? I'm not seeing it. Can you enlighten me ?