SBUS to PWM (servo) outputs.

List all your sketches here
Post Reply
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

SBUS to PWM (servo) outputs.

Post by Martin »

Here's a little sketch that allows a standard 8-bit Arduino (Nano, Uno, Pro Micro, etc.) to receive an inverted SBUS signal, and drive up to eighteen servos from the information encoded in the SBUS. SBUS contains sixteen 'normal' channels, plus an extra two 'switch' channels that are just on or off. The inverted SBUS signal goes in on RX0, and the servo (PWM) outputs are (in order) on D2 - D13, plus A0 - A5.

Some SBUS receivers can be switched or wired to provide the inverted SBUS signal, but if yours can't, you just need one transistor or FET to invert the signal. I prefer using a 2N7000 FET - gate connects to the receiver signal, source to ground, and drain to the Arduino RX0 input. You can also use an NPN transistor in which case base via 10K to receiver signal, emitter to ground and collector to the Arduino RX0 - put a 10K pull-up resistor on the collector/RX0 pin.



If you're uploading the sketch to the Arduino via the normal serial (USB) connection, make sure to disconnect the SBUS signal during the upload. If you don't, t won't hurt anything, but it will prevent the upload from working.
Attachments
SBUS2PWM.zip
2022-Apr-29 Slightly modified to give better performance.
(2.2 KiB) Downloaded 98 times
Last edited by Martin on 29 Apr 2022, 12:49, edited 1 time in total.
MaxZ
Posts: 330
Joined: 31 Jan 2019, 11:48
Location: Boskoop, Netherlands

Re: SBUS to PWM (servo) outputs.

Post by MaxZ »

Just what I needed Martin!

I bought a cheap set that came with a Rx that only does ppm or serial (bit of a mistake, both Tx without trim buttons or sliders, and Rx without direct PWM outputs). It now provides a great chance to experiment with S.Bus.

Cheers,
Max.
User avatar
Flynn
Posts: 64
Joined: 17 Feb 2018, 14:48

Re: SBUS to PWM (servo) outputs.

Post by Flynn »

It's just a shame that you need something the size of the empire state building to run it on.......
You only ever need two tools....WD40 and duct tape.
If it doesn't move when it should use the WD40 and if it moves and it shouldn't use the tape.
Tobe
Posts: 665
Joined: 16 Feb 2018, 06:19
Location: Varberg or Stockholm, Sweden

Re: SBUS to PWM (servo) outputs.

Post by Tobe »

Amazing job as usual Martin.

Martin is showing a concept and a possibility but like everything else it's just one in many necessary steps to get closer to a product.
A custom PC-board would be quite easy to make but that's a xx$ question as it involves costs so the question is how many are interested and are willing to pay what the cost would be.
Cheers,

Tobe
MaxZ
Posts: 330
Joined: 31 Jan 2019, 11:48
Location: Boskoop, Netherlands

Re: SBUS to PWM (servo) outputs.

Post by MaxZ »

And a DIYMore board (as Martin suggests in the video) is only about 40 x 40 mm.

Cheers,
Max.
Spike S
Posts: 181
Joined: 16 Feb 2018, 14:59
Location: Salisbury UK

Re: SBUS to PWM (servo) outputs.

Post by Spike S »

An interesting coding exercise and Martin eloquently shows what is achievable for those who wish to grow their own. However, the validity of batch or volume production would have to be analysed in the light of products already out there:
https://www.aliexpress.com/item/4000007 ... 987497"%7D

One of my flying buddies recently purchased a tiny 'cheapo' Rx (seemed like a good idea at the time). On receipt he realised it was probably a drone component and had only one output for CPPM or SBUS which was outside his previous electrickry experience. He bought one of those converters to drive a normal batch of PPM servos and it worked perfik !
Spike S
(Tune for maximum smoke)
bluejets
Posts: 316
Joined: 19 Jun 2019, 04:09

Re: SBUS to PWM (servo) outputs.

Post by bluejets »

Seems the Aliexpress unit will do any/or as well.
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: SBUS to PWM (servo) outputs.

Post by Martin »

That's a very neat unit, based on an STM32 chip, which is both more powerful, and cheaper, than our 8-bit Arduinos. It's not mentioned in the description, and maybe it can't do it, but it would be a useful option if you could solder a link on the board so that it outputs SBUS channels 9-16 as PWM instead of channels 1-8. That way you could use two of those boards in tandem to get all the (normal) 16 channels of an SBUS signal output as PWM channels.

Of course, most users wouldn't be interested in channels 9-16, and many of the cheaper receivers only output the first 8 channels in their SBUS signal, anyway.
bluejets
Posts: 316
Joined: 19 Jun 2019, 04:09

Re: SBUS to PWM (servo) outputs.

Post by bluejets »

Hi Martin,
This video might say....I'm not all that familiar with all the jargon but I'm sure you'll understand it.
Seems there might be a button press to do what you want.

Cheers Jeff

https://www.youtube.com/watch?v=4ltV21KmzIY
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: SBUS to PWM (servo) outputs.

Post by Martin »

Yes Jeff, you're right. I watched the video you linked and he says that on the Banggood one, you just press the button to switch between channels 1-8 and 9-16. Looks like the programming pins are available on a (not-fitted) header too, so a neat STM32 board to have and write your own program for.

However, the cheaper AliExpress board doesn't have the button or programming header pads.

Banggood version £14.06 + £2.33 shipping

AliExpress Version £4.03 + £3.81 shipping
Post Reply