I am using analogWrite(PWM) from Arduino UNO to control the gates of 30N06L N-channel mosfets. The values of PWM are programmed such that it controls the current through the loads for my control design. I am printing PWM (as controller's output) every second. Are these printed PWM values averaged one or not? Is it OK to write PWM values(doing some math) as the voltage instead of writing it as duty cycle? The frequency of signals from analogWrite(PWM) pin is 490Hz, which makes the time period of pulse to be about 2 ms. Thus I assume we can take those PWM printed every seconds as averaged one.Furthermore I could not find any information about the frequency response (regarding PWM) from 30N06L N-channel mosfets datasheets? Any suggestions will be greatly appreciated.

  • \$\begingroup\$ Well, 490HZ is too low for SMPS, so I take it that this is just experimenting with hardware and software. Normally the pulse voltage is always at (or close to) the supply voltage. Pulse width is what is used to control power by controlling the ratio of its 'ON' time to its 'OFF' time. Diodes and capacitors average that out to a constant current or voltage. For complete answers could you please separate your observations from your questions, and put your questions last if possible. \$\endgroup\$
    – user105652
    Commented May 24, 2016 at 23:56
  • \$\begingroup\$ Your program will print what you ask it to print. You'd probably have to work hard to make it print "PWM value averaged over the last five seconds". To set the PWM value using voltage, you'd need a function to convert the voltage to the required PWM counter setting. \$\endgroup\$ Commented May 24, 2016 at 23:57
  • \$\begingroup\$ Since the FETs driven by PWM are not driven sinusoidally, frequency response is not a useful concept here. Instead, look at the section titled Switching Characteristics. \$\endgroup\$ Commented May 25, 2016 at 0:55
  • \$\begingroup\$ Thank you o much..Sparky256..My observations are as follows: \$\endgroup\$
    – Dinesh
    Commented May 25, 2016 at 1:54
  • 1
    \$\begingroup\$ This information belongs in your question so that anyone who attempts to answer it has everything they need in one place and not sprinkled through the comments. \$\endgroup\$
    – Transistor
    Commented May 25, 2016 at 6:14

1 Answer 1


Many of your questions can be answered here. Where it says that the output of a PWM is dependent on the inverse of the period of the PWM signal times the integration from time zero to time 1-period of the PWM function:

enter image description here

This is explained in this part the above web page. Bottom line, the output of a PWM signal is the duty cycle.

The Arduino analogWrite() library call accepts a value of 2^8 or 0 to 255. The 100% duty cycle is represented by 255 and 0% duty cycle is represented by 0. This is talked about here. So, no, you can't use the formal value you pass to this Arduino library function as the voltage. Do some research, but I believe the voltage is more along the lines (for a 5 volt power supply) approximately five volts times the value divided by the maximum value.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.