How to operate flight controller via Arduino or Raspberry Pi?

I am creating a drone for my university project. But I am confused about how to attach the flight controller to Arduino. I am using Micro F3 Evo for a brushed motor drone and Naze 32 for a brushless motor drone.

I saw videos on hoy to make Arduino nano based flight controller which operates the motors via PWM signals. That was easily understandable for me. But it didn't work, that's why I am planning to add a flight controllers and want to control it by DIY 2.4GHz receiver by NRF24L01 for now. And in the future want to add Raspberry Pi for object tracking with OpenCV.

But I can not find suitable information in this regard. There is UART connection port in every flight controller.

How can I control the flight controllers with Arduino?

the Raspberry Pi has a hardware serial port - see raspberry-pi-pinout
also arduino Mega, Arduino DUE, ESP32, etc

Yeah I have seen it, but my question is how can I control the flight controller with those pins in arduino uno, mega or raspberry pi

do you require an Arduino? the Micro F3 Evo has an onboard STM32F303CCT6 microcontroller
maybe worth looking on Forums dedicated to drones and flight controllers?

yeah, I want to control that STM32F303CCT6 microcontroller with arduino or raspberry pi

Did you want your Arduino to emulate a radio receiver so it can provide control signals? Does your flight controller have one input per channel? if so, use the Servo library to provide signals for those inputs.

If your flight controller only has one input for all of the channels, the control pulses are sent sequentially. The format is usually PWM or PPM. You can do PWM with software:

  // Every 20 milliseconds (50 Hz)
  if (millis() - LastPulseTime >= 20)
  {
    for (int channel = 0; channel < ChannelCount; channel++)
    {
      digitalWrite(OutputPin, LOW);
      delayMicroseconds(ChannelValues[channel]);
      digitalWrite(OutputPin, HIGH);
      delayMicroseconds(2000-ChannelValues[channel]);
    }
  }

Modern FC boards accept a serial data signal on one line, and provide multiple lines of control signals for the attached ESC/motor combos.

Or indeed have ESCs build in.

@saif_hossain perhaps you want to insert the Arduino between the radio you have and the flight control board.

We speculate endlessly.

Please describe your system at a block level and tell us the end goal for a flying computer.

a7

Thank you for your information. I have also found that FC boards nowadays use PPM or SBus or iBus input from the RC receiver.

So my plan is to receive the RC input from my DIY RC transmitter, receive is via DIY RC receiver (made with arduino nano and nrf240l).

So now I just need to cnovert these data to PPM, sbus, and ibus so that I can control the FC by my own controller.

Can you please tell me how can I convert the receiver data to PPM, sbus, and ibus?

Check Inav or Ardupilot.
Whatever you imagine, it's been done a thousand times over and proven to work.

Why all three?

PPM would be something like:

  // Every 20 milliseconds (50 Hz)

  if (millis() - LastPulseTime >= 20)
  {
    // Start marker:
    digitalWrite(OutputPin, LOW);
    digitalWrite(OutputPin, HIGH);
    for (int channel = 0; channel < ChannelCount; channel++)
    {
      delayMicroseconds(ChannelValues[channel]);
      digitalWrite(OutputPin, LOW);
      digitalWrite(OutputPin, HIGH);
    }
  }

Not all three, specially the sbus or ibus, because I have seen many modern FC have sbus or ibus, some don't have the PPM (I also can be wrong, please correct me then) , thats why sbus or ibus will be better.

Can you tell me how can I encode all the channel values to sbus or ibus? It will be soo much helpful for me.

And also thank you so much for the PPM code.

I'll check but I believe Betaflight, at least, allows selection of PPM as the expected control input protocol.

TBH I would not go between an Arduino and a FC with PPM. The modern serial digital protocols are better.

How you get the r/c transmitter information into the Arduino is entirely your choice. Since you are writing or stealing borrowing code for both, you can use any system you want, even one you make up yourself.

In the Arduino, you will therefor have access to the data from the transmitter, and whatever additional data you hope to modify, override or otherwise tinker with those values before passing them along to the FC.

Which mean you need to synthesize either bus signal protocol in the Arduino.

Google is your friend.

I found this

Arduino sbus article

but there's plenty more. Google

Arduino encode sbus

for example.

Or use PPM, it will work OK, probably, depending on what kind of flying you want to do.

a7

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