Use RC Remote for Flight Simulator with Arduino

Posted by admin on Samstag 23 Januar 2016

Since I was not able to use the serial cable of my FlySky FS-CT6B with my Mac, I’ve searched for an alternative to use my remote with flight simulators.

With the help of UnoJoy I was able to use my Arduino Uno (Rev 3) as a joystick input. The Arduino library EnableInterrupt is very handy for interrupt handling, which is needed to decode the PWM signals provided by the RC receiver.

Here my setup:

  1. Connect GND of Arduino with the (-) pin in the Bat row of the receiver
  2. Connect 5V of Arduino with the (+) pin in the Bat row of the receiver
  3. Connect each data pin of the receiver channels with an Arduino channel. E.g CH1 to Arduino 2, CH2 to 3, …
  4. Upload the source code below to your Arduino
  5. Follow the instructions from UnoJoy to turn your Arduino in a joystick
  6. Start you favorite flight simulator like HeliX
  7. Enjoy!

#include "UnoJoy.h"

static const int Channels = 6; // 0 - 5
static int ChannelsToPin[Channels] = {2, 3, 4, 5, 6, 7};
static int PinToChannels[8] = {0, 0, 0, 1, 2, 3, 4, 5};
volatile int PwmValue[Channels] = {0};
volatile int PrevTime[Channels] = {0};

void rising()
  const int Pin = arduinoInterruptedPin;
  PrevTime[PinToChannels[Pin]] = micros();
  enableInterrupt(Pin, falling, FALLING);

void falling() {
  const int Pin = arduinoInterruptedPin;
  const int Channel = PinToChannels[Pin];
  PwmValue[Channel] = micros()-PrevTime[Channel];
  enableInterrupt(Pin, rising, RISING);

void setup() {
 for(int i = 0; i < Channels; ++i) {
  pinMode(ChannelsToPin[i], INPUT_PULLUP);
  enableInterrupt(ChannelsToPin[i], &rising, RISING);

void loop() {
  dataForController_t controllerData = getControllerData();

dataForController_t getControllerData(){
  dataForController_t controllerData = getBlankDataForController();
  controllerData.leftStickX = crop8(map(PwmValue[2]-1500, -450, 450, 0, 255));
  controllerData.leftStickY = crop8(map(PwmValue[3]-1500, -450, 450, 0, 255));
  controllerData.rightStickX = crop8(map(PwmValue[1]-1500, -450, 450, 0, 255));
  controllerData.rightStickY = crop8(map(PwmValue[0]-1500, -450, 450, 0, 255));
  return controllerData;

uint8_t crop8(int val) {
  return min(255, max(0, val));

2 Responses to “Use RC Remote for Flight Simulator with Arduino”

  1. URL

    … [Trackback]…

    [...] Informations on that Topic: [...]…

  2. Massimo

    Hello, is 3 days that i’m trying to use my FS-i6 radio with my reciever FS-IA6 connected to Arduino UNO REV3. I already used UnoJoy for some homemade controllers, but with this project i cannot find a solution.

    I uploaded on arduino, both this code and the updated one on Dropbox, connected everything, used the unojoy script to convert the arduino in joystic…. but no results, the only thing i have is mixed signals in the “controller proprieties” inside windows, or no movement at all.

    In serial port from your sketch from dropbox i see the values changing, but when i use the script from unojoy to convert it to joystic, nothing happen and the joystick proprieties dosent show movement…


Leave a Reply

Spam protection by WP Captcha-Free