Thread Tools
Aug 18, 2017, 04:48 AM
Registered User
Thread OP

Build a Reliable and Cheap Antenna Tracker this Weekend by zs6buj

zs6buj Antenna Tracker

Version 2.00 Beta released - use with caution for now. Please report problems.

Multi-protocol single firmware version with OLED display support

* 360/90 or 180/180 degree servos
* Bluetooth input option
* Tracker positioning by FC Compass, GPS or Tracker's own compass
* Target Teensy 3.2 , STM32F103C Blue Pill or Maple Mini

Mavlink 1 & 2
Frsky X - S.Port
Frsky D - legacy
Frsky Mavlink Passthrough

MSP and GPS planned

The source code can be found on GitHub here

A while back , like many RC enthusiasts I found myself in need of an antenna tracker for 2.4GHz and 5 GHz video and telemetry. After looking at the commercial and DIY alternatives I felt that my exact needs were best met by building one from scratch. - Ok, maybe the truth is, like many of you, I wanted to build one anyway!

There is of course no reason a tracker like this could not be used for any frequency or application. It will work well for 5.8GHz analog video, for example. However, higher frequencies and smaller antenna wavelengths suit the small footprint better.

So these are the criteria I wanted to meet:
  1. Solid and reliable performance.
  2. Simple and affordable (read cheap).
  3. Small footprint, portable.
  4. 360 degree coverage
  5. Support for small 2.4GHz and 5GHz antennas with at least 10dBi gain.
  6. Easily obtainable parts.
  7. Support for cheap and simple az/el servo mechanism.
  8. Simple, understandable software, easy to flash.
  9. Support for Mavlink telemetry from Pixhawk or APM.
  10. Serial, WiFi, Bluetooth or Ethernet telemetry input.
  11. Be fun to build.

Some of the trials and tribulations appear in the Ez-Wifibroadcast thread elsewhere in the forum, but since several people have asked for more detail I decided to put together this Mini-HowTo

In this thread I will show you where to buy the parts, and take you step by step through the build process with pictures. Once you have the parts on hand, you should be able to build and test the tracker easily in a weekend. I’ll also show you some examples of antennas that work well for me, and links to web sites where they can be built or bought.

I beg the patience of the experienced builder as This Mini-ToDo goes into tedious detail at times. Take a deep breath and skip ahead.

Here is a recent video of the tracker in action with a 2.4GHz dish shaped antenna on 2.4GHz. Notice that tracking kicks in when the craft is at least 3m away from take-off, and there is a moment while it catches up with the telemetry. Initial orientation comes from the magnetometer on the craft, but I placed the craft slightly off line at first.

Principle of Operation

The assumption is made that you want to track an airborne craft in flight from a point on the ground.

1. The “home” position is established from GPS telemetry while the craft is at rest before take-off.

2. The heading of the craft at rest before take off determines the centre of the imaginary 180 degree field-of-view (fov) in front of the pilot and the craft. All azimuth angles (headings) will be calculated relative to the centre of your starting fov.

3. A button press on the tracker remembers the home position, absolute altitude and heading.

4. After your craft takes off and is in flight, telemetry from the craft provides its GPS co-ordinates and alititude.

5. Once the craft is a few metres away from home, using the home and craft positions in three-dimentional space, we can calculate the direction (azimuth) and elevation of a vector (line) between them using well established mathematics.

6. Now that we know where to point, we position azimuth and elevation servos ( assumed to be located at the home position) using pulse-width modulation (PWM) such that an antenna attached to the elevation servo points to the place in the sky where the craft’s telemetry says it is.

7. Since the telemetry is updating the position of the craft every two or three seconds, the craft is accurately tracked by the antenna, including overhead and behind you.

8. A LED on the tracker starts to blink slowly when telemetry is first received. Once a good GPS lock is received from the craft, before take-off of course, it blinks fast. Push the home lock button to remember the home co-ordinates and it stays on solid. Enjoy your flight!

Here is a picture of the inside of the tracker box:

Parts List, with suggested sources. Of course you might want use alternatives or already have some of the bits. No problem.

1. Plastic enclosure. Anything around this size will do. Try here

2. We will use the STM32 mpu. Try here

3. We need a reliable 3.3V supply for the STM32. Use a BEC or one of these :

4. We need a 5v at least 1A supply for the servos. Try here:

5. Here is the pan/tilt mechanism plus servos I used :

A NOTE OF CAUTION: The above servos won't necessarily work for everyone. For example, reports they did not work well for him with a 5V supply, and he end up using DS3115MG 15 kg metal gear servos powered at 2S (about 8v).

6. My servos are mounted proud of the lid by about 20mm. So you will need four m3 plastic spacers, screws and nuts.

7. You will need a bright 5mm LED, colour of your choice, with an 820 ohm 1/4watt resistor

8. Then there is the home push button :

9. And you might want some adhesive rubber feet :

10. I used these Dupont jumpers, but your favourite hookup wire will do :

11. If your serial telemetry is 5V TTL, you will need a 5V to 3.3V level converter :

12. Oh, almost forgot, you will need a USB to serial TTL adapter between your PC and STM for flashing and/or debugging :

That's it for the parts.


You can choose to compile and flash the software using the Arduino IDE, or if you simply want to flash the binary without any changes, skip to Flashing the Binary

Setup, Modify, Compile and Flash with Arduino

Setup Arduino IDE

1. If you have not previous installed the Arduino IDE, do it now. Instuctions for Windows here : (Google for Linux or OSX)

2. Follow the instructions here to install support for the STM32 board :
NOTE: We do NOT want to flash the STM32 over USB, but over serial, so we do not need to flash the bootloader. Ignore that step.

3. You must go to the Boards Manager in the IDE, and install the Arduino Due from the list of the available boards. We won’t use this board, but it installs essential support for ARM MPUs like the STM32.

4. Download the Arduino STM32 files from GiTHub :

5. Unzip the Arduino_STM32 folder to [Arduino sketches folder]/[hardware]/[Arduino_STM32]. Create the 'hardware' folder if it does not exist yet.

6. Select and download a source file from the Github link depending on your telemetry protocol.

7. In the Arduino IDE navigate to File/Preferences, and note the default Sketchbook location.

8. Copy the the appropriate source folder into the default sketchbook location.

9. Double-click on the AntTrackxxx.ino to launch the IDE and open the main sketch. AzEl.ino , Compass.ino and Servo.ino will also show as closed tabs

10. Navigate to Tools/Board/Board Manager and select Generic STM32F103C from the drop-down menu.

11. Navigate to Tools/Upload method and select Serial.

12. The Servo.h library for STM32 should have been included in the STM files loaded earlier.

13. Now Click on the Tick icon at the top LHS to compile the program. It should compile without errors.

Modify the Software (optional)

At this point you have you opportunity to get to know the software, and make modifications if you choose.

Notice that Serial.print is used in many places for displaying results for debugging purposes. Since we will flash the STM32 through serial0 (corresponds to TX1 on the board) using a USB to TTL converter on this port, the debug messages will print back out of the enumerated com port. Select Tools/Serial Monitor in the Arduino IDE.

Serial0 for printout - RX1 = A10 TX1 = A9

Often the Serial.print lines are commented out since they were no longer needed. Simply uncomment them where necessary.

In the first tab, called AntTrack.......... you will find the line were minimum displacement is defined and initialised. The tracker will not track while the distance from home to the tracker is less than that number in metres. GPS accuracy and access to satellites will determine the true minimum in your circumstances, but it works fairly well down to about 3 metres. You may want to change this to get debugging feedback while testing.
int MinDisplacement = 4;
The core logic of the tracker appears lower down the page. If you have received good GPS telemetry, and you have initialised your home position, then use that information to get the azimuth (heading) and elevation of the craft. Then, if the craft is more than the minimum distance away, go and position the servos.
    if (homeInitialised == 1 && gpsGood == 1) {
      GetAzEl(, home.lon, home.alt,, cur.lon, cur.alt);
      if (Distance >= MinDisplacement) PositionServos(Azimuth, Elevation, homeHdg);
In the Servos tab, corresponding to Servos.ino, you might want to adjust the upper and lower limits of your servos, in degrees. For example, if you want to limit the tracking to only the field-of-view in front of you, but not behind, make the elevation upper limit ulEl = 90. Then of course you only need a 90 degree servo for elevation.

 int llAz = 0;     // Set the limits of the servos here
  int ulAz = 180;    
  int llEl = 0;
  int ulEl = 180;
My servos worked best with the max and min PWM timing below, but you might, for example, need max = 2250, min=750. Assume the mid point to be 1500 microseconds.

  int MaxPWM = 2300;
  int MinPWM = 700;
Then a little lower in this tab, you will find where the azimuth and elevation are mapped to the PWM timings. Note that, depending how you mount your servos in the pan and tilt mechanism, you might need to swap ulEL and llel around.

azPWM = map(LastGoodpntAz, ulAz, llAz, MinPWM, MaxPWM);  // Map the az / el to the servo PWMs
elPWM = map(LastGoodEl, ulEl, llEl, MinPWM, MaxPWM);   // Servos happen to be mounted such that action is reversed
Now you should be ready to compile and flash.

Compile and Flash

Take some time to study the STM flash wiring diagram in the post below. Also take a general look at the STM32 pinout diagram there.

1. Hook up your STM32 board to your USB to TLL converter as shown in the "How to wire for flashing" diagram.

Make sure that the voltage jumper on the USB/TTL board is set the 3.3V. Setting it to 5V will destroy your STM32 board.

Sometimes the USB/TTL boards don't have a jumper, but require a solder bridge to be closed. If in doubt, check the voltage with your meter!

You will connect four wires: Power, ground and serial crossover.

3.3V power
Rx to TX
TX to RX

Here is the wiring for flashing the STM32:

2. Move the yellow jumper labelled Boot0 on the STM32 board to position 1. Note, you must later move it back to position 0 after testing is complete so that it will boot and run your tracker software.

3. Once the hookup is complete, plug a usb cable from your PC into the mini USB/TTL board. The first time you do this Windows will install drivers for the USB/TLL board. Wait for it to complete.

4. If you open Device Manager on Windows, under Ports (COM & LPT) you should see an entry for your device, something like: USB Serial Port (Com3).

5. Now in the Arduino IDE, select Tools, and navigate down to Port, and select you Com port.

6. Reminder: Navigate to Tools/Upload method and select Serial.

7. Now click on the right arrow icon, to the left of the tick icon, to initiate the flash.

The window at the bottom of the IDE will show progress of the flashing process. Examine the results carefully to ensure the flash was successful. If errors occur, Google is your friend.

With the yellow boot0 jumper in position 1, the STM32 will flash and run. Click Tools/Serial Monitor without delay to see debug output.

8. Once you are happy with the operation of the software, remember to move the yellow jumper labelled boot0 back to position 0 so that the software runs automatically on power-up.

Flashing the Binary

If you want to flash the binary file without installing the Arduino IDE, follow the steps below. Note that the binary will include all the standard settings for PWM limits, servo types (180) and minimum displacement. If you use the recommended parts it should work without changes.
  1. Hook up the STM32 as per the flash diagram above
  2. Move the yellow jumper labelled Boot0 on the STM32 board to position 1
  3. Download the flash_loader_demo from here and install it :
  4. Download the binary for Mavlink or LTM from the bottom of this post
  5. Plug your PC USB cable into the USB/TTL converter
  6. Launch the Demonstrator GUI
  7. Your COM port should show up in the Port Name window. Leave everything else untouched. Click Next
  8. The next page should confirm target is readable. Click Next
  9. Select STM32F1_Med-density_128K in the drop-down. Click Next
  10. Tick Download to Device radio button. Navigate to the binary (.bin) you want to flash. Change nothing else. Click Next.
  11. Wait for erase, download and flash to finish. It should confirm Download operation finished successfully
  12. Remove power and move the yellow jumper labelled Boot0 on the STM32 board back to position 1

The tracker will start next time you power the board

Mounting and Wiring

The servos, power supply, flashed STM32, LED and push button.

First a warning. NEVER connect the servo power wires (red) to the STM32! The pin marked 5V on the STM32 is NOT a power source. The expensive magic smoke will come out.

The red servo power wires must both be connected to a dedicated 5V BEC or regulator capable of supplying at least 1A. 3A would be better. The black servo wires will share the common ground, and the white signal wires go to STM pins:

Azimuth - pin A7
Elevation - pin A8

Wire the push button between A5 and ground.
Wire the LED + through an 820 ohm 1/4 watt resistor to A6, and LED - to ground.

Here is the tracker wiring diagram

Remember that if the TTL serial signal coming into the tracker is at a 5V level it can damage the STM32 and must be converted down to 3.3V. In that case you will need to add a logic level converter, as shown below. You do not need this if your serial signal is already at 3.3V, like from a Raspberry pi for example, but it won't do any harm either.


This small and inexpensive tracker depends on the fact that light and compact high-gain antennas are possible on the 2.4GHz and 5GHz bands.

Let's just review why a tracker with a high gain antenna can be beneficial to long-distance flight communications.

A quick refresher on some of the theory. Experts please skip ahead.

Impedance Match

An antenna has the job of coupling electromagnetic energy to the "ether". RF energy from the TX would not leave the antenna and radiate away from it if the output stage of the TX did not match the impedance of the feed point of the antenna. For our purposes this is around 50 ohms resistive. If the match is poor or reactive, meaning capacitive or inductive at the operating frequency, not all of the energy will be radiated and standing waves will form on the feedline. In the worst case, the final stage of the TX might fail due to extreme voltage or current.


So let's assume that the feed point impedance match is good at the operating frequency. The electromagnetic energy radiates out from the driven element, and may be shaped by parasitic elements nearby. In the special case of an isotropic (point) radiator only, the energy will radiate out evenly as a spherical surface in three dimensional space. This is ok if our intention is to broadcast to the universe, but in our application we are only interested in the signal reaching a particular spot above the surface of the earth. In the isotropic case, the available energy is shared across the surface of the expanding sphere, and loses strength in free space according to a logarithmic function. So for convenience we measure the power of a signal on a logarithmic scale using relative units called decibels, or dB.

To quote from Wikipedia:

When expressing power quantities, the number of decibels is ten times the logarithm to base 10 of the ratio of two power quantities. That is, a change in power by a factor of 10 corresponds to a 10 dB change in level.

Then, to provide an absolute measure, we reference the relative db of a measure to that of 1 milliwatt (mW). The unit of measure of absolute radiated power is then dBm. One millwatt equals 0 dBm

Take a look at the dBm table below. You will see that in order to improve the signal strength at a receiver, assumed to be a some distance from a transmitter, you would need to increase the tx power by a factor of 10 times to improve the received signal by 10dB, all other things being equal.

But all things are not necessarily equal. We said above that the electromagnetic radiation may be shaped by parasitic elements nearby, and if we can focus more energy in the direction we want, at the expense of energy in the directions we don't want, we obtain GAIN. For example, an antenna with 10 dB gain (over isotropic) multiplies the effective power of the TX by 10 times as measured at the receiver. We say the gain is 10dBi. If a transmitter with a stick antenna of gain 3dBi (because it shapes the radiation pattern into a doughnut shape around the vertical stick, is compared with the 10dBi antenna, we say it has a gain of 7dB over the stick, or the effective power is 5.012 times that of the tx and stick.

Antenna Reciprocity

Antennas have a wonderful attribute called reciprocity. This means that if an antenna has a transmitting gain of x dB, then so too does it have a receiving gain of x dB. This occurs because in the receiving situation any parasitic or beam shaping elements shape and focus the received signal just as they would the transmitted signal. Further, the feed-point impedance of the antenna is also required to match that of the receiver front end. All this is very convenient, don't you think, because we can radiate omni-directional (in the horizontal plane) RF energy from a tx antenna on a craft in flight, and gather it up into a directional high-gain receiver antenna.

Signal-To-Noise Ratio (S/N Ratio)

An RF signal is only usable or legible when the amplitude of the wanted signal exceeds the amplitude of the background RF noise. All RF signals contain noise, comprised of natural background noise, unwanted man-made noise and thermal noise in the receiver front-end. (The higher the frequency, the higher the noise, so that satellite receivers require low-noise amplifier (LNAs) to improve S/N ratios). Why mention S/N ratios?

By focusing a receive antenna with gain in a particular direction, we are reducing the background and man-made noise received from everywhere else. The signal-to-noise ratio improves, and the wanted signal emerges from the noise and can be used. Effectively, you fly your craft further and still have a solid link

Front-To-Back Ratio

This is a special case of S/N ratio. Signals behind a good high-gain antenna are strongly attenuated. For example, if you have a suburb nearby radiating possibly hundreds of wifi signals on your chosen band, you would prefer them to be behind your high-gain antenna. If you are receiving on a vertical stick (usually a co-axial dipole), you will have nowhere to hide.


Electromagnetic waves travelling in free space are described as transverse waves, meaning that a wave's electric field vector and magnetic field are perpendicular to the direction of wave propagation and perpendicular to each other. This matters to us because it imparts the property called polarisation. Simply put, the waves have an orientation in space, and when this orientation is matched in the vertical or horizontal plane by rx and tx antennas, losses are minimised (like Polaroid glasses). However, if the orientation of two antennas differ by 90 degrees, the signal loss between them is about 20dB. So for best results the polarisation of two antennas should be aligned if possible.

Antennas pairs may also be circularly polarised in the left-hand or right-hand sense, in which case they are almost immune to antenna misorientation. This attribute is obviously very useful in rc when the aircraft is constantly changing orientation.

Pairs of the same circular sense have minimal theoretical losses, but mismatched pairs have a practical loss between them on these bands of at least 20dB. The theoretical loss is much higher. Circularly polarised antennas have a loss of about 3dB when paired with linearly polarised antennas, so linear/circular pairs are workable with a small but possibly significant deficit.

Gain Beam Width

Generally (not always) the higher the gain, the lower the beam width of a gain antenna. The half power beam width is the angle between the half-power (-3 dB) points of the main lobe, beyond which the effective power often drops off sharply. For our purposes, we usually want a fairly broad beam-width so that the craft does not inadvertently slip out of illumination.


The free space path loss of an rf signal increases with frequency, such that the loss at 5.8GHz is about 7.7dB more than that at 2.4GHz over a the same distance of a few kms. Therefore if 5.8GHz is your band of choice you need to overcome that deficit. Fortunately higher gain antennas are smaller on that band.

The 2.4GHz band is generally much more crowded, including with rc control signals, making it more noisy and adversely affecting signal to noise ratio on that band. Further, you may not want a video transmitter in close proximity to your rc receiver and on the same band. Yes modern rc equipment does well to avoid competing signals, but there is a limit to what is possible.

You can compare free space path losses on this calculator:

Moment of Inertia, Beam Width and Gain of Long Antennas

Very high gain is possible from dishes or long antennas with multiple elements, but they tend to have narrower beam widths and higher moments of inertia over their length.

Again, according to Wikipedia:

Moment of Inertia is a rotating body's resistance to angular acceleration or deceleration, equal to the product of the mass and the square of its perpendicular distance from the axis of rotation.

So the longer and heavier an antenna, the harder it is to turn. Makes sense.

Therefore much more torque is required to move long and heavy antennas, they need bigger bases for stability, and their structure should be more rigid to withstand high winds. They are best mounted at their centre of gravity and might require a counter weight.

Circularly polarised high-gain antennas also tend to be relatively long, but some smaller ones I've seen on 5.8GHz should work with this tracker.

Ideally for a tracker we need good gain with a beam width of at least 40 degrees and preferably with low inertia. For a small tracker, low inertia is a must.

The tracker described in this thread is designed to be used with relatively small mass bi-quad or panel antennas on 2.4GHz or 5GHz. A good double-bi-quad on 5GHz will produce gain of around 13 dBi, whereas typical yagi would require 12 or more elements to produce the same gain, but usually with less beam width.

Here are some great links to start with bi-quads:

Last edited by zs6buj; Feb 05, 2021 at 02:00 AM.
Sign up now
to remove ads between posts
Aug 18, 2017, 06:56 AM
Registered User
Finally! Thanks man.
Watching the thread.

P.S. From what I have found, similar pan/tilt assembly, with the MG servos, can be had for around $25
Aug 18, 2017, 07:26 AM
Registered User
Thread OP
Originally Posted by rank View Post
Finally! Thanks man.
Watching the thread.

P.S. From what I have found, similar pan/tilt assembly, with the MG servos, can be had for around $25
Hope it's useful. Yeah, mechanical gears are definitely stronger, noisier and more costly. I have an MG version, but my nylon gear tracker, surprisingly, has more than 15 hours on it so far without a problem. Maybe I shouldn't speak too soon.
Aug 18, 2017, 02:51 PM
Registered User
Originally Posted by zs6buj View Post
Hope it's useful. Yeah, mechanical gears are definitely stronger, noisier and more costly. I have an MG version, but my nylon gear tracker, surprisingly, has more than 15 hours on it so far without a problem. Maybe I shouldn't speak too soon.
zs6buj, very compact, good instructions so far, thank you!
Aug 19, 2017, 02:20 AM
Registered User
This way you just added multiple failure points to your setup, made it less portable, and got almost to none advantage for real flying...
But hey... it is looking so cool
Aug 19, 2017, 05:10 AM
Registered User
Thread OP
Originally Posted by renatoa View Post
This way you just added multiple failure points to your setup, made it less portable, and got almost to none advantage for real flying...
But hey... it is looking so cool
Hey renatoa, well it depends on what you are trying to accomplish. Most of us are using trackers for long-range HD video, not for control AS YET. IMHO this is the way to go for long-range, but maybe not for everyone.
Aug 20, 2017, 03:42 AM
Registered User
How about making an add-on, based on GhettoProxy?
So, pretty much any telemetry protocol can be used.
Aug 20, 2017, 04:35 AM
Registered User
Nope, you have a misunderstanding of how LR works... you don't need any tracker.
As in 24 km without tracker
The first hobby trackers were been introduced around 2008, to fly legally with 10 mW in a 500m radius circle... guess why
Aug 20, 2017, 06:56 AM
Registered User
Thread OP
Originally Posted by rank View Post
How about making an add-on, based on GhettoProxy?
So, pretty much any telemetry protocol can be used.
Googled it and GhettoProxy looks great! I'll look at it for sure.
Aug 22, 2017, 04:49 AM
Registered User
Thread OP
Originally Posted by rank View Post
How about making an add-on, based on GhettoProxy?
So, pretty much any telemetry protocol can be used.
Ok, I played with GhettoProxy a bit this morning. Compiled and flashed it for Mavlink in / LTM out. As you likely know GhettoProxy runs in a MiniPro on the craft, and converts a chosen protocol to LTM, the idea being that LTM is very light on bandwidth. I imagine some people would like that approach, but others, like those who use (say) Mavlink for control might not.

Neverthess, thanks for the steer. I can maybe use some ideas to make the tracker read LTM, Multiwii MSP and UAVTalk. It doesn't appear to support FrSky, but that's already on my list.
Aug 22, 2017, 09:58 AM
Registered User
Thanks mate.
I'm still gathering the parts for the Ez Wofibroadcast. Received 2 wifi links, Today and one of them is DOA.
Will be a while, till I start working on the tracker.

As for the telemetry control, personally, I would rather trust my 433mhz system, for that.
Aug 26, 2017, 11:28 PM
Registered User
Well this looks great! Keep up the good work! Someday I will make one once I get all my other projects done!
Aug 31, 2017, 05:38 AM
Registered User
Thread OP
LTM - Light Telemetry

For anyone interested in the LTM version of this tracker, I just posted a copy of the source under post #1 above. I would appreciate feedback or help with testing. I tested using GhettoProxy and all looked ok, but I can't say for sure until someone can test this version with native LTM .
Sep 01, 2017, 01:15 AM
plane destroyer and builder
skybattle's Avatar
Thank you very much!

Quick Reply

Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
New Product open360tracker - cheap open source 360 continuous rotation antenna tracker Rangarid FPV Equipment 56 May 27, 2019 01:21 PM
Discussion ZMR-250 - Can you help me build this on the cheap? coreysnyder04 FPV Racing 7 May 10, 2016 10:02 AM
Discussion Which Antenna tracker with this combo ?? khaled_abobakr FPV Talk 2 May 09, 2012 04:00 AM
Discussion Plans to build a DIY antenna tracker mount? Matt Halton FPV Talk 2 Aug 17, 2010 05:31 AM