Page 1 of 1

Flight simulator controls Micropython

Posted: Sun Aug 07, 2022 11:58 pm
by tonynsx
I have a 3D printer, so now I can print my own flight simulator yoke, throttles etc. But I'm having no luck finding any tutorials doing this with Micropython, ESP32 or Raspberry Pi.

There are lots of online videos and tutorials with Arduino, like this below.
https://www.youtube.com/watch?v=nO-lanE ... aelRechtin

This is the closest I've seen using a Raspberry pi, but this is just using keyboard shortcuts (around 16 minute mark)
https://www.youtube.com/watch?v=8gUytbt ... 7sHardware

Re: Flight simulator controls Micropython

Posted: Mon Aug 08, 2022 12:03 am
by tonynsx
Or even in Python, is this possible? So I want to be able to 3D print a throttle, then I assume put potentiometer, and connect it to Raspberry Pi or ESP32 to fly.

Re: Flight simulator controls Micropython

Posted: Mon Aug 08, 2022 12:29 am
by tonynsx
It looks like Arduino have a joystick library, for exactly this purpose, but what about Python / MicroPython?
https://github.com/MHeironimus/ArduinoJoystickLibrary

Re: Flight simulator controls Micropython

Posted: Mon Aug 08, 2022 11:59 am
by tonynsx
Any help will be appreciated

Re: Flight simulator controls Micropython

Posted: Mon Aug 08, 2022 12:48 pm
by Lobo-T
Micropython doesn't really have that great USB support at the moment.
Circuitpython (https://circuitpython.org/) does have a HID library that supports gamepads: https://docs.circuitpython.org/projects ... ad-gamepad

Re: Flight simulator controls Micropython

Posted: Mon Aug 08, 2022 1:29 pm
by scruss
The CircuitPython team have put more emphasis on USB HID control access than the MicroPython developers. The reason there are more Arduino tutorials is that the Arduino has been around for decades longer, and search engines prioritize old stuff. There are also the Arduino Leonardo and Micro boards which make HID work quite simple (if inflexible).

What boards were you planning to use? I don't think traditional ESP32 boards can work as HID input, as they have a USB-Serial chip that prevents them behaving like a USB input device. CircuitPython on a Raspberry Pi Pico should be able to work as a USB input device.

I've previously used small Adafruit CircuitPython boards for HID input, and they were quite reliable for custom assistive input devices for people with disabilities.

Re: Flight simulator controls Micropython

Posted: Mon Aug 08, 2022 1:45 pm
by tonynsx
Yes, I'm using a traditional ESP32, looks like this is what I need. Or may be learn Arduino.

https://www.hackster.io/news/darkfullda ... 056125070c

Re: Flight simulator controls Micropython

Posted: Thu Aug 11, 2022 1:31 am
by jimmo
tonynsx wrote:
Mon Aug 08, 2022 1:45 pm
Yes, I'm using a traditional ESP32, looks like this is what I need. Or may be learn Arduino.
The ESP32 doesn't have USB support at all. The USB interface on most ESP32 boards is provided by an external chip that just does USB UART.

To make this work with ESP32 you'd need something running on your PC that receives commands via serial, and then injects them into your flight sim (either by simulating an input device/gamepad or keyboard).

Re: Flight simulator controls Micropython

Posted: Mon Aug 15, 2022 7:11 pm
by pidou46
I try to achieve pretty much the same think (steering wheel) with my son, the way have taken is via bleutooth because esp32 have a pretty good bluetooth support.

Heerkog have a working example of a basic joystick:

https://github.com/Heerkog/MicroPythonBLEHID

The next step is to build / find a HID descriptor that make it recognize as a steering wheel. This step is not as straightforward as I firstly thought !

If you like to follow this route I can share some links about HID descriptors.