[Pd] Serial port out

Chuckk Hubbard badmuthahubbard at gmail.com
Fri Nov 17 19:58:50 CET 2006


Yeah.

On 11/17/06, Christian Klippel <ck at mamalala.de> wrote:
> hi steffen,
>
> Am Freitag, 17. November 2006 17:26 schrieb Steffen:
> > On 16/11/2006, at 23.53, Chuckk Hubbard wrote:
> > > My plan was to send PWM from my serial port, then use a low pass
> > > filter to obtain DC to
> > > control a Moog synthesizer's pitch.
> >
> > I don't quite understand how a PWM'ed signal put through a low pass
> > filter can give a voltage controlling signal. Care to explain? I'm
> > not even sure how to make the PWM signal at all - will it only be
> > using one pin? I might be daft.
> >
>
> imagine you have a always repeating loop from 0 to 255.
> now compare the wanted pwm value with the counter. if the counter is smaller,
> you turn on the pin, when it is bigger, you turn it of.
>
> that way you have 256 step cycle of always the same length, while the output
> is on (+5 volts), lets say, for 128 steps (50%), ond off (0 volts) for the
> remaining 128. in fact, it is a pulse with a fixed frequency but variable
> pulse width.
>
> if you feed that through a r/c lowpass, the resulting output is an average of
> 2.5 volts (50% of 5 volts).
>
> > I thought the easiest way to obtain such a signal from a serial port,
> > was to make a D/A converter fx with a transistor construction
> > (couldn't just find a diagram on the internet), such that each bit
> > sent to the port would translate to a DC signal. I know the precision
> > of the values might be sloppy and that there will only be 2^{# of
> > data pins on the port} different control values to mess with - but
> > still?
> >
>
> its not done with transistors, but resistors. there are serveral methods, but
> the most common used i think are binary-weighted resistor dacs, and r-2r
> dacs. the first one uses one resistor per dataline, increasing by powers of
> two (like, 500 ohms, 1kohm, 2kohm, 4kohm,....). the second one uses only two
> different resistor values, but twice as many resistors in total.
>
> the problem is the accuracy. a binary weighted dac you can build yourself only
> with very few bits. since the values rise in powers of two, the tolerance of
> the highest-valued resistor may be already more than the total value of the
> smalles resistor.
>
> a r-2r dac is a bit better, but still for many bits, it is too inaccurate when
> you build it with standard components.
>
> a small overview of how dac's are constructed (figure 1 and 4 are the the ones
> i talked about):
> http://www.analog.com/en/content/0,2886,761%255F795%255F91287,00.html
>
> note that while dac chips actually use these techniques, you will fail to
> build such a dac yourself with good enough accuracy. in the chips, they use
> highly precise, and often laser-trimmed, resistors (usually on-die).
>
> > I read about it in Delton T. Horns Music Synthesizers: A Manual of
> > Design and Construction, if i recall correct, where the author
> > suggested to use a S/H in connection with such a converter to save
> > CPU power (when one wanted to keep a given CV for a period of time
> > (faster then the port)).
> >
>
> this is only usefull if you want to digitize a changing signal. you use the
> s&h circuit (usually just a capacitor and a switch) to "freeze" the current
> value, so it stays stable while you digitze it. to digitize a signal, you
> basically need a dac, s&h and comparator. you load the s&h, set a value at
> the dac, and compare the two voltages with the comparator. you change the dac
> value so long until you have a match between the two voltages. then you
> discharge the s&h, and go ahead with the next sample.
>
> > > Christian Klippel, however, has kindly offered to create a USB->CV
> > > adaptor for me, something others have suggested but which has
> > > proven too confusing for me.
> >
> > That's very nice. I'd really love to make such a lil' donkey myself.
> >
>
> once it is built and working, i will put it online.
>
> greets,
>
> chris
>
> > _______________________________________________
> > PD-list at iem.at mailing list
> > UNSUBSCRIBE and account-management ->
> > http://lists.puredata.info/listinfo/pd-list
>
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>


-- 
"Far and away the best prize that life has to offer is the chance to
work hard at work worth doing."
-Theodore Roosevelt




More information about the Pd-list mailing list