In 2012, Grav-Corp had a problem. Or more accurately, its dedicated disciples did. Armed with 5W UHF handhelds, a sunny Sunday could be enjoyably spent with two friends walking in opposite directions to the extent of radio contact and exploring the surroundings while doing so. Altogether a pleasant experience, except for a pitfall – how would two distant operators speaking over an insecure channel communicate their locations to each other? Enter the TX-1000.
Two prototype units were built to solve this issue. The TX-1000 was intended to gather location data, then send this over an audio channel to a distant operator. This would be achieved with the help of a handheld UHF radio. The TX-1000 unit was to operate on the principle of Audio Frequency Shift Keying, or AFSK. This involves transmitting high and low frequency pulses in order to represent binary 1s and 0s. The TX-1000 would be plugged into a handheld radio and would listen for these pulses from another TX-1000, decoding the data and displaying the latitude and longitude of the distant operator, as well as a distance and bearing readout.
Initial experiments were moderately successful. Serial GPS units were obtained and connected to an Arduino Uno with minimum fuss. This EM-411 module from DealExtreme was used along with another salvaged from an old AWA brand vehicle navigation unit. Newer units may be cheaper and have better reception and faster updates, however for this project, intended to be used at walking pace in open outdoor areas, these units were perfectly adequate.
For AFSK, two tones are required at different frequencies to represent binary data. To generate these tones, first attempts were made by using the Arduino to bitbang a pin at a particular rate using the built in delay libraries. With some basic fine tuning on the oscilloscope to account for the poor accuracy of these routines, tones at 1200 and 2200 Hz were achieved, inspired by the well known Bell 202 AFSK standard. Note one benefit of these particular tones is that neither is a straight harmonic of the other, reducing one source of possible errors.
Early attempts at decoding this data focused on using the FreqMeasure library by Paul Stoffregen. This is a library that uses interrupts on the Arduino and some witchcraft to determine the frequency of a signal on an analog input. This library works well for some applications, however, it was not accurate enough on the fast-changing timescales we required to decode high-bitrate data. We began to look for another solution.
Searching for tips on how to decode AFSK data, we came across this project (sidebar – how great are those old 1980s fluoro line diagrams? How were they made?). Many 1980s home computers used tape drives for storage, by encoding data on the tapes using AFSK. This project uses the XR-2211 PLL chip to decode the tape data. What makes the XR-2211 different from other PLL chips is that it has a special comparator to allow the chip to spit out the data as high and low voltages to be read by other equipment directly. We decided to use the XR-2211 as a high speed, reliable way to decode the FSK data for the Arduino that could then read the XR-2211’s output on a digital pin.
After much hair-pulling and frustration, results began to come. Our reception of the data required us to know when to read the digital pin to get the next bit of data from the transmitting unit. The receiving unit had to be in sync with the transmitted signal in order to know when to read the digital pin to determine whether the next bit was a 1 or a 0. For this purpose we coded a basic initialisation routine. The transmitting unit would send a continuous stream of 1s, then a single zero, then the location data. The receiving unit would listen to the radio. Upon hearing the continuous stream of 1s, the PLL would achieve lock, indicating to the chip a signal was incoming. The receiver would then listen for a transition to a zero. As soon as this transition was detected, the TimerOne library was activated, with the Arduino checking the digital pin for the next bit of data every time the interrupt fired. The TimerOne library was invaluable for this as it is very accurate and less susceptible to random variation then the standard delay library. Once receiving all the data, determined by the set number of bits sent, the receiver would then calculate the distance and bearing to the transmitter and display all the location data on the screen. The equations on this site were very helpful in doing this. In a later post I may outline the data format used, including the error correction necessary to verify the displayed location is indeed what the transmitting operator intended to send. Successful data transfers were had, at times speeds reaching almost 50 bits/sec. Very, very slow by modern standards but for our first dabbling in AFSK, we were excited. Attempts to increase speed were hampered by the manual tuning of the TimerOne timing to match with the timing of the transmission handled by the standard Arduino delay library, as well as the robustness of the initialisiation routine. Successful transmissions were had at distances of over 3km, thanks in part to our trusty Wouxun and Quansheng 5W handhelds.
Pitfalls were had however. The XR-2211 was very difficult to tune and highly susceptible to power line noise. Keeping the unit plugged into the computer’s USB for testing caused hours to be wasted on confusing results – noise from the computer’s power supply on the USB line were causing the PLL to lock and unlock randomly, and no improvement to the transmission initialisation routine could help. Running on dual lithium cells helped a lot, however a later transition to using boost converters in order to run the 5V Arduino on a single cell again brought back PLL woes. This eventually led to the scrapping of the XR-2211 for another chip – a Texas Instruments MX614. This chip, now retailing for over $15 AUD on Ebay, implements the Bell 202 standard entirely in and of itself. However, this was a late effort and with tempers already running high over the failures of our first major project, we deemed it time to move on to the next big thing for us – the upcoming GRAV-A and GRAV-B.
Stay tuned for more projects, and leave your thoughts or suggestions in the comments below!