Futaba SBUS reverse engineered to work with Arduino

Thank you for sharing your amazing work! I have a question, may be it is already being answered, please bare with me I am new to this :slight_smile: . From my understanding, the Sbus Protocol is a 25bytes data with 12 bits per byte and 12 X 25= 300 bits. I am trying to make Arduino communicating with NAZE 32 flight controller by using Sbus. Basically, if a ultra-sonic sensor is being used to measure the height and id it is below certain preset value, it will send a signal to increase the throttle automatically. It is a little bit confuse here, since many of the post mentioned that the Sbus data is something like this:
0x0F5C9126377FA46AAB00108000042000010870000210800C00 this is not 300 bits data and where is the start bit, paritybit and stop bit?

S-BUS protocol

The protocol is 25 Byte long and is send every 14ms (analog mode) or 7ms (highspeed mode).
One Byte = 1 startbit + 8 databit + 1 paritybit + 2 stopbit (8E2), baudrate = 100'000 bit/s
The highest bit is send first. The logic is inverted (Level High = 1)

[startbyte] [data1] [data2] .... [data22] [flags][endbyte]

startbyte = 11110000b (0xF0)

data 1-22 = [ch1, 11bit][ch2, 11bit] .... [ch16, 11bit] (ch# = 0 bis 2047)
channel 1 uses 8 bits from data1 and 3 bits from data2
channel 2 uses last 5 bits from data2 and 6 bits from data3
etc.

flags = bit7 = ch17 = digital channel (0x80)
bit6 = ch18 = digital channel (0x40)
bit5 = Frame lost, equivalent red LED on receiver (0x20)
bit4 = failsafe activated (0x10)
bit3 = n/a
bit2 = n/a
bit1 = n/a
bit0 = n/a

endbyte = 00000000b

I have tried the code in this link Arduino S-BUS Packet Generator Code - RC Groups However, it will only output 16 random hex number. I do not have any control to it.

Has anyone here managed to get a working SBUS to PPM servo HUB with a nano or ProMini? Or this has absolutely nothing to do with anyone's intention in these posts? Because I've searched for some time and I noticed that this is a frequently requested code and so far I couldn't manage to find an organized project about this.

This would be the reference for what I mean exactly:Green Color 16CH Receiver PWM/PPM/SBUS/DBUS To Signal Converter Module For DJI N Sale - Banggood USA sold out-arrival notice-arrival notice
That would be awesome to use with this:http://www.banggood.com/2_4G-8CH-Compatible-Receiver-for-Futaba-T6J-T8J-T10J-T14SG-S-FHSS-S-SBUS-p-1050812.html?rmmds=search

I really hope to see something about this because a nano board is much cheaper than this converter!

Hi all,

I am trying to implement a sensor to a drone to avoid obstacles. I want to control the pitch channel so that when the drone senses an obstacle in front, the Arduino will overwrite the pitch channel, the drone will pitch up, and move back to avoid the obstacle.

I am using a 8 channel Futaba R2008SB radio receiver. I downloaded the Arduino libraries:

FUTABA_SBUS library: GitHub - mikeshub/FUTABA_SBUS: SBUS driver for arduino
Streaming library: Streaming | Arduiniana

I used a 74LS14 hex inverter.
I connected the SBUS signal of the radio receiver to input of an inverter, the output of the inverter to the RX of the Arduino.
The TX of the Arduino connected to the input of another inverter, the output of the inverter to the RC signal of the Pixhawk.

I opened the serial monitor and set it to 115200 baud, however, there is no numbers displayed on the serial monitor.

I am wondering if the code is suitable for 8 channels, or am I required to modify the code to suit 8 channels? Does the code work if some of the channels between the radio transmitter and the radio receiver are inverted? Also, I am not sure whether my circuit connections are correct.

I do not understand SBUS protocol. I am interested to learn about how the bytes affect the channels.

I hope to receive help please, I would appreciate your help. Thanks.

Below is the code:

#include <FUTABA_SBUS.h>
#include <Streaming.h>


FUTABA_SBUS sBus;


void setup(){
  sBus.begin();
  Serial.begin(115200);
}

void loop(){
  sBus.FeedLine();
  if (sBus.toChannels == 1){
    sBus.UpdateServos();
    sBus.UpdateChannels();
    sBus.toChannels = 0;
    Serial<<sBus.channels[0]<<","<<sBus.channels[1]<<","<<sBus.channels[2]<<"\r\n";
  }
}

Hello

@caiopoit here is a Project you search for. But it is in German:

You have to download the LIB's too, because they where modified for the MICRO!
And copy the Futaba-sbus and RC Dir's into your Arduino-Libs-Dir

The Inverter with npn-Transistor on Top of Page 5 do his work! I Use about 12kohm Pullup and 5,7kohm Basis resistor.

Hey all..

I would be very grateful anyone can help.

I have been using the fantastic Futaba SBUS Library on an Arduino Mega to read channel data from a FRSky X8R / Taranis. I am using the inverter described here.

I get frequent Lockups, where the transmitter will stop responding and my robot will just going until i reset the Arduino. Sometimes after 20 seconds, sometimes after 5 mins. I have built several robots which use this library and I have experienced the same problem on all.

I am using the stock FUTABA_SBUS_h Library and RX SerialPort 3 on the Mega to receive the Sbus Data.

It's starting to drive me crazy. Any help much appreciated.
I have no idea how to debug.

mturneruk:
using the fantastic Futaba SBUS Library on an Arduino Mega to read channel data from a FRSky X8R / Taranis.
...several robots which use this library and I have experienced the same problem on all.

Have you tried a Futaba Tx/Rx? If not you've bet the farm on the skills of the Chinese reverse engineering department. They're notorious for de-engineering things, lowering parts specs, leaving parts out, and changing critical circuit points just to save a few nickels. Which often leads to failure

Hey guys.

I know it's an older thread, but I thought I'll post a version of my Futaba S-BUS Library. It might be useful for some.

The library can be cloned (the latest version) here.

I've attached the latest build, but try and use the one from the above link always as that's going to be the latest version.

Szabi

ardued:
Hi, thanks for nice work on this code :slight_smile:
I have tried the code, made transistor signal inverter and i read the values of ch 1-8.

Arduino ProMicro 16Mhz
Reciever = Futaba R6303SB
Transmitter = Futaba 10C

Any idea on why dont i get values from channel 9 and 10?
ch9 stays solid on value 1023
ch10 stays solid on value 0

Solution:
Well i found it so i leave this post here if someone else wonders.
In the libraryfile "FUTABA_SBUS.h" i removed "//" before `1
Now it works perfectly and prints all channels :slight_smile:

Thanks for posting this...now I've got all 16 channels of my Taranis after uncommenting #define ALL_CHANNELS. Before this, I was only able to see channels 1-8 changing.

Next step for me is to pass along some of these values to a Pololu Servo Maestro controller.

Here is my updated serial display line with all channels

    Serial<<sBus.channels[0]<<"\t"<<sBus.channels[1]<<"\t"<<sBus.channels[2]<<"\t"<<sBus.channels[3]<<"\t"<<sBus.channels[4]<<"\t"<<sBus.channels[5]<<"\t"<<sBus.channels[6]<<"\t"<<sBus.channels[7]<<"\t"<<sBus.channels[8]<<"\t"<<sBus.channels[9]<<"\t"<<sBus.channels[10]<<"\t"<<sBus.channels[11]<<"\t"<<sBus.channels[12]<<"\t"<<sBus.channels[13]<<"\t"<<sBus.channels[14]<<"\t"<<sBus.channels[15]<<"\r\n";

And of course, thanks to Mike for the library!

Hi,

I am new the arduino and uav.
Currently my project requires me to have arduino communicate with f3 fc.
Knowing f3 supports Uart, how can I use arduino to simulate sbus/ibus RX and TX serial input to f3 fc

I am also looking for a project or example too, trying to generate the sBus signal - not RECEIVE the signal.

Here is an example for sending SBUS signal

www.rcgroups.com

Thank you Erni. I recently discovered, the sBus signal is generated at the RX module level. I was under the impression it was generated at the transmitter, and sent through RF modules - but that is not the case.

Do you know if there is a transmitter library / project I can learn to connect to a TX module, to bind to an RX sBus (or iBus) ?

You could take a looke at the opentx project:

http://www.open-tx.org/

They have a version for Arduino Mega.

This is the forum if you have any questions:

http://openrcforums.com/

I am also struggling with this sketch. I am using the Elegoo Mega1560 and keep getting the

##avrdude: stk500v2_ReceiveMessage(): timeout

errors when trying to upload. Usually, I can unplug the RX0 which is going to my inverted SBUS signal, and the sketch then uploads, but then when I plug it back in and open up serial monitor, I don't get proper values. Using http://www.ernstc.dk/arduino/pic/inverter_sbus.jpg as my inverter with 1 10k and 1 5k resistor and a PN2222A transistor. can't burn bootloader to mega board either. Thinking it might be the board, and possibly will switch to an Uno. Any suggestions?

robweidner:
I am also struggling with this sketch. I am using the Elegoo Mega1560 and keep getting the

##avrdude: stk500v2_ReceiveMessage(): timeout

I never seen a ellego mega1560 before. If that works same way as meg2560, my advice is to remove your custom ciruitry first. Then try compile and upload a test led blinker sketch. If that works, try compile and upload the futaba compiled sketch.

Once you knos you csn upload a sketch to the bare board, then move on to adding circuits to test the software that it runs.

So I have wired up my 2x 1k resistor inverter and have managed to get the upload to complete, but when I open up the serial monitor, nothing shows up...

Ok, my next advice would be to upload a test sketch, and make sure you can see serial data in the monitor. Send "hello world" to serial port on loop.

Hello. i have a big problem i need yours help.
i use RB7008SB and arduino. i made a inverter circuit.
i see SBUS protocol data on putty no problem but data frame is different.
data frame problem same like this post:
@Glattnos —> #63
here is my sbus output on putty

Hello, i have tryed to run this Programm GitHub - kreidler/SBus_Decoder: S.Bus to PWM/PPM decoder on a Pro Mini 3,3V.
But there is a Problem with the PWM Output. The Pro Mini give out a PWM Signal but not the correct Framerate and Puls! The Framerate should be 20 ms but it is about 45 ms and the puls is also 2-4 ms!
So my Servos run to the Endpoint at middle Position!
I think this can be a Problem with the 8 MHz instead of 16 MHz Rate by a Pro Mini 3,3V!
Is it Possible to change the Progamm for a Pro Mini 3,3V 8 Mhz?
I dont know much about Programming so please give me excact Instuctions or a changed Programm!