0

I'm currently working on a project which requires more than one PWM signals for my LED drivers.

I'm not looking for any additional hardware for this and so my focus is mainly on software PWM. Based on the example from: http://raspi.tv/2013/how-to-use-soft-pwm-in-rpi-gpio-pt-2-led-dimming-and-motor-speed-control

Has anyone succeeded in creating 3 or more software PWM signals? If so, are there any precautions to be taken by doing this? Your help is much appreciated. :)

3

pigpio provides DMA timed PWM on all 21 user gpios, from C, Python, or any language supporting sockets.

video of PWM for 16 LEDs.

What do you mean by precautions?

| improve this answer | |
  • Thanks for your help. I'm currently trying out pigpio. By precautions, I meant, the limitations of it. For now, May I know if it's possible to run 3 PWM signals all at 4000Hz? Is it safe for the RPi? – wengzhe Apr 18 '14 at 4:01
  • You can use any supported frequency. The (pigpio) default frequency is 800Hz with 250 steps. You compromise resolution with frequency. At 4000Hz you will only have 50 steps between off and fully on (although by changing the defaults you can increase the resolution). The frequency can be independently set for each gpio. – joan Apr 18 '14 at 8:13
  • Ok. I understand now. Thanks for your detailed explanation. – wengzhe Apr 18 '14 at 8:28
1

I use servoblaster for 4 PWM outputs on my Pi, but I believe you can use up to 8. It is very reliable, very very simple to use in any language, and outputs incredibly accurate PWMs up to, I believe, 2.5ms, at nice constant 50Hz. I highly recommend it.

https://github.com/richardghirst/PiBits/tree/master/ServoBlaster

| improve this answer | |
0

The default RPi.GPIO python library already supports DMA PWM on all pins. See http://sourceforge.net/p/raspberry-gpio-python/wiki/PWM/ for documentation.

edit RPi.GPIO doesn't use DMA. I just checked the source code.

| improve this answer | |
  • 1
    As far as I am aware the Rpi.GPIO Python module only supports software timed PWM. This suffers from scheduling jitter making it unsuitable for servos and having visible LED artefacts. – joan Apr 17 '14 at 12:56
  • You're right @joan. I think I got confused with WiringPi. – Gerben Apr 17 '14 at 13:35
  • 1
    You may have been thinking of the similarly named RPIO.GPIO Python module which does provide DMA timed PWM. – joan Apr 17 '14 at 13:49

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