[PD] gpio on the raspberry pi from within pd ?

Charles Goyard cg at fsck.fr
Wed Jul 24 13:16:28 CEST 2013


J Oliver wrote:
> > So from your post, it seems quite straightforward to be able to
> > access the GPIO pins from within Pd.  But I need to be able to
> > create variable voltages (between 0 and 5v) on those pins.  In the
> > post above, you mentioned that you send a float to the gpio object
> > to write a value to the pin - would sending a 0.5 for example give
> > me 2.5v on the pin?  Or is it only on/off (0 or 5v)?   If the
> > former, I'm all set!  If the latter, I'll need to figure out how to
> > simulate a reduced voltage at the pin (likely using PWM or something
> > – but I'm not really sure how I would do that…)

You can add a resistor and capacitor to build a RC filter, and you'll
get a voltage out of pwm. You will have to experiment with different
values to get something stable and fast enough.

See these pages for some information about that:
http://jeelabs.org/2013/06/30/from-pwm-to-voltage/
http://dev.emcelettronica.com/how-to-use-pwm-to-generate-analog-or-analogue-voltage-digital-circuits-part-2
http://sim.okawa-denshi.jp/en/PWMtool.php

As of 3.3V to 5V you can use a transistor before the RC filter.

-- 
Charlot



More information about the Pd-list mailing list