Transmitting APRS packets

APRS packet transmission is now tested and it works.

It is clear that the SA818 radio module is not usable for this project. The time it takes to key up the transmitter and get a decent modulation running is far too long. In addition it seems to vary and it seems like there is some key-down delay as well.

However, there is an alternative, the SR-FRS-1W by Sunrise Electronics. It is only $10, it looks quite similar to the SA818 but this one works. It is the same module that is used in the Sainsonic AP510 tracker. For UHF it comes in two versions, a 1W module and a somewhat smaller 0.5W module. For VHF it comes only in the 1W version. The picture below shows these modules.

modules

I wired it directly to the Teensy 3.1 (for testing in low-power mode it can even get 5V or 3.3V power from it), and after some hacking on the software, it works. I am able to generate test-packets, send them on radio and observe that the digipeater and igate in town receive and pass them on. If I hook up the signal from a receiver to a scope, I can see that the modulation level is moderate – not too much. The somewhat different levels of the 2200 Hz versus the 1200Hz tone is due to FM de-emphasis on the receiver. My signal looks very similar to the packets from the AP510. Maybe not surprising. According to the documentation the mic-level can be set from software but this have no effect as far as I can see. Well, we can live with that.

The software running on the Teensy is partly adapted from Polaric Tracker. It runs with an open source RTOS (ChibiOS).  Code development is now on Github.

The code works in three steps. First, a HDLC encoder thread (hdlc_encoder.c) gets a packet  from the application. When the radio channel is free it starts coding each byte of the packet (bit-stuffing), it computes a checksum and adds FLAGSs at the ends, and it sends the resulting bits through a small queue to the AFSK encoder.

The AFSK encoder (afsk_tx.c) is interrupt driven and gets a tick from a hardware timer 1200 times pr second. At each tick it looks at the next bit from the HDLC encoder. If it is 0, it toggles the frequency of the tone-generator, if it is 1, it does nothing.

The tone generator (tone.c) is described in my previous post here, uses the DAC of the Teensy and a sampling frequency 16 times the generated frequency.