Difference in pwm brightness depending on the board

I am using mosfet to control the brightness of the LED.

used Mega, Due, and Teensy4.1

When using the Mega, the brightness of the LED was very bright, and when using the Due and Teensy4, the brightness of the LED was reduced by half.

I think it's the result of the difference in pin voltage.

I tried adjusting the PWM frequency, but that didn't work. ( 15bit 4577.64hz ~ 8bit 585937.5hz )

When the voltage supplied to the MOSFET is 5v and the voltage of the Arduino is 3.3v, do I need to connect a diode?

Please provide a schematic how it's exactly wired; a reasonebly sized phot (around 300 kB) of a handdrawn one is OK.

Is the wiring correct?

mosfet is N channel, not P channel. sorry

Does the led have a resistor ?
Which mosfet is it ? (type, brand).
Sorry, but we really need to know these details.

I think that the schematic is incorrect for a N-channel mosfet.

LED (plus resistor) between drain and 3.3V or 5V; source to ground. Gate via resistor to Arduino. You can replace the motor in https://www.gammon.com.au/motors by led plus resistor and omit D1.

1 Like

This is 'IRLML2502'.
The voltage supplied to the LED is 2.5v.
If I change this to 'IRLML2803' will it work?
LEDs require 3~3.3v.

The circuit in this configuration worked normally when MEGA was used.
Works at half brightness on DUE, Teensy4.