I've just posted a Bell 202-compatible modem object to the OBEX (publicly visible soon in the Signal Generation and Processing section, under the heading "Modem, Bell 202"). With this object and a few external components, you will be able to communicate data via an audio channel (hardwired, AFSK FM, etc.) at 1200 baud half duplex.
This modem software converts serial binary data to frequency-shifted audio, such that a "0" is a full cycle of 1200 Hz sinewaves, and a "1" is about 1.83 cycles of 2200 Hz sinewaves. This is the mod
ulation part of "modem
". At the receiving end, the audio is dem
odulated back into binary data:
The modulator makes use of the Propeller's built-in sine table, along with a counter's DUTY output, which is lowpass filtered to yield an analog signal. A simple audio output circuit can be constructed as follows:
The schematic includes an optional multiplexed push-to-talk circuit (transistor and two resistors) that will work with many radio transceivers.
The demodulator makes use of a counter on the input, either as a delta-sigma A/D converter or as a simple threshold detector. Here is a schematic that is used with the latter detection mode:
The input, either clipped square waves from the circuit above or actual sinewaves from the A/D, is sliced and diced using a combination of software-defined mixers, Fourier analysis, lowpass filters, and comparators to reconstruct the original binary data. Here's a block diagram of what the software does:
You will notice that there are three programmable parameters: Offset, Hysteresis, and Noise Level. These can be tuned in real time for the most reliable reception. To aid in this tuning, I've included a Windows-compatible host program which, along with a companion Spin program, will allow you to optimize the demodulator's performance. Here is a screen shot of the program in action:
The colored dots plot the instantaneous filter outputs against each other. Red dots are "1"s; green dots, "0"s; yellow dots, in the hysteresis band. Anything above the diagonal white line is signal; below it, noise. The bargraph plots the relative number of comparator outputs counted for each bit. The idea is to balance this number to zero using the SLICE (offset) slider. The panel on the right shows the demodulated output, which can be compared with the transmitted data for accuracy.
This is just a sketchy description of the modem object and what it does. There's much more in the PDF documentation accompanying the object in the OBEX. Hopefully, this will turn out to be useful for things like telemetry, remote control, and similar apps. This is just a simple modem, too. There's much more that can be done, for example, with things like forward error correction to make data transfer over noisy channels more reliable.
This whole project was inspried by Ken Gracey's post on wireless data communication using 2-meter HT radios
. When I suggested to him that the Propeller could perform the modem functions, he leapt at the idea, lent me a pair of radios, and suggeted I get a ham license so I could make it happen. So I got my license, wrote some code, and here it is. None of this would have happened without the encouragement and support that's become a Parallax hallmark. Thanks, Ken!
I can't leave this without saying more about amateur radio in general. When I was a teen, I had a ham license. Back then, it was one of the few outlets available for those with an electronic techie bent. Personal computers were still a distant dream, like flying cars. Of course, all that has changed in the intervening years. Computers quickly caught my fancy, and I let the ham license lapse. (I never did like "rag chewing" and was in it more for the technical thrill than — shudder — talking
to anyone.) Before this project came along, I never gave ham radio another thought. Frankly, it seemed to be the domain of old farts who yearn for the warm glow of vacuum tubes over anything more modern. (Unfortunately, some of the current ham radio magazines do little to dispel this point of view. After all, how many articles about ARC-5
s do we really need?)
But forget all those preconceived notions! On the contrary, my experience with the modem project has revealed that a wealth of fun, high-tech opportunities await anyone who takes the (minimal) trouble of getting a ham license. It really is the entr