4

I have a Raspberry Pi2 running Windows 10. I want to control a servo using PWM (porting some netduino code). There does not appear to be a PWM pin at all on the Pi-> with the possible exception of 12 (GPIO 18). Can someone confirm this?

Thanks

Jamie Dixon
  • 4,204
  • 4
  • 25
  • 47

2 Answers2

2

Yes and I doubt it will ever be added to Windows. Windows isn't a "Real Time" OS so it can't make the precise microsecond pulses required for PWM hardware.

Apparently there are breakout boards that could do this (ex: https://www.adafruit.com/products/815)

I haven't tried any yet though.

vidalsasoon
  • 4,365
  • 1
  • 32
  • 40
  • I got a board and solder it all together. The problem is that no software examples are in C# -> Looks like C++? – Jamie Dixon Sep 05 '15 at 14:28
  • You should be able to control the Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface - PCA9685 from Windows and C# with the Nusbio device. – Frederic Torres Jan 12 '16 at 20:18
  • How the type of the system is related to the ability of the OS to support HARDWARE PWM? Its if you emulate PWM in software you do care about timings, and therefore its critical what an OS can guarantee. When PWM is supported in hardware, the OS only sends configuration commands to the chip, but doesn't generate pulses. This is logically the same what you achieve when using an external PWM chip via a bus like I2C. – sich May 09 '16 at 14:44
2

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. There some project works available for that.

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.

Something you might like:
PWM Servo Control (RPi2 + Windows IoT):
https://www.hackster.io/AnuragVasanwala/windows-10-iot-core-ultrasonic-distance-mapper-d94d63

PWM Motor Speed Control & Retrieve ADC (RPi2 + Windows IoT):
https://www.hackster.io/AnuragVasanwala/windows-10-iot-core-hydroflyer-f83190

Anurag Vasanwala
  • 486
  • 3
  • 12