I d'like to test if the PWM mode is working correctly on the pins of my Arduino Board. Do you know a simple schema to do this ?


There are my options:

  • The default way to do this is to use an oscilloscope. These can be quite expensive.
  • Use a logic analyzer if the voltage is logic/binary (0 and 3.3 or 5V). These are very cheap.
  • The easiest way to know if it works without the devices above, is to lower the speed drastically (using a divider in the software, like 1000 or more to get PWM widths of 100 ms to multiple seconds) and connect the PWM output with a resistor and a LED to GND. If the LED flashes faster, the PWM speed is high, otherwise low. By using a stopwatch you can roughly calculate the PWM speed (taking the divider into account) and after the test remove the divider.
  • If the PWM is controlled completely from your Arduino (probably not), you can use a software counter and print it out afterwards to see the speed.
  • 1
    ha ! I knew that this cheap Chinese oscillator i bought one day could finally be useful at something. thank you – snoob dogg Apr 16 '18 at 12:12
  • Do you have a DSO150 (analog?) scope or a digital logic analyzer? Last are really easy (and much faster, 8 channels) and cost less than 10 dollars. – Michel Keijzers Apr 16 '18 at 12:13
  • 1
    this is a DSO Shell from JYE Tech , really cheap and poor but should to the job :) – snoob dogg Apr 16 '18 at 12:17
  • Sounds good, I don't have such a digital oscilloscope but planning to get one eventually. I have a very old analog one but it is very hard to use (bad CRT). Anyway with your oscilloscope it should be possible to find out the PWM speed. – Michel Keijzers Apr 16 '18 at 12:20
  • 1
    I just tried it and my PWM works correctly : ) – snoob dogg Apr 16 '18 at 12:28

You could just do a simple analogWrite, varying the duty cycle, with an LED/resistor. Fade the value up & down, see if the LED gets brighter & dimmer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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