Not All Projects Work Out
from to on 12 Mar 2024 15:14

This was my attempt to create a a SNES to Bluetooth adapter. It works but the average latency was 18.35ms, which I think is too much to be considered a good controller.


threaded - newest on 12 Mar 2024 15:55 next collapse

The project equivalent of your mum sticking your drawings to the fridge 😊

Hey, you tried, most wouldn’t bother. You’re the top 1% of humans in that way on 12 Mar 2024 16:17 next collapse

18.53ms is imperceptible to humans. on 12 Mar 2024 16:33 next collapse

I think the concern is the stack up you get in latency between the controller, the computer, and the monitor. on 12 Mar 2024 18:19 collapse

That’s a valid concern that I didn’t consider. on 12 Mar 2024 17:10 collapse

I can absolutely notice a frame of lag at 60Hz. Good way to compare side-by-side is by using an emulator with run-ahead mode. on 12 Mar 2024 18:22 collapse

I read that people who play a lot of FPV shooters have higher than average reaction and perception time. 18ms is ridiculously fast though, I’d be surprised if someone could consciously register it. I know gaming monitors market latency in the 1.5ms range, so maybe elite gamers can perceive the difference. Someone else pointed out that there are concerns over latency stacking between all of the devices, and that’s a really valid point. on 12 Mar 2024 18:35 next collapse

18ms is okay but for a lot of retro content, it’s running 60fps. That means it’s one frame is 50/3ms, aka 16.6666ms. Sub 1 frame is good enough, 18ms is not in my opinion. on 12 Mar 2024 19:11 collapse

I don’t play shooters, but I love both 2D and 3D platformers, where you can absolutely notice a difference. on 12 Mar 2024 16:43 next collapse

If anyone else was wondering, I found this neat data table of controller latencies to compare:

It looks like 18.35ms is not really among the best, but there are still lots of products in that range.

I dunno if I’d say your project didn’t work out… Maybe more like you succeeded but still have work to do. Do you think you’ll try swapping the Bluetooth for a 2.4Ghz module or something and see if that performs better? on 12 Mar 2024 17:11 next collapse

It definitely could but the idea was to use only an esp32 rather than incorporating additional hardware. on 12 Mar 2024 18:35 collapse

Yeah, I get that. Do you have any sense of whether that’s a limitation of the ESP32, or with your implementation? on 12 Mar 2024 18:38 collapse

It’s really hard to judge without additional testing, I’m always more likely to blame my code than hardware. My guess would be something in the stack, be it my code or the library that puts it above a frame but that kind of investigation is more than I want a hobby project to be. on 13 Mar 2024 02:29 collapse

I think the esp32 maximum throughput is 700 kbps, so you might be able to get a better performance.

I don’t have much experience with the esp32, but the first thing I would do is just a spoof program that sends simulated inputs, and see how’s the latency without any other functionalities.

That will give you a good idea if the problem is your code or the stack (its not infaillible though). on 13 Mar 2024 02:44 collapse

Yeah one approach is that BLE-Gamepad library supports gpio pins as button inputs, so in theory I could get a baseline of what the Bluetooth stack of the library is by soldering the jst connector to connect the Arduino (that triggers the button presses and measures the result from the Mister SNAC port).

Otherwise I’d basically have to develop my own controller code to port onto various Bluetooth stacks for testing, but that seems like more than I want to do right now. on 12 Mar 2024 17:28 collapse

I use an 8bitdo sn30 pro. Apparently I haven’t been using a good controller. Fooled me! on 12 Mar 2024 17:50 next collapse

I wouldn’t call that controller bad, just not optimal. For this, I would want to have it be under 10ms to publish the code and instructions. on 12 Mar 2024 17:49 next collapse

I’ve had a lot of connection issues with that model on 12 Mar 2024 19:24 collapse

How so? It disconnects? Or won’t connect to start? on 12 Mar 2024 19:35 collapse

Both, and I was literally right next to my phone on 12 Mar 2024 19:56 collapse

What phone do you have? on 12 Mar 2024 20:24 collapse

Samsung A53 on 12 Mar 2024 21:00 collapse

Hmm I was thinking maybe an old phone but that’s not that old.

Try charging while connecting. I’ve found that a low battery often seems like poor connection quality. The way it gives up when it can’t connect is very similar to just the battery dying. on 12 Mar 2024 23:48 collapse

I have two of em-- They’re pretty good! Definitely not perceptibly laggy or anything, at least to me.

Probably just outed myself as a casual. on 13 Mar 2024 00:49 collapse

Casuals unite! Fuck it I’m just trying to have fun lol! on 12 Mar 2024 17:33 next collapse

How much are you doing with “rolling your own” vs using off the shelf solutions? For example if you are deep into rolling your own which Bluetooth profile are you using? on 12 Mar 2024 17:38 collapse

So in this case it’s my own code to read the state of the controller and using the ble-gamepad library, which uses NimBLE under the hood. There could be some optimizations but getting to be under 10ms probably is going to use a lot of time I could just be playing games. on 12 Mar 2024 17:56 collapse

So you suspect the latency (enough of it anyway) is introduced in your translation code? I absolutely understand not wanting to go to the nth degree for optimization when this is a hobby project. Could you throw hardware at it? Not all ESP32 run at the same speed. Perhaps buy an oversized one that will execute your underperforming code faster? on 12 Mar 2024 18:05 collapse

There probably could be some optimization in the translation, such as passing the controller object as a reference when checking the state of the buttons, rather than doing two loops to read the state and act on it. But I doubt that is the source of the largest latency since this is compiled to run at 240mhz (I did some additional testing at 80 as well, about the same results). I’m using a d1 mini off alliexpress so not the highest quality but I wouldn’t expect a huge performance hit. on 12 Mar 2024 18:28 collapse

Where do you think the (the majority of the) latency is being introduced? on 12 Mar 2024 18:52 collapse

Without more testing it’s hard to say. I don’t want say it’s the hardware without proof, but would require a much deeper dive into esp32 and c++ than I want to do right now. on 12 Mar 2024 23:09 next collapse

Whether it works or not, this looks incredibly fun! That's a win in my book. on 12 Mar 2024 23:54 collapse

I have been contemplating making my own HOTAS since every time I have the cash to buy one, I either can’t find one or it gets cancelled midway through shipping and I get an automatic refund. I’m not sure where to start with that though…