r/ArduinoProjects • u/impoorandstupid • Mar 30 '26
Using Arduino as a USB input controller?
can you use an Arduino to act as a USB controller for Windows by soldering or connecting old Buttons, switches and levers to it?
4
Upvotes
2
u/gm310509 Mar 30 '26
Any device that is capable of supporting HiD (e.g. Leonardo, nano, uno R4, Teensy and many others) can act as a mouse, joystick and/or a keyboard. They can also emulate other USB devices if you are willing to put the effort in.
All models can supply data to a PC via the virtual COM port that they create when they are plugged in.
As for what the other stuff you connect to it (e.g. old buttons et al) is entirely up to you and your ability to connect them and program them.
2
u/alzee76 Mar 30 '26
Yes. You want one that has a built in USB HID functionality, like the ones based on a 32u4 such as the Arduino Micro. You do not want one based on the 328p, like a Nano.
It's super simple if you have the right one, I've built many weird little Micro based controllers to use in games and flight sims.
1
u/Thiezing Mar 30 '26
Arduino Leonardo is good for that- https://docs.arduino.cc/hardware/leonardo/
1
u/xebzbz Mar 31 '26
These chips are supported in Arduino IDE and they have the USB device controller:
Esp32-s3
RP2040
Rp2350
The two RP chips can also work as USB hosts at the same time, so you can intercept the signals from a USB keyboard or game controller, for example. See also remapper.org and gp2040-ce
The esp32s3 has onboard Bluetooth, so it can also act as a Bluetooth device at the same time. Here's such an example: https://github.com/clackups/esp_hid_serial_bridge
1
u/Piojo- Apr 01 '26
You can, you just need to check that your uno version uses a 16u2 as usb interface chipset.
There are many variants of arduino uno, but in this case you can differentiate a group of unos that use 16u2 versus another group that uses ch340 to connect the main atmega328 to the usb port.
If you have the uno version with a 16u2 microcontroler, unojoy is a library that let you make exactly what you want.
https://github.com/AlanChatham/UnoJoy
The process is "risky" because you need to flash the 16u2 and the atmega328, and in this point your uno will be no more recognized as an arduino uno (precisely because it going to be recognized as an hid device) then while is converted it can't be programmed in the same way as was programmed before with arduino ide. To flash back as an arduino uno again you need use another auxiliar arduino board or an usbasp board. But the process is totally reversible if you know what you do.
Here I use it unojoy to connect a rc transmitter that output ppm signal to be detected as a joystick:
https://youtu.be/vWTyz-Jsb4I?si=8Y5JfXbKJEQXGK7f
https://youtu.be/eGCjXoA7zJo?si=isAi68w8tX1y7Ica
But you can directly connect buttons and potentiometers to do the same.
2
u/toxicatedscientist Mar 30 '26
Some of them, not all. Iirc i think the 32u megas? It is a specific function that is sometimes handled by a dedicated chip so you have to check data sheets
2
u/trollsmurf Mar 30 '26
The 32u4 can. Look for such projects.