I’ve been looking for ages and can’t find a single useful thing that shows you how to use the library and explains it.
Does anyone know if there is anything on how to use it.
Also for some reason there was no option to use the Libraries category in Projects
Please post a link to where you have seen this library. Does it come with any examples ?
From GitHub - bolderflight/sbus: Arduino and CMake library for communicating with SBUS receivers and servos.
don’t know if this is the lib the OP uses, but the protocol has a limitation
SBUS uses an inverted serial protocol, which is not commonly supported in Arduino. This library is able to use inverted serial for the following microcontrollers:
So the processor should be able to use either inverted logic, or one should add hardware inverters to get it working.
(never used it so I have no expertise)
The SoftwareSerial library allows you to use an inverted protocol
I don't know about a tutorial but the use is quite straight forward; it's a while ago that I worked on a project with the bolderflight SBUS library.
- Read the sbus using the library
if (sbus_rx.Read())
{
/* Grab the received data */
data = sbus_rx.data();
- Extract a channel value
chValue = data.ch[chNo];
- Do something with the channelValue; e.g.
analogWrite(somePin, a processed channel value);
Step 3 highly depends on what you want to do with the channel. processed channel value should by something that can be used by the actual functionality (e.g. 0..180 for a servo position or 0..255 for a LED PWM value).
Not at the required speed of 100,000 baud 
1 Like
Arduino Docs or GitHub File
Sorry for the slow response
What does a hardware inverter do to the signal and how do you wire one?
It inverts the signal; a logic 1 becomes a logic 0 and vice versa.
Searching the web helps
See e.g. How to read SBUS via Arduino Boards? | by SM FARAJI | Medium
After using the code and outputting to the serial monitor, this comes out:
qqmqqmqqmqqiqqmqqmqqmqqmqqmqqi
Does anyone know why
Are the baud rates of the sketch and Serial monitor the same ?
Yes, they are both 115200
After following the steps and using the code from here, medium.com this is what comes out:
a```a`````�7�2]������3�8������a```a```annna```a```a`
The post was made 2 years ago, is it outdated for the current version of the library?
I am using an NPN PN2222 as the inverter, will that work?
Double check your inverter circuit.
Post your sketch.
Which board are you using?
If your baud rates are same, check the serial chip involved. I have found CH340 chips to behave like this unreliably even with matched baud rates.
Or, the serial outputs are getting corrupted by hard signal noise.
Cheers.
I double checked the circuit
Here is the sketch:
#include "sbus.h"
/* SBUS object, reading SBUS */
bfs::SbusRx sbus_rx(&Serial); // if Arduino is Uno: sbus_rx(&Serial)
/* SBUS object, writing SBUS */
bfs::SbusTx sbus_tx(&Serial); // if Arduino is Uno: sbus_tx(&Serial)
/* SBUS data */
bfs::SbusData data;
void setup() {
/* Serial to display data */
Serial.begin(115200);
while (!Serial) {}
/* Begin the SBUS communication */
sbus_rx.Begin();
sbus_tx.Begin();
}
void loop () {
if (sbus_rx.Read()) {
/* Grab the received data */
data = sbus_rx.data();
/* Display the received data */
for (int8_t i = 0; i < data.NUM_CH; i++) {
Serial.print(data.ch[i]);
Serial.print("\t");
Serial.primt("\n");
}
/* Display lost frames and failsafe data */
Serial.print(data.lost_frame);
Serial.print("\t");
Serial.println(data.failsafe);
/* Set the SBUS TX data to the received data */
sbus_tx.data(data);
/* Write the data to the servos */
sbus_tx.Write();
}
}
Arduino Uno but I will switch everything to a Mega when I get it working
What is a serial chip and how can I check it? Is it part of the arduino and if so, would switching to a mega or nano use a different chip?
You have a conflict. It looks like your using the Uno's UART for both the SBUS and communication with the PC.
Switch to the Mega now, you're wasting your time with an Uno.
I switched over and I’m having the same problem.