Reading RSSI from a FrySKY X8R Transmitter with an Arduino
What is RSSI??

RSSI (Received Signal Strength Indication) is a measure of the signal strength between the Radio Control transmitter (Figure 1) and the receiver on your drone. The unit for RSSI is decibels (dB), these are used to quantify the power of an electrical signal. The signal strength of your radio control signal becomes very important when you are about to go out of receiver range!

Figure 1. Taranis Q X7 Radio Control Transmitter.

As part of our drone development project we need to interface with the radio control transceiver. We are using the FrySKY X8R for our prototype and you might expect it would use a simple industry standard serial interface like SPI to communicate. Of course this isn’t the case and in fact you need at least three different interfaces to communicate with the X8R. These are:

Either SBUS or low level PWM to get the throttle, pitch, roll and yaw instructions (up to 16 channels via SBUS) for the flight controller. The SBUS protocol was developed by Futaba to control servos with each channel assigned to a different servo. It is based on RS232 but to make life difficult they inverted the signals (i.e. 0 = VCC and 1 = GND) and used a non-standard baud rate of 100,000. The other configuration details are 8 data bits. even parity and 2 stop bits (8E2). You can read all about reading SBUS data using an Arduino Nano 33 BLE, in our article on how to write your own flight controller software. S-Port aka Smart Port is used for sending telemetry (this will be the subject of a separate article). There is an existing S-Port library for the Arduino which I haven’t tested. S-Port uses an inverted serial protocol like SBUS, but at 57600 bds. The receiver polls 28 sensor addresses approximately every 11 ms (e.g. battery voltage, current, altitude, GPS, air speed, RSSI and heading). The RSSI dedicated pin. This pin is a PWM signal, where the duty cycle is proportional to the signal strength.

What are the Options?

To read RSSI into your Arduino Flight Controller there are three options:

The FrSKY X series receivers transmit RSSI to the transmitter by default. You can use this value as an input for a spare channel, which is then transmitted back to the receiver and can be read by the flight controller via the SBUS connection. As mentioned above, RSSI is also communicated via the S-Port telemetry signal. Finally, it is available on a dedicated pin on the X8R, labelled RSSI. The data on this pin is a 0–3.3V PWM signal running at a frequency of 110 kHz. The signal strength is proportional to the duty cycle of the PWM square wave. For example, a duty cycle of 60% corresponds to a signal strength of 60%.

We will investigate two of these options (1 and 3). Option 2 is how the X8R reads the RSSI and receiver battery voltage to transmit it in Option 1.

The Transmitter Feedback Approach

These instructions are for a Taranis Q X7, but you should be able to do something similar with other models. Turn on your transmitter and select the appropriate model for your drone. Ours is called Magpie 33 (Figure 2).

Figure 2. Magpie 33 Flight Model Selected.

Hit the menu button (the button with 3 horizontal lines to the left of the display) and then page until you get to the inputs menu (Figure 3 — page 5 of 12).

Figure 3. Assigning Inputs on the Taranis Q X7.

Use the wheel on the right of the display (Figure 2) to select the next free channel. Our channel allocation is as follows:

CH 1 = Throttle;

CH 2 = Aileron or Roll;

CH 3 = Elevator or Pitch;

CH 4 = Rudder or Yaw;

CH 5 = Lost Frames (not this is not allocated in the Transmitter)

CH 6 = RSSI; and

CH 7 = RxBAT (receiver battery voltage).

Click the middle of the wheel to edit. If you have an exisiting input you want to edit or delete then do a long press on this wheel button. Use the wheel to select the letter for the input name and name. We chose RSI and RSSI. To get capital letters you long press the wheel button.

Figure 4. Setting up the RSSI Input (I-RSI).

You need to select RSSI as the source for this input (Figure 4). If you can’t see RSSI as an option then go to the telemetry section (page 11 of 12) and select “discover new sensors” (Figure 5), the receiver needs to be on and connected when you do this. You should see two sensors added, RSSI and the receiver battery. These sensors are connected to the S-Port telemetry bus inside the X8R.

Figure 5. Telemetry Screen after adding sensors.

While you are on this screen (Figure 4), change the scale to 100 dB.

Figure 6. Adding the new RSSI mix.

On the Mixer page (Figure 6), create a new mix for channel 6 (RSSI) and 7 (RxBAT). For channel 6, change the source to the RSI input you just created and change the weight to 200 and the offset to -100. This will give you a 0–100 value for RSSI (think of it as percentage signal strength).

Figure 7. After adding the RSSI and RxBAT mixes.

For channel 7, assign the RxBAT input (see Figure 7). Change the scale to 5 since our X8R is powered from a nominal 5V via the Magpie Power Distribution Board.

To make use of these changes we need to modify the flight controller firmware on the Arduino Nano 33 and to visualise the inputs we need to add these channels to the Nexgen Configurator (which is written in Processing i.e. Java). In the flight controller code we just need to add the additional channels (Figure 8) to transmit this to the Nexgen Configurator via USB.

Figure 8. Streaming SBUS Data to the Nexgen Configurator.

In the Nexgen Configurator, we process this serial stream and split out the required information. We then convert it to the required range. The transmitter sends the information as a percentage of 1811, so we divide by that and multiply by the 100% value (Figure 9).

Figure 9. Parsing the serial information from the Arduino in Processing.

The results of our serial parsing is then displayed in the Nexgen Configurator (Figure 10). Each of the SBUS channel values are displayed in real time and a visual gauge indicates the X8R receiver voltage and the RSSI (signal strength). The animated drone image reflects the throttle, roll, pitch and yaw commands from the radio control receiver. This is useful for debugging the drone build.

Figure 10. Nexgen Configurator with real time visualisation of the SBUS channel information.

The Dedicated Pin Approach

According to the X8R manual there is supposed to be a PWM output on the RSSI pin whose duty cycle is proprtional to the signal strength between the radio control transmitter and receiver. We looked at this pin using a protocol analyser and an oscilloscope. All we could see was a noisy 3.3V.

Assuming we could detect a PWM signal, the approach would have been to use an interrupt to detect the rising and falling edge on the RSSI signal connected to one of the Arduino pins. From this we could calculate the duty cycle from the on and off period of the square wave.

Given we couldn’t detect a PWM signal and the extra overhead required on the flight controller to calculate this we decided not to pursue this avenue any further. The ease of the first approach makes it unnecessary work but we would like to know why there is no PWM.
['David Such']
['X8r', 'Rssi', 'Arduino', 'Drones', 'Frsky']