02-08-2018 09:17 PM
Hi everyone,
I would like to seek help in controlling the speed of a 4-pin DC ventilation fan. Currently, I am using an n-channel MOSFET (IRF520) to switch on the fan whenever the switch is in the ON state. This portion works successfully, but however, the fan speed is not at its full potential. I was intending to use PWM to adjust the speed of the fan but however, I am unable to do so. My front panel, block diagrams and wiring connections are as shown below.
My wiring connections. There is also an additional connection from the PWM wire of the fan to digital pin 9
Any advice will be a great help, thanks!
02-12-2018 01:55 AM - edited 02-12-2018 01:57 AM
Hi omg,
put the Init function in front of the loop and the close function behind the loop!
They should be called just once and NOT with every iteration of the loop!
(Also the functions defining the output mode should be called once before the loop. Did you set the correct mode for the PWM pin? Do you wire the correct values for the PWM as there is a coercion dot visible?)
Did you read the warning and it's description?