ESP32s3 dev kit, using it as a HID joystick and receive serial data.

Gazz292
Posts: 2
Joined: Sat Mar 22, 2025 12:53 am

ESP32s3 dev kit, using it as a HID joystick and receive serial data.

Postby Gazz292 » Sat Mar 22, 2025 1:30 am

I am just getting into ESP's, having only really played with arduino's before (i'll be programming the ESP's with arduino ide... i struggle with coding big time, mostly modifying other code to get it doing what i need)

I have some ESP32-S3 DevKitC-1 - N16R8 boards (cheap ones from amazon, the type that need a jumper soldering to enable USB-OTG and stuff like that https://www.amazon.co.uk/dp/B0D8FQH6Y6? )
i went for the -S3 boards as they can be used as a HID device, and the main thing i want to use them for is making HID joystick / button box's to control a train simulator.
I also want to be able to have the same board receive serial data from the simulator, mostly to turn led's on and off for warning lights on the controllers.

I keep seeing references that you can not use HID and serial at the same time, and this seems to be the case for HID and wifi*

As the s3 boards have 2 USB ports, is it possible to use the OTG port for the HID joystick connection, as well as the other serial usb port (UART?) to receive the serial data?
perhaps running the 2 sketches separately on different cores or something like that ? (i really am in over my head here as you can tell)

*I've tried running the HID joystick sketch as well as a GPIO viewer sketch together https://github.com/thelastoutpostworkshop/gpio_viewer but nothing works when i combine the 2 sketches (they work fine separately)
so i think this is the same issue with serial and HID running at once?

Sprite
Espressif staff
Espressif staff
Posts: 10617
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32s3 dev kit, using it as a HID joystick and receive serial data.

Postby Sprite » Sat Mar 22, 2025 2:18 am

HID should be able to run with serial just fine; either using a hardware UART or acting as a composite USB device that does HID as well as CDC-ACM (USB serial). Maybe what you read refers to the fact that you cannot use USB-OTG, which is required by HID, in combination with the hardware USB-serial-JTAG device. That restriction doesn't really apply to your situation, however.

Gazz292
Posts: 2
Joined: Sat Mar 22, 2025 12:53 am

Re: ESP32s3 dev kit, using it as a HID joystick and receive serial data.

Postby Gazz292 » Sat Mar 22, 2025 3:58 pm

On the joystick library's GITHub page i am trying to use, there is this warning :
Known issues
Unfortunately there is an issue with the Arduino-ESP32 core library which can cause problems if you use the HID joystick and the serial interface at the same time. Executing Serial.print or Serial.println, yes even initializing the serial console with Serial.begin() is prone to cause timing issue for the USB data transfer

Sprite
Espressif staff
Espressif staff
Posts: 10617
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32s3 dev kit, using it as a HID joystick and receive serial data.

Postby Sprite » Sun Mar 23, 2025 2:28 am

Ah, that may be a software issue in Arduino or that library specifically, I don't know about that.

chegewara
Posts: 2505
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32s3 dev kit, using it as a HID joystick and receive serial data.

Postby chegewara » Mon Mar 24, 2025 3:17 am

You could try to use my Esptinyusb library, which is working HID+CDC/serial.
I know it is working, because ive done some commercial code for flight simulator controller for one of my clients.

The library is not as good as espressif, probably, but some arduino users are using it.

cybersack
Posts: 3
Joined: Wed Apr 30, 2025 7:54 am

Re: ESP32s3 dev kit, using it as a HID joystick and receive serial data.

Postby cybersack » Wed Apr 30, 2025 9:44 am

New here guys and not yet able to post a new topic, so I will piggyback this one which seems quite related.

I need some advice/assistance in choosing the correct dev board/kit.
I am a software engineer, not a microcontroller or embedded engineer, so 'obvious' to you may not be obvious to me ... hence the post :)

I currently use ESP32-WROOM-32D dev boards for my newbie prototyping, and I have a need to integrate Android over USB, which means using OTG. All good on the 'droid side.

On the microcontroller side, I have 2 questions:

[1]
Can I connect a serial/uart adapter on the rx/tx pins so that runtime communications could flow via this OTG connection, whilst the on-board USB jack continues to provide power and is used for upload/flashing ?
If so, is there sample code for this somewhere ?

[2]
It seems there might be a more robust/simple way to achieve this as I see dev kit:
https://docs.espressif.com/projects/esp ... guide.html
which might be an out-of-box solution that would fit my needs to keep the power/upload usb port function separate from the communications function.
If this is correct, which of the USB jacks should be used for which purpose ?

Who is online

Users browsing this forum: Bing [Bot], Qwantbot and 4 guests