Skip to content

moschotto/OpenTX_EdgeTX_Bluetooth_GamePad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

EdgeTX/OpenTX Bluetooth BLE Gamepad v1.0

Copyright (C) by mosch
License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
GITHUB: https://github.com/moschotto?tab=repositories

Alt text Alt text

EdgeTX/OpenTX bluetooth GamePad module based on ESP32 that decodes SBUS frames... Some quick testing on PC only. Connection to MACs works as well but not tested in-game

Basically you can use any ESP32 and any radio that outputs SBUS and support the mentioned libraries down below.

The code is very simple because the used libraries are easy to use and there is not much to do. I encountered some problems with the SBUS library but added a workaround (see comments in the code if you are intereseted)

Note: I did not test any latency or input lags because everything depends on the BLE game pad / nimble libraries!

Wiring:

Alt text

  • The LED is optional
  • According to the getting started guide click here, i added a schottky diode to the 5V input of the ESP32. In case that the module is powered by the radio and you plug in USB-c in parallel, the voltage/current can't flow back to the external voltage regulator
  • The SBUS input (RX input / yellow) can be any GPIO pin. Adjust the code aacordingly -> "define RX_PIN 20"

Install / uploading the code:

Arduino IDE:

Add the latest boards if you don't already have it. If you are using an ESP32C3, be aware that you need to put it into "bootloader" mode!

  • hold the BOOT BUTTON, connect the board to your PC while holding the BOOT button, and then release it to enter bootloader mode
  • The device should appear in the device manager as "USB JTAG/serial debug unit (Interface 0) (COM3)"
  • Driver libwdi / USB\VID_303A&PID_1001

After that you should be able to upload the code.

Platform.io

If you have the right settings in platform.io, you don't need to put the ESP32C3 into bootloader mode manually.

Espressif32 version 5.1.1 works for me.

adjust the "uploads section" in the boards file for the ESP32C3 accordingly (usb_reset):

C:\Users\<usernmae>\.platformio\platforms\espressif32\boards\seeed_xiao_esp32c3.json
  
  "upload": {
    "flash_size": "4MB",
    "maximum_ram_size": 327680,
    "maximum_size": 4194304,
    "require_upload_port": true,
    "speed": 460800,
	"before_reset": "usb_reset",
	"after_reset": "hard_reset"
plattformio.ini

[env:seeed_xiao_esp32c3]
platform = espressif32
board = seeed_xiao_esp32c3
framework = arduino
upload_protocol = esptool
upload_speed = 921600
lib_extra_dirs = C:\Arduino\libraries
upload_port = COM14
build_flags =
                ;-DCORE_DEBUG_LEVEL=5
                -DARDUINO_USB_CDC_ON_BOOT=1
                -DARDUINO_USB_MODE=1

Radio setup:

Input setup (Radiomaster Zorrow). Feel free to try out other radios as well

Alt text Alt text Alt text

Demo

IMAGE ALT TEXT HERE

Libraries:

Check out and download/install these libraries (thanks to the contributors)

|-- Bolder Flight Systems SBUS @ 7.0.0
|-- ESP32-BLE-Gamepad @ 0.5.0
|   |-- NimBLE-Arduino @ 1.4.0
|-- FastLED @ 3.5.0
|   |-- EspSoftwareSerial @ 6.13.2
|   |-- SPI @ 2.0.0

https://www.arduino.cc/reference/en/libraries/bolder-flight-systems-sbus/

https://github.com/lemmingDev/ESP32-BLE-Gamepad

https://github.com/h2zero/NimBLE-Arduino

https://github.com/FastLED/FastLED

Parts used:

  • 1 x Seeed Studio XIAO ESP32C3
  • 1 x Ams1117 5.0V voltage regulator
  • 1 x 8 pin 2.54mm female pin headers
  • 1 x schottky-diode or signal-diode, power-diode

Printable case / housing:

i.e. for RADIOMASTER Zorrow
https://www.thingiverse.com/thing:5515977

Limitation:

it seems that the ESP32C3 is only able to "bond/pair" to ONE device and store the connection settings for this single device. If you connect to let's say a PC and later on you connect to another device, then the ESP32 gets stuck in during the bluetooth init phase. this seems to be an issue related to the NIMBLE bluetooth stack. this means you need to unpair/delete/forget the device BEFORE you connect it to another device.

how to recover:

if the device get stuck and doesn't boot, you need to "erase the flash" and reflash it via arduino or platform.io again:

erase flash:
python.exe esptool.py --chip esp32c3 --port COM14 --before usb_reset --after hard_reset erase_flash

to avoid reflashing, you can limit the maximum allowed bonds to 1 


=> NimBLE-Arduino\src\nimconfig.h
CONFIG_BT_NIMBLE_MAX_BONDS 1

Hits

About

BLE GamePad module based on ESP32

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages