Flight simulator controls Micropython

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
tonynsx
Posts: 43
Joined: Thu May 07, 2020 1:43 pm

Flight simulator controls Micropython

Post by tonynsx » Sun Aug 07, 2022 11:58 pm

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

tonynsx
Posts: 43
Joined: Thu May 07, 2020 1:43 pm

Re: Flight simulator controls Micropython

Post by tonynsx » Mon Aug 08, 2022 12:03 am

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.

tonynsx
Posts: 43
Joined: Thu May 07, 2020 1:43 pm

Re: Flight simulator controls Micropython

Post by tonynsx » Mon Aug 08, 2022 12:29 am

It looks like Arduino have a joystick library, for exactly this purpose, but what about Python / MicroPython?
https://github.com/MHeironimus/ArduinoJoystickLibrary

tonynsx
Posts: 43
Joined: Thu May 07, 2020 1:43 pm

Re: Flight simulator controls Micropython

Post by tonynsx » Mon Aug 08, 2022 11:59 am

Any help will be appreciated

Lobo-T
Posts: 36
Joined: Tue Nov 16, 2021 2:36 pm

Re: Flight simulator controls Micropython

Post by Lobo-T » Mon Aug 08, 2022 12:48 pm

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

User avatar
scruss
Posts: 360
Joined: Sat Aug 12, 2017 2:27 pm
Location: Toronto, Canada
Contact:

Re: Flight simulator controls Micropython

Post by scruss » Mon Aug 08, 2022 1:29 pm

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.

tonynsx
Posts: 43
Joined: Thu May 07, 2020 1:43 pm

Re: Flight simulator controls Micropython

Post by tonynsx » 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.

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

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Flight simulator controls Micropython

Post by jimmo » Thu Aug 11, 2022 1:31 am

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).

pidou46
Posts: 101
Joined: Sat May 28, 2016 7:01 pm

Re: Flight simulator controls Micropython

Post by pidou46 » Mon Aug 15, 2022 7:11 pm

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.
nodemcu V2 (amica)
micropython firmware Daily build 05/31/2016

Post Reply