Fisch´s Projekte-Seite

Project start: January 2014

Diversity



Introduction

Antenna diversity, also known as space diversity or spatial diversity, is any one of several wireless diversity schemes that uses two or more antennas to improve the quality and reliability of a wireless link. (Source:
Wikipedia: Antenna diversity )

For RC-Models with fpv it is common to use more than one receiver connected with different antenna types to receive the videosignal from the aircraft. A diversity controller compares the received signals and switches to the best one.
The two most common methods to estimate the signalquality are the RSSI-Value (Received Signal Strength Indicator), wich is in most cases an analog voltage given by the receiver and counting of the sync pulses.
To get the RSSI from a RC305 Receiver, you need to solder an impedance converter to the solder joints of the receiver module. More information under RC305 RSSI.
The horizontal and vertical syncpulses can be obtained by a LM1881 Video Sync Separator. The wiring is shown on the connection diagram on page 1. If the LM1881 recognizes a new line, a pulse is generated on pin 1 (Composite Sync Output). By adding all composity sync pulses for one second you'll get 16000 (for PAL). The vertical syncs represent the fields per second, 50 for PAL.
If the videosignal gets worse the counted syncs increase because of the noise getting recognizes as syncs. So by calculating the difference of the counted syncs per second and the optimal value of 16000 you get an rough indication of the real videoquality.
The diversity controller determines the best signal and switches it to the output by an relais or an analog switching IC.

My purpose was it to design, programm and build such a controller.
Sure, there are a lot of designes and DIY solutions available, but not all of the components are available for me and you always learn a lot more by doing it all by yourself.


To start simple, i wanted to just read the RSSI-Values and count the syncs of two RC305 5.8 Ghz receivers.
On my div. controller i want to implement both methods. RSSI has the advantage (as i noted from a few tests), to give a linear reading over the entire range where the syncs are very close to the optimal value if the signal is not noticable degraded and increase rapidly if the reception gets bad.
The advantage of the syncs is that they give a estimation of the real quality of a signal, at least of the video line sync pulses. So if for example the radio signal gets reflected by a building, the rssi gives a high reading where as the video image is nearly unusable.

At first, the rssi values need to be calibrated, because not all receives give the exact same voltages at 0% and 100% signalstrenght.
Also it could be helpful to output the values over the serial interface and log them. By doing that antennas can be easily compared without using expensive equipment.
As microcontroller i'm going to use an Atmega328. For simplicity reasons i will probably use Arduino.
The code to read the RSSI and count the sync pulses was written quickly. The RSSI voltages can be directly connected to an analog input pin of the uC because the voltages fluctuate between .4 and 1.2V. So no voltage divider is needed. The sync outputs of the LM1881 are connected to the pins 4 and 5 of the atmega wich are capable of doing interrupts. In the two interrupt routines i count up the corresponding counter and reset it after a given time (1 second for example).
Each second all values are formatted as a line of csv (values separated by semicolon) and printed out over the serial interface. Under linux i piped every line directly into a file.
The following diagram shows the rssi and composite syncs of one receiver over time.
Between 12000 and 35000 (time units, x-axis) the transmitter is switched off, because of the received noise the counted syncs are greater than 65535, wich is the maximum value for 16 bit unsigned integer. As expected the rssi value is near the minimum.
At 35000 the transmitter is switched on and placed near the receiver. The rssi value increases, the syncs drop and stay at 16000 (0,24 = 16000/65535).
Between 50000 and 100000 I'm moving the transmitter further away from the receiver and back again. The RSSI acts accordingly. The counted syncs per second remain nearly constant.
Only when i shield the transmitter with my body, the signalquality decreases such that the syncs increase noticably. At this point in time the image is already very noisy.
During this test i haven't hat connected any antenna to the receiver, so i didn't had to walk away that much. Btw, the diagram i made with GnuPlot.



6.9.2014: A little time passed by after the first tests.
Until now the diversity has the following features:

Design and Circuit


March 15, 2015:Many times I took the diversity on its breadboard with me to the flying field. Except for the finetuning and a lot of loose contacts it worked as expected.
Added features:

Since I didn't changed anything on the circuit since a few month it was time to build it up on an etched PCB.

The internal structure isn't easy to explain, so I drew a blockdiagram of the diversity controller:
On the left the up to four (more are theoretically possible) inputs [input x], wich carry video, audio and the rssi voltages from the receiver to the controller.
The controller [Controller] controls two analog switches for audio/video [A/V Switch], wich switch a receiver to the OSD and thus to the output.
The MinimOSD [MinimOSD] gets the the text to display from the controller. In normal operation thats the RSSI Values and the currently selected receiver, in the menu the selected entry and its value.
Wich receiver has the best reception gets judged by i.a. its RSSI value [RSSI], the voltages are directly connected to the controller. Nothing fancy!
However, more interesting is the determination of the composity sync deviation. Since the Atmega 328 got only two interrupt pins, all available videosignals are getting switched through at for example 4Hz [Video Switch]. A sync counter [Sync Counter] (LM1881) counts the synchronisation pulses and sends them to the controller als simple pulses. If there are too many pulses wich cause a lot of interrups, for example if the image is only noise, the Atmega can't keep up. To limit the interrupts I had to install some kind of "limiter" [Sync Limiter] (wich consists of a simple Monoflop).
Two Buttons [Button x] are directly connected to the controller to allow a minimalistic operation and are used to start the calibration, navigate through the menu and to switch the receivers manually.
A small speaker [Speaker] and an amplifier [Speaker Amp] serves for the audio feedback.


Now, I'm going to try to explain the things I just said in regard to the circuit. At first, I wanted to put everything on one single sided PCB, because its easier for me to manufacture. With the free version of Eagle, I'm really limited in the size of the board. So I decided to split the circuit into two boards, analog and digital part so I have two 65mm x 100mm boards available for the layout.
Following screenshot shows the digital part (from March 18, 2015). Basically theres not much on it: On the lower left you can see the Atmgea328P with its default components and the needed in- and outputs. PIN_BEEPER (PB0) is the sound output and is routet to the amplifier, wich will be on a seperate addon board (see below). SYNCSEL 0 and 1 means the binary selection of the videosignal for the sync counter. Both SYNCSEL signals are directly routet to the analog board, by use of BC_SYNCSEL. All Pinheaders with the prefix BC (Board Connector) mean a interboard connection from one to the other pcb. The BC connections are placed equally on both boards, so that the upper board with long pinheaders can be stacked on the other board.
PB3, PB4, PC4, PC5 and INT1 are not used in this design at the moment and are connected to unused pinheaders PB3PB5 and PC4PC5.
SEL0 and SEL1 are, same as SYNCSEL, the binary selection for the receiver, the purple arrow in the block diagram that goes from the controller to the A/V switch.
PC0 to 3 are the analog inputs, where the rssi voltages are present.
BTN0 and BTN1 are designed as a two pin pinheader each, on wich the buttons will be connected to pull the digital inputs PD4 and PD5 to VCC.
In the upper left corner you can see the FTDI connector, wich is used for uploading the arduino sketches and also as connection between the controller and the MinimOSD. The MinimOSD, with straight pins soldered, will be directly connected to the digital board. Videoin and -out from the minim go into the 2x6-Pin pinheader MINIM_AV.
Finally on the lower right the LM1881 Sync Seperator IC, wich extracts the syncronisation pulses from the selected videosignal SELVIDFORSYNC.Only the horizontal sync (SYNCOUT Pin 1) is needed, wich has a very high frequency at singalloss=noise. To not overload the atmega with interrupts, a NE555 wired as Monoflop is used to limit the frequency (see elektronik-kompendium.de for example for more information).


Now lets have a look at the analog board:
For the 5V power I used a LM7805 linear voltage regulator (upper left). Because of the dropout voltage of the 7805 you should at least apply 7V. The inputvoltage AVCC will be directly connected to each receiver. Since each of the Boscam RC305 (wich I'm going to use) has also a linear regulator build in, the inputvoltage of the whole diversity should not be too high to reduce power losses. I thing the most efficient voltage is around 7.5V, wich I get from a stepdown converter. A 2S Lipo will not work.
GND_BRIDGE is used as joint for digital and analog ground and will simply bridged together afterwards.
As mentioned before, the analog switches for syncselection and receiverselection get selected binary to save some outputs on the atmega. Though, the 74HC4066 analogswitches need four signals each. To achieve this, I used a 74HC4051 Multiplexer IC.
On the very right: all four connections for the receivers with each an analog ground AGND, powersupply AVCC, RSSI, audio and video. The Boscam RC305 receivers need to output their rssi voltage, see RC305 RSSI.


To get some supermarket like beeps I build a small addonboard with a LM386 audioamplifier on it. R1 is a poti to set the volume. I think the rest of it is self-explaning.
Alls circuits, eagle files and pcbs are available as zip at the bottom of this page.

Buildup


Here some pictures from the build-up.

Again the boards as closeups. On the left: analog board, middle: digital board, right: soundboard

The sockets and pins are all drawn as pinheaders in the schematic. On the following pictures you can see, wich ones of them are sockets. The pins on the upper board are mounted so that they stick out at the copper side.

First the minimOSD gets plugged into the designated sockets on the digital board. Then the soundboard with it's three pins comes on the side of the board (not pictured on the first two images). On top of that comes the analog board. The whole thing fits perfectly into a plastic case. (LxWxH): 135x75x49 mm

I soldered the power wires as well as the video- and audio-output directly to the board. The receivers will get connected through a 6-pin miniDIN connector. Every miniDIN connector is solderes to sockets wich get plugged on the upper board. The wires are secured by some files slots between the plastic case and its lid.
Both buttons I spent a 100n capacitor as debouncing, soldered directly to the wires. Four LED's get soldered to the 5-pin pinheader on the side of the analog board and will later show the currently selected receiver. These LED's I sunk into the plastic. For the three debug/status smd LED's on the lower side of the digital board there are three small holes drilled into the plastik and sealed with clear hot glue.
For the anoying beeps I took a salvaged mini speaker (from a monitor or something) and squeezed it into the case.

And the diversity is finished. (In this picture the audio output is still missing)


Manual

Because of it's only two buttons the diversity isn't that intuitive to operate.
For those who are used to the 4-Button chinachargers this should not be too hard.
Following the possible functions of the buttons:
Button actuation function function menu
Button 0/A short activate diversity back, decrease value
Button 1/B short switch manually next, increase value
Button 0/A long / menu back
Button 1/B long open menu select entry

Calibration of the rssi voltages

To teach the diversity wich and how many receivers are connected and how the maximum and minimum voltages for the rssi look like on every receiver, a calibration has to be done:

Main screen

After completed calibration or powering on the diversity the "main screen" should appear, as far as at least one receiver receives an image. The OSD of the diversity may disappear sometimes if the video signal is too noisy.
Only the first two rows are used by the OSD to not collide with an osd of the model.
In this row the normalized rssi values are displayed [0,255] and seperated by vertical bars. From left to right: receiver 0 to 4. If some input were left out during calibration (detected by very low rssi voltages) these inputs will be deactivated and will be skipped.
If one of the symbols #, ~ or M is displayed next to one of the values, it shows wich receiver is currently selected. If its the character M it means, that this receiver was selected manually. The character # indicates a decision by the sync pulse difference. If the sync difference wasn't the reason for switching the ~ will show up.

Menu

The menu navigation I'm going to explain later with an appropriate graphic.


Files: