PWM Mosfet driver not working.

Hi everyone,

I would like to control the speed of a motor using a PWM MOSFET driver. I've got a board based on IRF530:

Here's a link to the store (it's in Polish)

I don't have the right power supply to drive the motor, so just for testing, I've connected a regular 12V DC power supply to the DC IN terminals, and a red LED with a 1k resistor to the output terminals. I've also connected the board to a PWM and GND pins on Arduino and wrote a code to change the signal from 0 to 100% duty cycle and back. Basically this setup:

The code is working - the status LED on the board is changing its brightness. However, my test LED is constantly ON with full brightness (turns off only when PWM is at 0%) - so it basically behaves like a switch.

What am I doing wrong?

I don't know. I can't see your code or your actual circuit. But if the onboard LED is changing brightness but the other isn't then I'd guess you have it connected wrong, either to the wrong location on the module or the wrong Arduino pin.


Actually, you need to upload the code, we didn't see any detailing about the problem is.
But, i found something on website page about IRF530, have you check it?

Access >> here & here

Here's my code, a photo of the circuit and better photos of the board itself. The labels on the bottom are Chinese, but google translates them to "Power terminal" - that's where I connected the DC 12V and "Output" - where I have connected the LED.

int mosfetPin = 6;

void setup() { 
  pinMode(mosfetPin, OUTPUT); 
void loop()  {   
  int out = 0;
  for(out=0; out<=255; out+=5){
    analogWrite(mosfetPin, out);
  for(out=255; out>=0; out-=5){
    analogWrite(mosfetPin, out);

Do you have an Ohmmeter to find which screw terminal is connected to which MOSFET terminal?

Yes, I checked.

  • Negatives of the power supply and my LED are connected together
  • Positive of the power supply goes to the Source (right MOSFET leg)
  • Positive of my LED is connected to the Drain (top MOSFET pad)
  • Arduino pin is connected via the optoisolator to 2 resistors on the bottom

You should have:
PS + to LED anode, current limit resistor to cathode to MOSFET drain, MOSFET source to PS - (GND), PS GND to Arduino GND, input to gate to Arduino output pin. NOTE: IRF530 is NOT a logic level part, 5V on the gate will barely turn it on, no good for higher currents. Maybe the optocoupler will let it work for 10V and up.
EDIT: With the opto, you may not need to connect grounds, :confused:

I've checked all the connections on board and made a schematic. The transistor turns on and stays on all the time (It's off only when my PWM duty cycle is at 0%), not changing the brightness of my LED.

Your schematic shows a P-channel, IRF530 is N-channel.

Weird, the datasheet linked on the board page says it's P-channel

The part on the board is labeled IRF5305S

Well, that IS weird, we've been barking up the wrong MOSFET! Do you have a 12V supply?

My bad, the store page just said "IRF530 PWM Driver"

I've got it connected to a regular 12V/2A power adapter

Hmm, I don't really have any control over the layout :confused: I've marked the screw terminals on my schematic.

Is there anything else I could measure/check with my multimeter to find out where the problem might be?

I Think it is connected this way:


Connect your voltmeter black probe to PS - (GND), what do you read with red probe on gate and input NOT enabled?

That board will not support PWM. It has a 10k resistor on the gate

I've checked all the connections on board and made a schematic. The transistor turns on and stays on all the time (It's off only when my PWM duty cycle is at 0%), not changing the brightness of my LED.

That's not a working circuit. You have made a mistake as the gate is permanently clamped at the negative
rail and thus the MOSFET must always be fully on.

Also the resistor values are way too high for PWM to be possible - this could explain the behaviour
you see.

The product is an Aliexpress item.
Here is the overlay provided on the site.

Tom... :slight_smile:

F5305S is a P-CH MOSFET,

Tom.. :slight_smile:

Well from the photo its definitely a 10k and 1M resistor, completely wrong for PWM....