Go Down

Topic: Futaba SBUS reverse engineered to work with Arduino (Read 102135 times) previous topic - next topic

joe147

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: https://github.com/mikeshub/FUTABA_SBUS
Streaming library: http://arduiniana.org/libraries/streaming/

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:

Code: [Select]
#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";
  }
}

Eagle71

Hello

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

http://fpv-community.de/showthread.php?32899-FrSky-TARANIS-Hardware-Mods&p=477461&viewfull=1#post477461

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.

mturneruk


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.

jbarchuk

#78
Apr 15, 2017, 05:02 pm Last Edit: Apr 15, 2017, 05:04 pm by jbarchuk
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

szabi

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

Dagroid

#80
Aug 20, 2017, 06:53 pm Last Edit: Aug 20, 2017, 08:12 pm by Dagroid
Hi, thanks for nice work on this code :)
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 :)
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
Code: [Select]
    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!

Eurcka

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

DocStein99

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

Erni


DocStein99

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) ?

Erni

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/

robweidner

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?

DocStein99

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.

robweidner

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...

Go Up