This tutorial will show you how to make your own DIY SBUS to USB converter. This would allow you to fly FPV simulators wirelessly using any FrSky SBUS Receiver. All you need is a cheap STM32F1 development board.
Before we begin, I should make it clear that it would not be cost effective to buy a brand new SBUS receiver just for the sole purpose of doing this project. If you don’t have any spare SBUS capable receivers lying around already, you might as well just buy a dedicated USB simulator dongle for a similar price instead.
You can also fly simulators wirelessly using a flight controller instead of an STM32F1 if you have a spare one lying around. If not, it’s cheaper to buy an STM32F1 board.
This tutorial is written by Darren Louw, huge thanks to him for sharing this with the community.
You can use any Frsky receivers with SBUS output for this USB converter, R-XSR, XM, X4R… these should all work. In this example, I will be using a FrSky RX8R which is bound to a Taranis QX7.
STM32F1 Development Board
This is a micro controller, the “brain” of the converter that will handle the SBUS to USB conversion. It basically encodes the SBUS signal into a “language” that your computer can understand, thus functioning like a virtual joystick on your computer.
The good news is, you won’t need to write any code to get this board working, I will provide the necessary file in this guide, and you just need to upload it to the board.
These boards are very cheap, usually only costing around $3 to $7. Here are some vendors:
- Amazon: https://amzn.to/2T4K7bX
- Banggood: http://bit.ly/2S12v8m
Flashing the STM32F1 Board
The STM32F1 board cannot be flashed through its micro USB port, and needs a USB to Serial FTDI adapter, such as this one: http://bit.ly/2I2jD8K.
This is in fact an extremely useful tool in FPV and can be used in many situations, like flashing flight controller when the USB port is dead, flashing your goggle modules, updating firmware on iSDT chargers…
Here is mine:
It should normally work out of the box, but if your PC does not recognize the USB to Serial adapter, you might need to install the driver first. It’s easy on Windows 7 and 10, simply enable windows update to allow automatic driver detection.
- FTDI 5V pin to STM32 board’s 5V pin
- FTDI GND pin to STM32 board’s GND pin
- FTDI RX pin to STM32 board’s PA9 pin
- FTDI TX pin to STM32 board’s PA10 pin
- Connect the FTDI chip’s USB to your PC
- Download the SBUSJoystick firmware for the STM32 board here: https://github.com/DarrenLouw/SBUS/releases/
- To flash the firmware on the board, you need to install this STM32 Flashloader: https://www.st.com/en/development-tools/flasher-stm32.html
You will also need to register a free account on ST.COM, before you can download the Flashloader.
Flashing the Firmware
Wire the FTDI chip to the STM32F1 board, and change the Boot0 jumper to high.
Connect your FTDI chip to the PC, then run STM32 FlashLoader Demo program.
Press the Reset button on the STM32F1 board.
In the FlashLoader program, select your FTDI’s COM port (in my case it’s COM9) & hit next.
It should say “Target is readable”. If you get an error, double check that Boot0 jumper is set to high, power your board off & on, then hit the reset button and try again.
Choose STM32F1_Med-density_128K in the Target option, and hit Next.
Select the option “Download to device” and browse for the SBUSJoystick.bin file you downloaded earlier.
If you can’t find it, make sure you have set the file extension to *.bin.
Now, hit Next and wait for it to flash.
Finally, Move the board’s Boot0 jumper back to the low position, then disconnect the FTDI chip and ensure that the board is powered off (no LEDs are on).
If you forget to do this step, the program will automatically erase itself when the board loses power and you will need to re-upload the program from scratch.
The original SBUS signal from Frsky receiver is “inverted”, but the STM32F1 board does not have built-in signal inverters, and so you will need to un-invert your SBUS signal using one of the following methods:
Method 1 (Recommended): Bypassing the receiver’s built in SBUS inverter (No inverter circuit needed)
See this guide for detail: https://oscarliang.com/uninverted-sbus-smart-port-frsky-receivers/
This is recommended because you don’t need extra hardware and soldering, probably looks cleaner too.
Method 2: Make a serial inverter circuit
Use a general purpose NPN transistor + 2 resistors in the following circuit configuration.
I soldered this circuit onto some vero board, added female pin headers to mount the STM32F1 board and added additional pin headers for pins: 5v, GND, PA9, PA10 (Programming pins in case I need to re-flash/update firmware in future).
- Transistors: http://bit.ly/2W9PIjj
- Resistors: http://bit.ly/2RaiZqm
- Proto Board: http://bit.ly/2HtTQau
- Female Pin Headers: http://bit.ly/2MrNFm9
- Male Pin Headers: http://bit.ly/2R5W27H
To hook your receiver up to the STM32F1 board, connect:
- Receiver 5V to STM32F1 5V pin
- Receiver GND to STM32F1 GND pin
- “Uninverted” SBUS output to STM32F1’s PB11
Configure Radio Transmitter
In the radio, ensure that CH1-6 output a signal value of around 1000-2000.
The output channel order should be this:
- CH1: Throttle
- CH2: Roll
- CH3: Pitch
- CH4: Yaw
- CH5: AUX1 ( greater than 1800 will toggle virtual button 1 on)
- CH6: AUX2 ( greater than 1800 will toggle virtual button 2 on)
Check If It Works
Windows users can check the stick outputs here:
- Start => Search “Set up USB Game Controllers”
- You should see a list of controllers, open the one called: “Maple”
- In the new window, go to the “Test” tab, and wiggle the sticks on the radio, flip the switches, and it should show the stick inputs if it’s working.
Now you can configure your radio in your preferred FPV simulators :)
How to I do an USB to SBUS decoder?
My computer detects an unknown device, do I have to install the driver for this stm32f103? what driver should i install. provide a reference link to download the driver. ? thanks for the answer
So, I am compile and flashing the firmware from your above code sharing(12 channels) but the USB HID can’t working fine. After write the .bin on my STM32, and plug on my laptop, appear an error as “unknown device” but if I to use your orinal .BIN file(6 channel from your git hub) this working fine. Do you have an idea why ?
I built this with an XM receiver, it wors fine, but i cannot use more than 6 channels. Where can be the issue? As I saw, the STM32 board’s source code contains all the 16 channels.
Have you tried this with crossfire ? I decided to and it all powers up correctly, binds and connects to the pc after flashing but I get no stick movements .
Buenas noches. mi nombre es Francisco y aunque se salga un poco del tema, se prodría modificar un modulo SBUS a PWM comercial tipo S2PW para reasignar los canales, me explico, para que en la salida PWM1 obtener el canal 13. muchas gracias y buen proyecto
thanks for the tutorial!
One comment: The blue-pill can be flashed directly from Arduino as well. No need to fiddle with the ST tool.
The board can be added via the following repository to be added in the Arduino environment’s preferences:dan.drown.org/stm32duino/package_STM32duino_index.json
Also I have extended the script to include more channels. I believe the library providing the Joystick functionality has to be extended to provide more sliders.
—- ino script —
* This example is for the STM32F103C8 board.
* Boards manager url: dan.drown.org/stm32duino/package_STM32duino_index.json
* Forked from: Zendes/SBUS By: DarrenLouw
Joystick.Y(map(sbus._channels, 172, 1811, 1023, 0)); //Stick mapping for TAER
Joystick.X(map(sbus._channels, 172, 1811, 0, 1023)); //Stick mapping for TAER
Joystick.Xrotate(map(sbus._channels, 172, 1811, 0, 1023)); //Stick mapping for TAER
Joystick.Yrotate(map(sbus._channels, 172, 1811, 0, 1023)); //Stick mapping for TAER
Joystick.sliderLeft(map(sbus._channels, 172, 1811, 1023, 0)); //additional slider
Joystick.sliderRight(map(sbus._channels, 172, 1811, 1023, 0)); //additional slider
Joystick.button(1,sbus._channels > 1000); //1000 will switch in 3rd positin of 3 pos switch
Joystick.button(2,sbus._channels > 1000); //1000 will switch in 3rd positin of 3 pos switch
Joystick.button(3,sbus._channels > 500); //500 will already switch in middle position, also suitable for 2 position switches or push buttons like on the x-lite
Joystick.button(4,sbus._channels > 500); //500 will already switch in middle position, also suitable for 2 position switches or push buttons like on the x-lite
Joystick.button(5,sbus._channels > 1000); //1000 will switch in 3rd positin of 3 pos switch
Joystick.button(6,sbus._channels > 1000); //1000 will switch in 3rd positin of 3 pos switch
// Additional buttons can be added continuing the pattern above, though I haven’t tested beyond 12 channesl for my X-lite
For this to compile, the script as well as SBUS.h and SBUS.cpp from the source package need to be in the same directory.
The source code and latest version can be found here:
Thanks for sharing this interesting article.
Since I prefer using free software, like Ched999uk, it would be great, if the article contained a description about who is providing this binary and maybe if the source is available.
This could also help the couple of users not running Windows to adapt the firmware to macOS or Linux.
Thanks in advance.
I am the developer of this firmware version.
The firmware & code is 100% free and available at: github.com/DarrenLouw/SBUS/releases/
It’s based on the Arduino platform. This repo is a fork of Zendes’s SBUS code.
My apologies for making the code available this late, I’ve been busy.
Hope this helps :)
no apology required and thanks for sharing the code.
Big thumps up and keep doing great stuff.
There is a much easier way to do this for FRsky and FlySky rx. Basically just connect the rx to an FTDI set to 5V for power and the rx signal pin to the rx pin on FTDI. then use a piece of free software called VJoy!
and the plugin
Then run the software and set to SBus or iBus and add axis and buttons as necessary, calibrate and away you go.
You just run the VJoy software then start your sim.
So no soldering to do and no extra STM32F1 Development Board or resistors and soldering…
I was wondering if you have a tutorial video or maybe a diagram drawn out on how to do it the way you explained? Is there a certain FTDI that I need? I searched FTDI and it looks like it comes in a verity of flavors! Just to point it out I’m fairly new to playing with electronics but I’m extremely interested and want to learn. Either way thanks