4 ms·
Show HN: I wrote a small lib to turn a USB gamepad into a Bluetooth one
I had two old USB gamepads lying around that I wanted to use, but my computer is too far from the couch, so I wrote a little ESP32-S3 firmware that turns USB gamepads into Bluetooth ones.
You connect your gamepad to the ESP32-S3 with an OTG cable, power the ESP32 with either 5V somehow or a powered USB hub, and now you can pair the controller via Bluetooth to your PC!
- atmanactive 11mo ago... and the latency is?
- stavros 11mo agoI didn't notice any higher latency than with my Xbox one controller!
- atmanactive 11mo agoI guess the easiest way to measure this would be to run some gamepad test program on the target device, and then to record a video from your phone close to the gamepad but still with the screen visible. Then flick a button hard with your finger so that the gamepad button makes a click sound. Then load the video into a video editing software, zoom-in, and measure the number of video frames between the click sound and the reaction on the screen.
- stavros 11mo agoI agree this is the way to do it, but for an old cheapo gamepad, "it feels fine" was good enough for me at this stage.
- schappim 11mo agoThis is a clever and practical hack! Love the decoupled arch / making it easy to tweak for different controllers. Nice work!
- stavros 11mo agoThanks! I liked how the hardware is really easy to make, I just soldered a USB port to an ESP32-S3 and that was it!
- p2detar 11mo agoAwesome project. With the current price of DRAM, I've been looking at the possibility to do some side projects with ESP32 as opposed to RPi. As a complete newbie, could you help me by recommending where I could start from, i.e., Software, tools, docs? Thanks.
- stavros 11mo agoI use the Arduino framework and PlatformIO to make the flashing/dependency management part easier. Other than that, the Arduino docs are great, and LLMs can help you with learning anything specific, so it's really a great time to get started!
- Tade0 11mo agoI like how readable the code is. I don't write anything in C++ nowadays, but it's clear enough for me to follow.
- stavros 11mo agoAh, I can't really take credit for that, it was mostly multiple LLMs.
- latexr 11mo agoSo did you really write this, as claimed in the title, or did you vibe code it? If the latter, how much of the code did you review? How much of it do you understand and could rewrite by hand if necessary? How much of it are you confident you can find and fix bugs and exploits in?
- stavros 11mo agohttps://www.youtube.com/watch?v=D5Df191WJ3o https://www.youtube.com/watch?v=D5Df191WJ3o
- lobsterthief 11mo agoI mean, these are fair questions if you’re the library maintainer :)
- stavros 11mo agoBefore LLMs, did you ask maintainers how much of the code they wrote themselves, vs how much of it did someone else write, and how well they reviewed the code? Because I haven't seen this ever, everyone just went by "does this library work for me? If not, I'll fix it or stop using it". It's only now, with LLMs, and particularly on HN that we're so all up in arms about authorship all of a sudden.
- 11mo ago
- gkhartman 11mo agoI had a quick thought to do something like this a while back, but never got around to the experimental phase. I ended up buying a new controller instead (whilst grumbling about making an adapter). Thanks for making it happen, and being kind enough to open source it. Looking forward to giving it a try later.
- stavros 11mo agoYeah, I was between buying a new controller or making this too, but I figure it's a perfectly fine controller and I had the hardware lying around. It doesn't work perfectly, as there are some HID intricacies that need to be remapped, and I don't have a second controller to see whether the intricacies are general or just specific to mine, but let me know if it works for you!