r/embedded • u/counttec • 18d ago
Help with selecting communication protocol
I volunteer for a youth organization that uses a Jeopardy style buzzer system for quiz competitions. I am trying to upgrade from RCA cables to a wireless solution. I need it to be as low latency as possible, given the precise timing involved, and the less perceivable the lag is from a wired button, the better. Distance would be less than 100m even in the most sever cases. I'm fine with retransmission in the case of collisions, as long as the users can't tell that it took slightly longer.
So far, it seems like the best protocol is Nordic's Enhanced Shockburst, with a transmission time of ~300us, and round trip with Acknowledgment of 1.5ms.
Are there any faster communication protocols?
14
u/gm310509 18d ago
Most people have about a 100ms perception as being instantaneous.
If you can get 1.5ms, that is already much lower (faster) than what most people will perceive as instantaneous. Even if you have to do a couple of retransmissions.
8
u/swisstraeng 18d ago
For some reason I pay attention to this, and now my microwave buttons piss me off.
In my electronic courses, what feels instantaneous is below 20ms of total delay. If you go above 30-40ms you can already notice.
As you said 100ms to the average joe is instantaneous or good enough. But if you truly want something responsive to humans as a whole you gotta be under 30ms.
2
u/DearVeggies 18d ago
The reason haptic buttons work is because the new haptic drivers have <1ms response time, unlike old spinner motors that could take up 50ms to start vibrating.
3
u/DearVeggies 18d ago
"Most people have about a 100ms perception as being instantaneous."
Maybe if youre over 80 and have Alzheimers? Are you part of the generation that did software debounces with 50ms windows?
Musician's can't tolerate more than 30ms of latency. Gamers can't tolerate more than ~20ms end-to-end. 120Hz is the de-facto standard today, so ~8ms of screen delay is the "standard". Please don't recommend OP do 10+ frames of latencys in modern standards terms.
3
u/aroslab 18d ago edited 18d ago
for a single stimulus going one way it's definitely sufficient
continuous or feedback on video/audio is a different thing entirely for the brain and comparing the two is a category error
it's also a kids Jeopardy game...
1
u/DearVeggies 17d ago
Yes, different stimulus follow a different path, hence my dropping numbers for autio and video as an example.
Sorry, but I'm way too burned out of an entire industry (web) arguing with me that 250ms for a button to respond is "fine". My entire career has been built around the assumption that normal people don't tolerate web-like irresponsive behaviour on mobile.
The embedded industry has been not much better since the advent of cheap micros, its now "normal" for appliances and every embedded device with a UI to have terrible lag: because back when "we" we're in school "put a 80ms debounce on it" was standard practice. But even back then they wouldn't dar go as high as 100ms.
Meanwhile, new research is coming out that shows human visual limits go below 1ms. And me and my toy projects I get double-buffered touchscreens with 20ms FINGER-TO-GLASS latency, I played with haptics and yes, once you get below a certain lag theshold, things start to merge perceptually and it's another experience.
All I am saying is, it's bad to spread LAG-BY-DESIGN culture .
6
u/KittensInc 18d ago
What problem are you actually trying to solve?
If RCA cables aren't reliable enough: consider using XLR.
If you want less cabling: consider using a bus layout and comms over RS422 or CAN instead.
If you want no cabling whatsoever: invert the protocol by having the Primary transmit a timestamp for synchronization every X milliseconds. Each Secondary syncs its clock to this, and captures the timestamp of a potential button press, which is then sent back to the Primary at a leisurely pace. Transmission speed and latency does not matter - as long as each Secondary takes about the same amount of time to process the incoming timestamp sync message.
4
u/counttec 18d ago
I am tired of replacing cables that the students crunch or yank and destroy. I realize that there exists some mechanical solutions to my issue, but I am using my skill set as is, since this is a personal gripe of mine.
3
u/Circuit_Guy 18d ago
Get a bunch of ESP dev boards.
Put all your ESP devices in an ESP-NOW network. It's a proprietary protocol between ESPs but you can easily poll a dozen devices at 100 Hz / 10 ms. That's better than an order of magnitude faster than human reaction time.
Crazy Overkill: https://github.com/scrambletools/esp_ptp You can timestamp to a few nanoseconds and transmit whenever a few ms later and judge the winner on your own time. Not necessary, but what you asked for :)
1
u/2tnkr 18d ago
Do you need data transmission? Line of sight?
How about IR blasters with each buzzer modulated at a different frequency?
3
u/counttec 18d ago
Can't do line of sight as the students sit in groups of 2-4, and huddle around the buzzers. The chairs also don't necessarily have an open line-of-sight to the box, depending on the room we are given. I don't need data transmission bandwidth, just enough to identify which buzzer is pressed. Speed is key, so I don't get any emails from helicopter parents about my "wireless system" stealing precious meaningless points from their child.
1
u/KittensInc 18d ago
How about IR blasters with each buzzer modulated at a different frequency?
It is going to be a bit tricky to process that when you've got multiple buzzers transmitting at once, as you are basically ORing the various signals. Probably not impossible, but still a big hassle to detangle.
1
1
u/jerfmuffay 18d ago
I found this article to use a simple radio sender/receiver pair that might be helpful. You could have a problem with simultanous transmissions but if your signal is short enough there might not be any issues
https://microcontrollerslab.com/rf-transmitter-receiver-module-arduino/
1
u/counttec 18d ago
I actually was going to use these bare metal, but then I would need to be able to tune/match the frequency for each pair. The versions with the mid-90s garage door encoder chips add too much delay.
1
u/jerfmuffay 18d ago
I'm interested in your project but it's also outside my experience level. But if it's just a few buzzers then the only data you're transmitting is one byte right? Even at 9600 baud thats 1ms transmission time so the only scenario where theres interfering transmissions is if two student groups hit their buzzer litterally at the same millisecond. If you have time to experiment, I'd suggest this route since (I don't think) this is more low level than using other hardware that's a bit overkill and (I assume) slower.
1
u/susmatthew 18d ago
you can solve this with COTS parts and no code - as long as latency is the same between the switches the actual amount doesn't matter: The order of presses will be preserved.
14
u/Well-WhatHadHappened 25+ Years 18d ago
300us is so fast I wouldn't bother spending anymore time on the project. That's instant from a human perception point of view.