SBUS decoder, display, and wireless buddy box project

Any old or new electronic projects on the go
Pete
Posts: 2
Joined: 27 Jun 2021, 20:10

Re: SBUS decoder, display, and wireless buddy box project

Post by Pete »

Hello Martin,
I have built your decoder and will use it as a SBUS display to check receiver output.
I works very well and was very easy to build (SH1106/Arduino Pro Mini/file:"sbusdecode4")

My display shows that all values that are slightly off (-4%).
Is it possible to tweak the values in the code to match those I see in my Taranis?

/Pete
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: SBUS decoder, display, and wireless buddy box project

Post by Martin »

Hi Pete,

Yes it's pretty easy - up near the top of the main sbusDecode4.ino file, you'll see two lines, one for scaling the SBUS numbers to microseconds, and one for scaling the SBUS numbers to percentages. The lines are line number 21 and 24. In the Arduino IDE, you can select Preferences from the File menu, and there's a check box to toggle on/off the display of line numbers.

The scaling is done by fitting a straight line through two points - the default values for microsecond scaling (at line 21) reads:

Code: Select all

#define MICROSECOND_SCALING 150, 1901, 1000, 2000
Which means that a raw SBUS value of 150 gets converted to 1000 microseconds, and a raw value of 1901 gets converted to 2000 microseconds. You don't have to use 150 and 1901 as the two SBUS values - probably best to set the decoder to display SBUS values, and see what range your Taranis gives out. Then adjust the scaling numbers, recompile and re-upload.

Similarly, for percentages, the default percent scaling (at line 24) reads:

Code: Select all

#define PERCENT_SCALING 150, 1901, -100, 100
Depending on the units your Taranis displays, you can adjust either or both of the scaling lines.

After one or two adjust/compile/upload/test cycles, you should be able to tweak the numbers to get perfect agreement with your Taranis.
Pete
Posts: 2
Joined: 27 Jun 2021, 20:10

Re: SBUS decoder, display, and wireless buddy box project

Post by Pete »

Hi,
Thanks. I will try this as soon as possible.

/Pete
BordIng
Posts: 1
Joined: 25 Jul 2021, 21:19

Re: SBUS decoder, display, and wireless buddy box project

Post by BordIng »

Hallo Martin

I have used your sketch for a FrSky XM receiver. It is built in a battle tank with dual path drive. The settings for the XM receiver are:
#define MICROSECOND_SCALING 172, 1811, 1000, 2000 // FrSky receivers will output a range of 172 - 1811

https://www.modelltruck.net/showthread. ... svagn-m-41

Best regards
Bert
RichardT
Posts: 18
Joined: 03 Mar 2019, 17:15
Location: Surrey

Re: SBUS decoder, display, and wireless buddy box project

Post by RichardT »

For anyone who might be interested, there's an SBUS decoder project at https://dronebotworkshop.com/radio-control-arduino-car/
It uses the IbusBM library
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: SBUS decoder, display, and wireless buddy box project

Post by Martin »

Minor update to allow more than 8 PPM channels to be output. See sbusDecode6.zip file attached to opening post. Defaults to 12 channels, but you can set any number up to 18 by editing the value NUM_PPM_CHANNELS in the config.h file.
The PPM update rate slows when more than 8 channels are selected. Each frame is NUM_PPM_CHANNELS * 2.2 + 4 milliseconds long.
Post Reply