Page 1 of 1
BLE Joystick on ESP32
Posted: Wed Nov 06, 2019 6:05 pm
by francescofact
Hi everyone,
i am trying to connect a BLE joystick to my ESP32 with micropython. But i cannot find documentation for accepting connection from bluetooth device and get the commands from the joystick.
I understood that i have to start with:
Code: Select all
bt = bluetooth.BLE()
bt.activate(1)
but i cannot understand how to go on. Thank you for your help.
Francesco
Re: BLE Joystick on ESP32
Posted: Mon Nov 11, 2019 12:08 pm
by jimmo
Hi,
I have a proof-of-concept of a HID keyboard for BLE, which I'm working on adding to
https://github.com/micropython/micropyt ... /bluetooth
It's not nearly as simple as the other peripheral examples, but most of it is just configuration, and you end up with a "send_key" method.
It should be possible to adapt the HID keyboard demo into a HID joystick (or mouse). I'll try and remember to update this thread when I finish the keyboard example.
Re: BLE Joystick on ESP32
Posted: Mon Aug 03, 2020 8:00 pm
by nikolaj
@jimmo Did you ever post that proof of concept HID keyboard? I scanned the forums and your github fork and haven't found it.
Thanks!
Re: BLE Joystick on ESP32
Posted: Thu Jan 21, 2021 5:26 pm
by nekomatic
According to
this post there's a pull request, basically meaning Jimmo's change is submitted and waiting to be integrated into the code base.
Re: BLE Joystick on ESP32
Posted: Mon Jan 25, 2021 12:23 am
by jimmo
Re: BLE Joystick on ESP32
Posted: Wed Feb 03, 2021 1:13 pm
by mibra
You can check my "mouth" mouse if you need a practical example.
https://github.com/mibragri/mouthMouse
BLE py file:
https://github.com/mibragri/mouthMouse/ ... KBMouse.py
joystick py file:
https://github.com/mibragri/mouthMouse/ ... oystick.py
You may need to strip some code. The joystick class includes a water flow sensor for registering puffing as clicks.
Regards
Michael
Re: BLE Joystick on ESP32
Posted: Mon Mar 15, 2021 5:50 pm
by Heerkog
I'm using the examples above to code a HID library, but somehow my Windows box isn't receiving or registering my input reports.
My code is here:
https://github.com/Heerkog/MicroPythonBLEHID
Does anyone know what I'm doing wrong?
Re: BLE Joystick on ESP32
Posted: Mon Mar 22, 2021 9:40 am
by Heerkog
Solved.
The issue is that the mouse example I used includes a HID report descriptor that is missing report id 1.
Without that report id, the HID report reference characteristic's id is pointing to a non-existing report.
In addition, any HID service requires the registration of
- a Device Information service with minimally the PnP id characteristic, and
- a Battery service with the Battery level characteristic.
Although Linux and Android skip over the errors raised by the missing information, Windows does not.
I'll push code later.
Re: BLE Joystick on ESP32
Posted: Tue Mar 23, 2021 3:39 pm
by Jeroavf
Hi Heerkog,
Can you please update your repository ?
Thanks in advance
Re: BLE Joystick on ESP32
Posted: Wed Mar 24, 2021 5:08 pm
by Heerkog
Pushed! Sorry for the wait!