Monday, April 7, 2014

Changes in firmware 1.5

Version 1.5 of the Trackuino firmware is out! It fixes some bugs reported mainly through email and the hab-ham forums.

One of the longest-standing issues was compilation with Arduino 1.0+. This has been fixed in many forks out there, so it was about time it made it to the official code. The 1.5 firmware has been tested with the following IDEs:
  • Arduino 1.0.5 (build tested on an Arduino Duemilanove)
  • Arduino 0023 (build tested on an Arduino Duemilanove)
  • Mpide 0023-20130715 (build tested on a Chipkit Uno32)

Another issue was regarding readability of the signal. You can read this thread for background, but in essence some TNCs have problems decoding the signal when there is a significant amount of imbalance between the 1200 and 2200 Hz tones, no matter how clean the signal is in SNR terms. This problem has been thoroughly described by John Ackermann N8UR in this article.

The problem boils down to the following: usually FM transmitters emphasize the high frequencies of the base band. They do so to improve the immunity to noise and overall SNR of the signal. To counteract this effect, receivers, in turn, de-emphasize the received signal so that the end result is a spectrogram that closely resembles the original.

HX1 modules, however, don't have such a pre-emphasis network. Thus, the power of the 1200 and 2200 Hz tones is distributed equally over the air, but receivers will attenuate the 2200 Hz tone largely, resulting in a signal that some TNCs can't decode. Here is a an example of a Trackuino transmission received by an Icom IC-229H, then fed to my poor man's oscilloscope (Audacity). See the amplitude difference between the two tones?


Now, when you transmit from a balloon, the coverage area will be huge even for 300 mW, so chances are that some receiver or another will successfully decode the signal. On the ground, however, your packets might struggle with local receivers.

The solution is to de-emphasize the 1200 tone, which translates into an emphasis of the 2200 one in relative terms... It's impossible to boost the 2200 either in circuitry or in software because the HX1 is already being driven through its full 0..5V range. This will bring other issues like FM undermodulation (the received amplitude will be lower), but it should improve the overall equalization of the signal.

The same transmission with relative emphasis of the 2200 tone:


Pre-emphasis can be turned on in config.h by setting the PRE_EMPHASIS flag to 1, and is now the default setting.

The other issues addressed by this version are:

Baud rate accuracy

Due to accumulation of rounding errors in the modem code, the baud rate was actually 1201.92 bps on 16 MHz Arduinos. This is within the tolerance of all the receivers I've tried, but it could get worse depending on the actual CPU clock. Version 1.5 uses fixed point arithmetic to achieve a baud rate that is consistently closer to the nominal 1200 bps regardless of the clock speed (1200.03 bps @ 16 MHz).

Simpler modem ISR

I've slimmed down the modem ISR so that the chances of interrupt overrun are lower. The AFSK code now runs asynchronously in the main loop and the samples are fed to the ISR via a FIFO queue. This makes the AFSK code easier to debug, too.

If you have any question or bug report, you are welcome to post it in the hab-ham forums.

6 comments:

  1. Hi!
    Awesome! Maybe this is exactly what I was looking for! We are planning on using your trackuino code on our FPV Balloon! The plan is to send 2,4ghz live video down and use the free audio channel to transmit GPS packages for the antenna tracker! Am I at the right place for this, or will I have trouble to get your code to work on 2,4ghz? :)

    Looking forward to your answer!

    Phil

    ReplyDelete
    Replies
    1. Yes, you can use the gps decoding and afsk encoding portions to create a signal that you can decode with a packet radio decoder from earth. But isn't that overkill? Do you have a page with your project?

      Delete
    2. Hi Javi!

      Great, you can help me! I am fairly new with programming and have only built the tracker so far and written some of the angular calculations for the arduino. My only weakpoint so far was how to send the gps string!

      I haven't got a project page, but could you maybe contact me under my skype name "saphil90"? Then we can maybe exchange emails via skype.
      It'd be awesome if we could get this thing running as I am planning on writing my bachelor thesis about it.

      Thanks for your support!

      Phil

      Delete
  2. Any chance to send you an email? :)

    ReplyDelete
  3. Hi Javi, thanks so much for Trackuino. It's awesome. I've used it successfully for 4 HAB launches. It's a great piece of software.

    I have a fork on Github (https://github.com/johnboiles/trackuino) that adds compatibility with Atmega32u4 based Arduinos (such as the Arduino Leonard and Sparkfun's Pro Micro series). I'd love to merge back in with your new code at some point. I see the repositories in the google code are outdated (the last commit to the Google Code firmware repo was 2 years ago). Is there somewhere else you're hosting repositories where I could contribute a patch? Have you considered moving the project to Github?

    ReplyDelete
    Replies
    1. You have to switch to the "1.5" branch of the firmware repo to see the latest changes.

      I really hate that they removed the "downloads" feature of google code, so... yeah, I'll move the code to GitHub once I figure out how to move the wiki too...

      You can send me patches against the 1.5 branch and I'll consider them for addition if I think they add general value. I'm especially interested in sending sensor data (ie. temperatures) as APRS telemetry packets, so that they get nice plots in aprs.fi. That particular patch would be VERY welcome ;)

      Delete