SBUS decoder, display, and wireless buddy box project
-
- Posts: 748
- Joined: 16 Feb 2018, 14:11
- Location: Warwickshire
Re: SBUS decoder, display, and wireless buddy box project
Sorry, I know the sketch could be simpler. If I were to start over, I'm sure it would be. It's the way it is because I was learning how SBUS works as I wrote it.
In the latest sketch it's scaling the displayed PPM values on the OLED to make them go 1000 to 2000, but the values it's actually putting out on Pin 9 have a different simpler scaling - so your external PPM tester will display different values to the ones on the OLED. Different manufacturers seem to use different ranges for the SBUS signal - though they all seem to agree that the centre is at about 1024.
For controlling a model, it doesn't make much difference, because we usually adjust the throws to give the right amount of control throw, and we don't worry too much about the actual SBUS numerical values.
Those are some nice vintage sets in your photo. I bet Frank, also from Germany, probably has one, or a replica he's made.
In the latest sketch it's scaling the displayed PPM values on the OLED to make them go 1000 to 2000, but the values it's actually putting out on Pin 9 have a different simpler scaling - so your external PPM tester will display different values to the ones on the OLED. Different manufacturers seem to use different ranges for the SBUS signal - though they all seem to agree that the centre is at about 1024.
For controlling a model, it doesn't make much difference, because we usually adjust the throws to give the right amount of control throw, and we don't worry too much about the actual SBUS numerical values.
Those are some nice vintage sets in your photo. I bet Frank, also from Germany, probably has one, or a replica he's made.
- tiptipflyer
- Posts: 396
- Joined: 16 Feb 2018, 22:49
- Location: Germany
Re: SBUS decoder, display, and wireless buddy box project
Yes Martin you are right.
Th OMU117Q is a replica, all others are originals and are all in working condition. Frank
Th OMU117Q is a replica, all others are originals and are all in working condition. Frank
-
- Posts: 748
- Joined: 16 Feb 2018, 14:11
- Location: Warwickshire
Re: SBUS decoder, display, and wireless buddy box project
Very nice Frank! Maybe you and KH might meet up somewhere one day when COVID-19 restrictions are relaxed, so you can show him some of your transmitters and models.
I realized it was stupid to output different PPM values to the ones displayed, so I've modified the sketch again to:
A) output the displayed values.
B) make it easier to alter the scaling from SBUS to PPM (and percent) values.
Download the sbusDecode4.zip from the opening post in this thread. Unzip the sBusDecode4 folder to your Arduino folder.
The scaling now makes use of the Arduino's map() function. See the #define at line 21 of the sketch:
#define MICROSECOND_SCALING 150, 1901, 1000, 2000
This causes an SBUS range from 150 to 1901 to be mapped to a PPM (microsecond) range from 1000 to 2000. Alter the values to suit your particular transmitter/receiver combination, and the PPM range you want.
There is a similar PERCENT_SCALING at line 24. The default values to suit my little Orange receiver are:
#define PERCENT_SCALING 150, 1901, -100, 100
I realized it was stupid to output different PPM values to the ones displayed, so I've modified the sketch again to:
A) output the displayed values.
B) make it easier to alter the scaling from SBUS to PPM (and percent) values.
Download the sbusDecode4.zip from the opening post in this thread. Unzip the sBusDecode4 folder to your Arduino folder.
The scaling now makes use of the Arduino's map() function. See the #define at line 21 of the sketch:
#define MICROSECOND_SCALING 150, 1901, 1000, 2000
This causes an SBUS range from 150 to 1901 to be mapped to a PPM (microsecond) range from 1000 to 2000. Alter the values to suit your particular transmitter/receiver combination, and the PPM range you want.
There is a similar PERCENT_SCALING at line 24. The default values to suit my little Orange receiver are:
#define PERCENT_SCALING 150, 1901, -100, 100
- kalle123
- Posts: 35
- Joined: 02 Feb 2021, 07:06
Re: SBUS decoder, display, and wireless buddy box project
So this is sBusDecode4a, Martin.
Did not find the time, to check sBusDecode4 or sBusDecode4a at the moment, but I'll report.
br KH
Did not find the time, to check sBusDecode4 or sBusDecode4a at the moment, but I'll report.
br KH
- kalle123
- Posts: 35
- Joined: 02 Feb 2021, 07:06
Re: SBUS decoder, display, and wireless buddy box project
I rearranged the spacing here a little in those 3 lines, so the numbers fit the screen a bit better.
But what puzzles me here Martin, maybe you can see it in this video
I am sending 8 channels, which are correct
1500 1500 1000
1500 1000 1000
1500 1500 1350
But what is that #9 ??
When i scroll on the TX through output, it tells me beginning with channel #9 1500 1500 1500 .....
Any idea?
br KH
But what puzzles me here Martin, maybe you can see it in this video
I am sending 8 channels, which are correct
1500 1500 1000
1500 1000 1000
1500 1500 1350
But what is that #9 ??
When i scroll on the TX through output, it tells me beginning with channel #9 1500 1500 1500 .....
Any idea?
br KH
-
- Posts: 748
- Joined: 16 Feb 2018, 14:11
- Location: Warwickshire
Re: SBUS decoder, display, and wireless buddy box project
I'm not sure. What kind of receiver are you using?
From the SBUS screen of the OLED it looks like the Arduino is "seeing" an SBUS value of 768 for channel 9, even though (I think) your transmitter isn't sending anything for that channel. 768 is 1100000000 in binary (300 hex).
It could be a bug in my code. The only receivers I've tried it with are my Orange one in the video and the small X-BOSS V2. I think they're both only eight channel, so I've never taken much notice of channels 9-18. If you watch my most recent YouTube video, you'll see the channel 9 value there (when in SBUS mode) is flicking between 0, 512, 768, 1024, 1280, and 1792 - which are all (suspiciously) multiples of 256. I think it's then correctly scaling those (wrong) values to either percent or microseconds, the same as it scales the 'real' channel values.
It would be nice to try the sketch with a receiver with more than 8 SBUS channels. I'm not sure if I have one, but maybe one of my FlySky receivers (and I have some ten channel ones) can output SBUS? I'll investigate.
If you know your setup is only using 8 channels, the simplest fix would be to alter the for loop, so it only tries to display the first 8 channels.
From the SBUS screen of the OLED it looks like the Arduino is "seeing" an SBUS value of 768 for channel 9, even though (I think) your transmitter isn't sending anything for that channel. 768 is 1100000000 in binary (300 hex).
It could be a bug in my code. The only receivers I've tried it with are my Orange one in the video and the small X-BOSS V2. I think they're both only eight channel, so I've never taken much notice of channels 9-18. If you watch my most recent YouTube video, you'll see the channel 9 value there (when in SBUS mode) is flicking between 0, 512, 768, 1024, 1280, and 1792 - which are all (suspiciously) multiples of 256. I think it's then correctly scaling those (wrong) values to either percent or microseconds, the same as it scales the 'real' channel values.
It would be nice to try the sketch with a receiver with more than 8 SBUS channels. I'm not sure if I have one, but maybe one of my FlySky receivers (and I have some ten channel ones) can output SBUS? I'll investigate.
If you know your setup is only using 8 channels, the simplest fix would be to alter the for loop, so it only tries to display the first 8 channels.
- kalle123
- Posts: 35
- Joined: 02 Feb 2021, 07:06
Re: SBUS decoder, display, and wireless buddy box project
Used the same RX, expanded SBUS to 16 channels.
1st column is aileron, 2nd column elevator and 3rd column rudder
But see for yourself ....
https://youtu.be/OD0isjcMAm4
br KH
1st column is aileron, 2nd column elevator and 3rd column rudder
But see for yourself ....
https://youtu.be/OD0isjcMAm4
br KH
-
- Posts: 748
- Joined: 16 Feb 2018, 14:11
- Location: Warwickshire
Re: SBUS decoder, display, and wireless buddy box project
Thanks. It does look like a bug in my code for the ninth channel. I've not looked at my receivers yet to see if I have one that can do more than eight SBUS channels - maybe later today.
- kalle123
- Posts: 35
- Joined: 02 Feb 2021, 07:06
Re: SBUS decoder, display, and wireless buddy box project
Martin, if you can find nothing, I'll do the test with another RX.
KH
KH
-
- Posts: 748
- Joined: 16 Feb 2018, 14:11
- Location: Warwickshire
Re: SBUS decoder, display, and wireless buddy box project
It might be useful if you could set up a model memory on your Taranis to output fixed values to each of the 16 channels. So on the MIXER page, set CH1 to output, say, 5 MAX (on the MIXER page for channel 1 choose MAX as the source and 5 as the weight, untick the Trim). Then go up in steps of, say, 5 for each of the other fifteen channels:
Then you could see what SBUS values are displayed on the OLED - and if any channel looks wrong, try altering (on the Taranis) the weight for that channel to see if it makes any difference.
Code: Select all
MIXER
CH1 5MAX
CH2 10MAX
CH3 15MAX
. .
. .
CH15 75MAX
CH16 80MAX