Now that windows 10 Core IoT - final RTM version is available. Are there any ways to program a Windows Universal App to use PWM hardware connected to the GPIO?

I need this for controlling the color of a LED strip. Previously only software / timer based solutions were possible but they do not work well. Documentation is still in Preview.


Hardware PWM and ADC are not supported right now on RPi2 (Windows IoT). You need some extra circuitry which can generate PWM or record ADC on demand. I have done some work to manipulate PWM and ADC which are linked at the end of the answer.

How you can achieve PWM & ADC on RPi2 + Windows IoT?
RPi2 will be connected to a gateway device via I2C/SPI Bus. A gateway device is nothing more than a microcontroller like Arduino. We need to program gateway to respond RPi2. Gateway device will act as I2C/SPI slave. Whenever RPi2 requests to write specific PWM pin, Gateway will generate PWM for that pin on demand.

I have done some work on PWM & ADC which might help you:
PWM Servo Control (RPi2 + Windows IoT):

PWM Motor Speed Control & Retrieve ADC (RPi2 + Windows IoT):

  • 2
    If promoting your own work you must fully disclose that. – Steve Robillard Dec 14 '15 at 15:46
  • Sure sir. But I didn't promoting myself instead I just mentioned what is the another possible way which might help others. – Anurag Vasanwala Dec 14 '15 at 16:24
  • Is that not your name in the link above? – Steve Robillard Dec 14 '15 at 16:25
  • 1
    Aslo posting the same answer to multiple questions is considered gaming the system. – Steve Robillard Dec 14 '15 at 16:25
  • 1
    Yes, its the article I written to understand the issue which I can't explain here as it might not be feasible. – Anurag Vasanwala Dec 14 '15 at 16:37

I'm fairly sure the answer is no and will always be no.

See this official Windows blog

  • Improved support for Python and Node.js, including a new Express Node.js project template

  • GPIO performance on the Raspberry Pi 2 has improved by 8X to 10X

  • Analog-to-digital converter (ADC) and pulse-width modulation (PWM) are now supported via breakout boards and ICs

  • New Universal Windows Platform (UWP) APIs give apps easy control over system management features like time zone and network connections

  • I saw this info, however, why do you thing it will always be no? :/ Also, no one wire chips, like temperature sensor... ? – Hrvoje Kusulja Aug 12 '15 at 22:10
  • @hkusulja Perhaps I am being unduly negative. I know that implementing PWM on the hardware pins is fairly trivial. I suppose my reasoning is if it was going to be done it would have been done by now. As for 1-wire there is little evidence that Windows IoT can deal with the microsecond timings needed. – joan Aug 12 '15 at 22:17
  • so where is a example for this 1 wire chips ? – Hrvoje Kusulja Aug 14 '15 at 6:23
  • @hkusulja I do not use IoT so may be mistaken but I am not aware of any 1-wire devices working on the Pi with IoT. – joan Aug 14 '15 at 7:39
  • DS18B20 Temperature Sensor works fine on RPi debian version – Hrvoje Kusulja Aug 15 '15 at 9:09

Check out Microsoft.IoT.Lightning.Providers. To implement pull down "Microsoft.IoT.Lightning" via Nuget (the source is at Microsoft.IoT.Lightning.Providers project). From there follow the usage example in PwmConsumer. It worked well enough to variable speed control a motor.

Here's a code sample that sets the duty cycle to 25%:

LowLevelDevicesController.DefaultProvider = LightningProvider.GetAggregateProvider();
pwmController = (await PwmController.GetControllersAsync(LightningPwmProvider.GetPwmProvider()))[1];
motorPin = pwmController.OpenPin(5);

I also put together a blog post on PWM in Windows IoT with in-depth step by step details about how to do this.

  • Can you share a code with this please? Thank you – Hrvoje Kusulja Mar 28 '16 at 9:09
  • Added a code sample as requested. Setting this up was a bit tricky, so I'm actually working on a blog post, which I'll also reference when done. – Lee Richardson Apr 4 '16 at 4:02

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.