Futaba SBUS reverse engineered to work with Arduino

Got it. What you need to do is have a way to turn SBUS into PWM.

Let's talk at little bit more about SBUS and DSM2/DSMx serial. They are simply transmitting unsigned integers in raw binary over a UART. This means once you have these values you can do whatever you want with them. DSMx and SBUS have a 2048 resolution (2^11) whereas DSM2 has a 1024 (2^10) resolution. OK so the question now is how do we do something with this information.

First you map those values to a range you want to use:

void MapVar (float *x, float *y, float in_min, float in_max, float out_min, float out_max){
  *y = (*x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
void MapVar (int16_t *x, float *y, float in_min, float in_max, float out_min, float out_max){
  *y = (*x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

void MapVar (uint16_t *x, float *y, float in_min, float in_max, float out_min, float out_max){
  *y = (*x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

In the above code I am using pointers. In addition to using pointers you could simple pass the variables or make the variables global. For the servo control you want to generate a PWM signal. Here is a great article about the difference between the two:

http://www.endurance-rc.com/ppmtut.php

Both PPM and PWM use square waves of varying width to convey information. Let's look at servos and ESC (electronic speed controllers). They are controlled by PWM signal with a frequency between 50 - 500Hz and a pulse width of around 1000 - 2000us. For this signal we are concerned with the pulse width and not the PWM's duty cycle. The center is 1500us, but many servos center at 1520. If you run a servo at too high a frequency it will break the servo. This is also for ESCs.

There are a number of ways that you can generate these signals with the arduino. The easiest is to use servo.h. It will allow you to make a lot of these signals on any pin you want. It also doesn't run all that fast. The maximum refresh rate is ~125Hz. A good flight controller runs the control loops very fast and updates the ESCs at ~400Hz. You want to use AVR C. I know that can be a big turn off for a lot of people here since it is considered difficult. And it is, but it is not too bad. If you do it right you only have to figure it out once. Here is another code sample to illustrate how to generate higher frequency ESC PWM signals. This code was written for the mega, but if you look at the datasheet for the 128 it will become clear to you as to how to do it. If it not don't be afraid to ask for assistance with a concept you are struggling with.

//motor defines
#define FREQ 400
#define PRESCALE 8
#define PERIOD ((F_CPU/PRESCALE/FREQ) - 1)

#define Motor1WriteMicros(x) OCR3B = x * 2//motor 1 is attached to pin2
#define Motor2WriteMicros(x) OCR3C = x * 2//motor 2 is attached to pin3
#define Motor3WriteMicros(x) OCR3A = x * 2//motor 3 is attached to pin5
#define Motor4WriteMicros(x) OCR4A = x * 2//motor 4 is attached to pin6

void setup(){
  MotorInit();
  //do other stuff
}

void loop(){
  Motor1WriteMicros(1250);
  Motor2WriteMicros(someVar);
  //do other stuff
}

void MotorInit(){
  DDRE |= B00111000;//set the ports as outputs
  DDRH |= B00001000;

  
  // Init PWM Timer 3                                       
  // WGMn1 WGMn2 WGMn3  = Mode 14 Fast PWM, TOP = ICRn ,Update of OCRnx at BOTOM
  TCCR3A = (1<<WGM31)|(1<<COM3A1)|(1<<COM3B1)|(1<<COM3C1);  // Clear OCnA/OCnB/OCnC on compare match, set OCnA/OCnB/OCnC at BOTTOM (non-inverting mode)
  TCCR3B = (1<<WGM33)|(1<<WGM32)|(1<<CS31);                 // Prescaler set to 8, that gives us a resolution of 0.5us
  ICR3 = PERIOD;                                // Clock_speed / ( Prescaler * desired_PWM_Frequency) #defined above.  

  TCCR4A = (1<<WGM41)|(1<<COM4A1);
  TCCR4B = (1<<WGM43)|(1<<WGM42)|(1<<CS41);
  ICR4 = PERIOD;
  
  Motor1WriteMicros(1000);//set the output compare value
  Motor2WriteMicros(1000);
  Motor3WriteMicros(1000);
  Motor4WriteMicros(1000);
  
}

This code will not run on the miniPro. This is meant to be an example as to how to set this all up. Furthermore, the 128 only has 1 16bit timer. The above code gives a 0.5us resolution. To use this method with the 128 it will give you two channels with 16bit resolution and two channels with 8 bit of resolution.

Hope that helps. Let me know if there is anything further I can clear up for you.