Bell 202 Modem (1200-baud AFSK) Object
Phil Pilgrim (PhiPi)
Posts: 23,514
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 modulation part of "modem". At the receiving end, the audio is demodulated 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-5s 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
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 modulation part of "modem". At the receiving end, the audio is demodulated 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-5s 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
Comments
BTW, what software did you use for the Monitor software?
*Peter*
This is excellent, I need this exact thing for my project. I will be following this thread very closely,
regards
Dave M
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps:· SixBladeProp, TriBladeProp
· Prop Tools under Development or Completed (Index)
· Emulators (Micros eg Altair, and Terminals eg VT100) - index
· Search the Propeller forums (via Google)
My cruising website is: ·www.bluemagic.biz
Hanno
Hanno
How about adding a hybrid schematic for connecting to a 2 wire PSTN phone line?
Where is the DTMF detector and generator object?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps:· SixBladeProp, TriBladeProp
· Prop Tools under Development or Completed (Index)
· Emulators (Micros eg Altair, and Terminals eg VT100) - index
· Search the Propeller forums (via Google)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
Very nicely done!
Your front end up to the low-pass filter is very close to what I did with·the Audio Spectrum Analyzer.· I haven't looked at your code, because I did not see it in the OBEX yet, but I assume you can adjust the frequencies to something other than 2200Hz and 1200Hz if you wanted to?· I'm thinking this might be applicable to short distance "spread spectrum·communication" with IR,·if you can also increase the number of channels or "audio voices"
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Phil, great object! Now to find an excuse to use it somewhere. [noparse]:)[/noparse]
Second that DTMF stuff! Be fun to convert my PropBBS stuff over to this.
This circuit just became a mandatory addition to my Proputer. [noparse]:)[/noparse]
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Check out: Protoboard Introduction , Propeller Cookbook 1.4 & Software Index
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card connected? - PropDOS
I think I have the worst cell phone service on the planet... half of every word, noise chunks, the whole nine yards.
Am full up at the moment, but planning to put your system to a REAL test.
Where can I buy the kit?
Thanks,
Rich
To follow up on Jay's post, do you know what additional layers would be required to support outgoing and/or incoming APRS?
Homing in on a balloon flight with a hand-held unit that would compare current position of the operator (via a GPS) with the transmitted coordinates (via RadioPhil) looks feasible now.
Cheers!
Paul Rowntree
You're sorta joking about buying a kit, right? Don't say stuff like that, because the little business guy inside starts thinking about what I can sell you. This app doesn't require much, as you can see from the schematic. Just a few passives and a transistor, along with a medium to transmit and receive tones (phone line, radios, etc.). Phil cautions against the use of FRS, but it'll do the job, too. There are some restrictions, but you can figure them out.
@Jay,
You got that right! 2-meter APRS all the way - that's the plan for my PropBot since Phil made the whole thing accessible to a programming ding-dong like me.
@Paul,
Phil's project has some error-checking built into the signal conditioning, but multiple send/confirm/checksum type of operations are necessary. There's no limit to what people may want to do in this regard. My approach for APRS would be simple: send the same thing three times - get the right data twice? If you combine Phil's work with Cam Thompson's Float32 object you can now do APRS with distance and heading calculations. I don't think this would be so easy in other processors, but these guys have packaged up tidy objects that are useful with high-level programming.
Thanks Phil!
Ken Gracey
I wasn't joking except for the fact that Phil does all of this incredible stuff and never goes that extra step to put it all in a bag and
offer it up to the great unwashed masses[noparse]:)[/noparse]
This kit, I would buy, because if I want to test it, I would want to understand it completely, and most importantly because I would want to build it right[noparse]:)[/noparse]
I will remind you that in the beginning, I couldn't get Chip's video to work and that requires 4 resistors and a ground line[noparse]:)[/noparse]
3 tries ... and I only managed to get it to sort of work by adding some potentiometers.
On the other hand... the little video kit from SpinStudio was really fun to put together and works perfectly. Mindless activity for a mindless moment[noparse]:)[/noparse] AND once you put a kit on sale... it is permanent advertising for the concept and for the Propeller. Otherwise it all becomes a link that no-one can find. What are the chances that a newbie to this site will see this thread three months from now? But if it is on a site somewhere as a kit... it will always be found by googling it.
Rich
I'm committed to another project now, but I'll revisit the ballon when I'm done. Hopefully someone will have written an APRS layer by then, if not, I'll tackle it.
You have addressed a real communication problem we have (and a support problem/product opportunity as you identified): amazing apps get buried in these forums and never resurface. Having a kit for sale would give it continued presence on our web site. I think we already have the parts in stock, and they're inexpensive, so let me see what I can do.
I truly appreciate the ideas.
Ken Gracey
Parallax, Inc.
Very Very Cool Phil!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·- Ouch, thats not suppose to be hot!··
Michael King
Application Engineer
R&D
·
An ARC-5? (For those that don't know, it was a navy surplus transmitter that was popular with DIY hams.) I found a 2007 ARRL handbook on a bargain table, and have it on my shelf near my yellowed 1979 copy. It's a great reference, and I might add, substantially updated! Other ARRL publications are good too. I still have a copy of the surplus conversion manual that I used for an ARC-13 back in the day.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Now to answer some questions:
Peter, the monitor software is written in Perl. If anyone's interested, I could post the source. It's no big secret, except for a total lack of comments.
William, here is a document I found online that shows several hybrid circuits. I plan to try one as soon as some "real work" on my desk gets done. Radio Shack carries transformers that ought to work for this, although they're not center-tapped, which rules out a few of the circuits presented. As I emphasized in the documentation, though, you need a Part 68 approved DAA to connect anything to the public phone system. A simple transformer is not sufficient.
William, DTMF generation would be an easy addition to make. DTMF detection is a bit more difficult, since you now have eight frequencies to detect instead of just two. But there's an algorithm (the Goertzel algorithm) that would be more appropriate for this than the I/Q mixers I employed for the AFSK. It's on my list to try.
Beau, it should not be difficult to change either the baud rate (within reason) or the modulation frequencies. There will be a point, though, where additional frequencies will consume more time to demodulate than is available in one sub-bit time. I've also been thinking about the IR issue but am leaning more towards orthogonal codes for multiplexing — something like CDMA.
Rich, there is a board in the works that's mentioned in the PDF (Propeller Backpack). I've attached a photo below. (It's the little board rubberbanded to the battery pack.) It contains a Propeller and all the passives and PTT circuitry mentioned in the document, along with some video circuitry. More on this later...
Jay, Paul, I have no idea about APRS. I guess I've got some reading to do!
It has occurred to me that 8-bit ASCII is pretty wasteful of valuable bandwidth for sending simple alphanumeric data. I may do a mod for Baudot code, which should improve throughput substantially, although the shifting required is a bit scary over an unreliable data channel. (If you've ever seen a Western Union teletype stuck in the wrong shift, you'll know what I mean.) Forward error correction is very intriguing, too. At these slow baudrates, you want to make the initial transmission as bullet-proof as possible, in order to save handshaking and multiple channel turnarounds, which have a huge overhead. There's also the AX.25 protocol used for amateur packet networks.
So much to do!
-Phil
As heater manages to squeeze more and more instructions into the CP/M project, one could envisage having another cog devoted to running modem software into a raw RF module, and hence save another $20. CP/M itself *might* be fast enough to process audio signals with a dedicated A to D chip and 8Mhz or more on the clock. But it wouldn't be able to do anything else. This is where the multiple cog concept of the propeller really shines.
Alternately, if the required online power is less than (90mA from memory) you can draw this from the line (if the only one on the line) and opto isolate the 1200 baud serial side. This would be a much simpler circuit - no transformer. It will be too expensive to have it certified, given the return on investment. :-(
There is a packet modem (Pactor) used by the boating fraternity (and amateurs?) on HF Radio. APRS is also mentioned. It sells for >$1000. A replacement for this would be fatastic, but it uses compression and forward error correction. Originally started at 1200 baud. http://www.scs-ptc.com/
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps:· SixBladeProp, TriBladeProp
· Prop Tools under Development or Completed (Index)
· Emulators (Micros eg Altair, and Terminals eg VT100) - index
· Search the Propeller forums (via Google)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
The Tucson radio group (http://www.tapr.org/) has extensive docs on coding APRS directly using PIC systems, sometimes with a modem chip. They have quite a strong hardware orientation too. The code is generational, so sometimes it is hard to find the original source, but the group is quite helpful. I tried to do this with a prop, but did not get much more than static out. The CRC beat me, as did some of the compression issues. Obviously, this forum attracts a better breed of coders than I !
As Jay pointed out, if the radio link is solid and you are willing to roll your own code on the receiver, there is no fundamental need to use APRS packet protocols.
Cheers!
Paul Rowntree
The word "this" in Jay's message is a link to the PDF. It took me several tries, since the ftp site was busy. APRS appears to be a layer on top of AX.25. Here is a link to the AX.25 protocol stuff, for anyone who wants to wade through it.
I agree that for simple position reporting, there are surely less complicated ways to do it. But they probably wouldn't be compatible with the wealth of real-time mapping software that's available.
-Phil
Some radios can inhibit transmission if they detect a carrier strong enough to break squelch. The Yaesu VX-2R, for example, has a "busy channel lockout" setting which blocks PTT initiation if another station is transmitting. But it won't inform you that it's done so, except that the red "transmit" light won't come on. It may be possible to kludge a sensor onto the LED to see if it turns red after triggering the PTT. The same LED also lights green when a carrier has been detected during receive. Again, a sensor could be kludged onto it to detect a busy channel before activating PTT. Both are rather inelegant solutions, and I wish there were something better...
-Phil
I hadn't thought about that lockout feature, that'll work for now. I'll be operating on the digital simplex portion of the 2 meter band and Arizona's frequency coordinator should have a chunk specifically marked for digital modes only, I'll see how the 31/19 check works for that.
I came up with another question while I was setting up a test circuit...
Which method of demodulation would you suggest we use?
I used the "thresholding" method to test with and I seemed to get pretty good results. Is there a big benefit to the A/D method?
-Sean KD0EHH
You'd just have to try it with your radio. Also, unless you can solder the feedback resistor very near the Prop chip, the A/D method may be more trouble than it's worth. Finally, while using the A/D method, I've cranked up the speaker volume high enough to get clipping (equivalent to thresholding), with no apparent decrease in reliability. Looking at it theoretically, I suppose the mixers are efficient enough at filtering out the square waves' odd harmonics that the latter do little to interfere with detection.
-Phil