[PD] arduino-help.me.please.pd [gadlletas]

Hans-Christoph Steiner hans at eds.org
Tue May 30 00:41:01 CEST 2006

On May 29, 2006, at 5:35 PM, Martin Peach wrote:

> Christian Klippel wrote:
>> hello,
>> servo's are _slightly_ different in that they dont take the  
>> classical pwm that you can regulate from 0..100%.
>> instead, a servo needs a repetetive pulse between 1 and 2  
>> miliseconds.
>> that pulse train can have a frequency from 30 to 400 hz, for  
>> example, but the pulse width stays in the same range. a pulse of  
>> 1.5 ms positions the servo into the center, 1 and 2 ms are for the  
>> full movement to the left or right respectively.
>> in the controller you need a loop (or, preferably, an interrupt)  
>> that just waits some 20 ms, then sets the pulse on, waits 1 to 2  
>> ms, and turns off again, then repeat ....
> ...or a 50Hz pwm with a positive pulse width varying between 5 and  
> 10 percent. Doing this from a soundcard output is bad because 50Hz  
> is close to the low-frequency cutoff of the card, so the parts of  
> the pulse that should be at either 0V or 5V will actually drift  
> towards each other. You would need to add a comparator to get a  
> digital level signal.
> The arduino digitalWrite command in conjunction with  
> delayMicroseconds (for the positive pulse)and delay (for the  
> negative pulse) should be OK for this.
> Martin

So it should be possible to generate this signal in Pd and output it  
via the serial port to control a digital output pin.  The serial port  
runs at 115,200 b/s, which is more than enough to control something  
at 1-2ms.  The question is whether you can get an steady stream.  If  
there is too much jitter, then it wouldn't work.

To make Pd do this is message space, you could change the block size  
to a very small amount.  I wonder if this would work...



"Computer science is no more related to the computer than astronomy  
is related to the telescope."

More information about the Pd-list mailing list