Main Site Documentation

GPIO Usage (Extra PWM channels?)



I am very, very new to this kind of thing. I am in need of controlling 5 servo’s (on different channels). I understand I need to use PWM to control these servos, and you typically do that on a “P” socket I have both a fez hydra & a fez spider. I see the spider has two “P” sockets while the hydra only has one. The P socket pin layout describes it as having 3 pwm channels and 2 GPIO (General purpose input/output)

I would really like to use the hydra for this specific project as it can use as much processing power as it can. Can I re-task the GPIO pins to emulate a PWM channel? or are there any other possibilities to extend my PWM channels?

Thanks for any insight!


Each P socket has 3 PWMs. So, using an Extender module you can use all three separately for each of your Servos. If you need additional you can use OutputCompare() to create a PWM signal from a digital (X or Y socket) pin. Check out OutputCompare in the tutorials. If you really must have all hardware PWM then there are chips that you can add on to provide those. However, that’s probably beyond where you’re at at this point is sounds.

Welcome to the community!


@ BoogieMan

You should be able to generate the necessary PWM signal using OutputCompare. Keep in mind, however, that you’ll be using up CPU resources to do so, which may impact performance:

Here’s some info on the TinyCLR wiki on OutputCompare:

The tutorial info is not Gadgeteer-specific, but you may be able to gather enough from it to use OC to generate PWM on a non-P socket.

This blog post shows how to do both hardware-based and software-based (using OC) PWM, albeit again for a non-Gadgeteer FEZ board.

Last, but not least, while it doesn’t address directly the particular issue you’re asking about, you may want to keep this handy:

It’s a preview e-book written by Gus that has a lot of good background info on Gadgeteer, and GHI’s offerings, and is a must-read for anyone getting started with .NET Gadgeteer, IMO.

Welcome to the community!