Re: Sending Serial Data via Audio - Dumb Idea??
Re: Sending Serial Data via Audio - Dumb Idea??
- Subject: Re: Sending Serial Data via Audio - Dumb Idea??
- From: Kevin Boyce <email@hidden>
- Date: Tue, 21 Jun 2005 16:09:06 -0400
On Jun 17, 2005, at 10:28 PM, Peter wrote:
I need to send a continuous stream of a specialized form of serial
data ( a DCC signal for model railways ) to some external
electronics. For various reasons using a serial port is more or
less out of the question, so I got to thinking about using audio
and detecting the signal through say the headphone jack. I know
this sounds dumb (and may not even be possible), but I remember
reading about this method years ago as an alternative to using a
serial port, so I thought I would ask here if it would be do-able.
...In essence a continuous stream of '1's would be a ~18KHz square
wave (01010101010...) while a stream of '0's would be square wave
at half that frequency (001100110011...). A real data stream would
of course be a combination of the two - thus no danger of the
resulting waveform being outside audio frequencies( I think!).
Except that the headphone out (or any other 44.1 kHz sampled audio)
is necessarily band-limited to 20 kHz, which means that your 18kHz
output will be a sine wave, not a square wave. (You won't have any
of the third harmonic, so it really will be a pure sinewave.) Even a
signal at half that frequency will not get the third harmonic in.
Depending on how the locomotives detect the signal, this may or may
not work.
Although actually the maximum frequency is 8.6 kHz (1/116
microseconds), so maybe it might work.
Okay, I looked it up, and the NMRA standard says:
Digital Command Station components shall transmit "1" bits with the
first and last parts each having a duration of between 55 and 61
microseconds.
And you're not going to be able to control things to that accuracy
with a 44.1 audio system. You have 22.6 microseconds between
samples, so you're not going to be able to control the transitions to
within 5 microseconds. So you may be able to make it work with
certain locomotives, if you're lucky. But what you end up with will
not conform to the standard, and probably won't work in all cases.
Hope that helps.
-Kevin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden