Betaflight Receiver Communication

I am trying to get an OpenRB-150 board (that runs arduino code) to provide navigation commands (e.g. roll, pitch, etc.) to a flight controller (i.e. Speedybee F7 Mini) that runs BetaFlight. I am open to any way to communicate the navigation between these devices.

Currently, I have hardwired the devices so the OpenRB-150 is effectively the receiver. I am attempting to communicate via SBUS - specifically, the "Bolder Flight Systems SBUS" library. The hardwired connection is as follows:

OpenRB-150 -> Speedybee F7 Mini
Tx -> R1
Rx -> T1
V -> 5v
G -> G

I am using Serial2 on the OpenRB-150. I am providing power to each device via USB's

This is the code that I have running on the OpenRB-150:

#include "sbus.h"

/* SBUS object, reading SBUS */
bfs::SbusRx sbus_rx(&Serial2);
/* SBUS object, writing SBUS */
bfs::SbusTx sbus_tx(&Serial2);
/* SBUS data */
bfs::SbusData data;

void setup() {
  Serial2.begin(115200);
  while (!Serial) {}
  Serial.println("Serial Monitor started.");

  sbus_rx.Begin();
  sbus_tx.Begin();
}

void loop () {
  if (sbus_rx.Read()) {
    data = sbus_rx.data();

    Serial.print("Received SBUS Channels: ");
    for (int8_t i = 0; i < data.NUM_CH; i++) {
      Serial.print(data.ch[i]);
      Serial.print("\t");
    }
    Serial.println();

    data.ch[0] = map(data.ch[0], 1000, 2000, 172, 1811); // Aileron
    data.ch[1] = map(data.ch[1], 1000, 2000, 172, 1811); // Elevator
    data.ch[2] = map(data.ch[2], 1000, 2000, 172, 1811); // Throttle
    data.ch[3] = map(data.ch[3], 1000, 2000, 172, 1811); // Rudder

    Serial.print("Modified SBUS Channels: ");
    for (int8_t i = 0; i < data.NUM_CH; i++) {
      Serial.print(data.ch[i]);
      Serial.print("\t");
    }
    Serial.println();

    sbus_tx.data(data);
    sbus_tx.Write();
  } else {
    Serial.println("Error reading SBUS data.");
  }
}

The code compiles and runs fine. However, I only see the "Serial Monitor started." output in the serial monitor and the code appears to break at sbus_rx.Begin();

Any help would be greatly appreciated!

Did you read about the SBUS inverted serial signal and build your signal inverter for RX and TX lines?

Yes - i was under the impression that F7 flight controllers have built in inverters which negate the need to build a signal inverter - if I understand the hardware correctly.

Your flight controller may have the inverters built in to get the SBUS signal inverted as it should be.

But your Serial2 on the OpenRB-150 does not. I't not in the list.

(Copy from my previous link)
Inverted Serial

SBUS uses an inverted serial protocol, which is not commonly supported in Arduino. This library is able to use inverted serial for the following microcontrollers:

  • Teensy 3.x*
  • Teensy 4.x*
  • Teensy LC*
  • STM32L496xx*
  • STM32L476xx*
  • STM32L433xx*
  • STM32L432xx*
  • ESP32*

For all other microcontrollers, you must use a serial inverter. If you've modified this library to work with other microcontrollers, please submit a pull request.

Ah - that makes sense. I probably need to add a serial inverter to the OpenRB-150. Any pointers would be helpful! Looks like there’s a couple ways (on Google) to make the inverter. I’ll need to take some time to test them out to find the right set up.

I consider the simplest way is to pick any NPN transistor (e.g. BC547, 2N2222, ....) and two 1K resistors.

311277.image0

Almost any NPN transistor should do and the resistor value is not super critical.

Left side is input, right side is inverted output

1 Like

That worked! I added the inverter you recommended and can now send what I need to the flight controller. Thanks!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.