Go Down

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

Glowtape

This is the inverter I use.
Both resistors are 1k


Nice to know this'll work instead of going with an 74HC14 or something.

CrossRoads

That's also good as a 12V driver for P-channel MOSFET to switch on higher voltage/current loads.
Pull up to 12V tho.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Glattnos

Hi

I have problem to get this work properly. I get nothing back on the serial-port when I try this 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";
  }
}

But when I change in the end of the FUTABA_SBUS.ccp file from this:
Code: [Select]

        if (bufferIndex == 24){
          feedState = 0;
          if (inBuffer[0]==0x0f && inBuffer[24] == 0x00){
            memcpy(sbusData,inBuffer,25);
            toChannels = 1;
          }
        }

to this where I comment out the "&& inBuffer[24] == 0x00" like this:
Code: [Select]

        if (bufferIndex == 24){
          feedState = 0;
          if (inBuffer[0]==0x0f){                 // && inBuffer[24] == 0x00){
            memcpy(sbusData,inBuffer,25);
            toChannels = 1;
          }
        }


It works

I guess the "&& inBuffer[24] == 0x00" statement is to check the end of the string to be sure that it is changed to 0x00, it is earlier in the code set to 0xFF like this:
Code: [Select]

else{
          bufferIndex = 0;
          inBuffer[bufferIndex] = inData;
          inBuffer[24] = 0xff;
          feedState = 1;
        }


I have a Futaba R7008SB-reciver. What can be wrong? Someone that have any idea?

Glattnos

#63
Dec 22, 2015, 07:05 pm Last Edit: Dec 22, 2015, 07:27 pm by Glattnos
After sending the whole string I see that it looks like this:
Code: [Select]

0F E5 43 9F FA 02 08 16 18 02 10 80 00 04 20 00 01 08 07 38 00 10 80 00 04
0F E5 43 9F FA 02 08 16 18 02 10 80 00 04 20 00 01 08 07 38 00 10 80 00 14
0F E5 43 9F FA 02 08 16 18 02 10 80 00 04 20 00 01 08 07 38 00 10 80 00 24
0F E5 43 9F FA 02 08 16 18 02 10 80 00 04 20 00 01 08 07 38 00 10 80 00 34
0F E5 43 9F FA 02 08 16 18 02 10 80 00 04 20 00 01 08 07 38 00 10 80 00 04
0F E5 43 9F FA 02 08 16 18 02 10 80 00 04 20 00 01 08 07 38 00 10 80 00 14
0F E5 43 9F FA 02 08 16 18 02 10 80 00 04 20 00 01 08 07 38 00 10 80 00 24
0F E5 43 9F FA 02 08 16 18 02 10 80 00 04 20 00 01 08 07 38 00 10 80 00 34

0F in the begining is the start bit, the next 22 bytes are the channels(22bytes x 8bits=176bits, 176bits/11-bits = 16 11-bit channels), then the next byte is 00 all the time, but that is in this case byte 23 and not 24 so I changed to this:
Code: [Select]
if (inBuffer[0]==0x0f && inBuffer[23] == 0x00) //Changed to 23 instead of 24
That works!

But the last byte, it is going 04, 14, 24, 34 all the time. Anyone know why it is like that?

Edit: Hmmm byte 23 is the failsafe-bit so thats why that one is 00, if failsafe will activate it will change. So why is the last byte changing like that?

Becherraecher

...

But the last byte, it is going 04, 14, 24, 34 all the time. Anyone know why it is like that?

Edit: Hmmm byte 23 is the failsafe-bit so thats why that one is 00, if failsafe will activate it will change. So why is the last byte changing like that?
Don't actually know what that byte is exactly. Am using FrSky and Spektrum.
But Have you recognized that your byte is always cycling '04, 14, 24, 34, 04, ...'?
Seem like a rolling counter or something. Maybe some watchdog functionality for receiving bus members?
Maybe only first byte is counter '0x, 1x, ...' and second byte is something like a status byte 'y4, (y+1)4, ...' and changing when receiver is connected to TX or in binded state or something else?

Just my late night thoguths :)

Regards

dsones

Hi guys,

It is pretty cool this works!
Now that its know how it works is there any wat to reverse this and use it to send the sbus data from the arduino to a transmitter? something like a frsky xjt transmitter?

I would love to make a transmitter that way, send button or pulse signals to the arduino and finally send them converted in sbus to the xjt transmitter!

Sorry if my english is confusing im from the netherlands and not that good with this language..

Also pretty new to this forum lol!


Hope somebody had a idea/anwser to this, or maybe work something out together?


Cheers!

Erni

Quote
is there any wat to reverse this and use it to send the sbus data from the arduino
You can genrate the SBUS data on an Arduino by using this sketch:

rcgroups

If you want to make a FrSky like transmitter, you could just Flash OpenTX on an Arduino Mega:

rcgroups

dsones

Thank you very much erni.
You gave me so much good info!

I will take a look at it and if i come any furter i will update you.


i3dm

Hello guys,

i read some posts in this thread, and focused on the HW side - seems like a logic inverter is needed.
is there a way to run Sbus codes on a Pro Mini with no external HW?
i know the pro mini can do at least 2 PWM outputs, but im actually looking at going a different way and use the Arduino Pro mini to gather serial data from Jetcat ECU and convert it to SBUS protocol for telemtry.

i already did the Jetcat serial communication side when i did my mini GSU project:
https://www.youtube.com/watch?v=0nNGnf0DVl8

dally

is there a way to run Sbus codes on a Pro Mini with no external HW?
I am afraid the answer is no
Hey Ho! Pip & Dandy! Cooking my maleficent weapons

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy