NEC protocol IR remote always sends a repeat - Page 1
Forum section: electronics / projects

author: Peabody
author_rank: Super Contributor
timestamp: October 23, 2023, 04:26:56 pm
content: As part of a project to duplicate some of the functions of my Cox MiniBox IR remote, I used my scope to decode the remote's output. The format turns out to be very standard NEC, but the remote always sends a repeat 40ms after the end of the main output. No matter how briefly I press the key, I always get a repeat. Has anyone here run across this before? Is it possible the repeat could even be required?I tried using a learning remote, hoping to eliminate the repeat and see if it still works, but the learning remote learns the repeat.Well, I will be able to dig out my Arduino stuff and test this, but I just wondered if there might actually be a good reason to design the system to always add a repeat.

author: wraper
author_rank: Unknown
timestamp: October 23, 2023, 04:32:30 pm
content: QuoteThe very obvious reason is that if the first packet of data is not properly received, there is a second one. And there are plenty of reasons why transmission can fail, from large distance to interference from sunlight or light bulbs.

author: Buriedcode
author_rank: Super Contributor
timestamp: October 23, 2023, 05:50:40 pm
content: Do you mean a repeat of the entire packet, or a "repeat code?" (long pulse followed by short one)

author: Peabody
author_rank: Super Contributor
timestamp: October 23, 2023, 09:18:33 pm
content: It just sends the "repeat" code, not the full instruction. So it has nothing to do with protecting against a bad transmission. It just tells the receiver that the same key is still being held down. It's a 9ms burst, then off for 2.25ms, then a 562.25us burst.

author: Kim Christensen
author_rank: Super Contributor
timestamp: October 23, 2023, 09:27:59 pm
content: Does the remote do this for every key you press, or just some of them?

author: Peabody
author_rank: Super Contributor
timestamp: October 23, 2023, 09:33:06 pm
content: I haven't checked all of the remote's keys, but checked all the number keys and about five or six more, and all the ones I checked send the repeat.Well, it may be a special protocol just for this box. But I was just having trouble figuring out how this would be at all useful. In other words, if I were designing an IR system, should I include this "feature" or not. What benefit does it provide?

author: Kim Christensen
author_rank: Super Contributor
timestamp: October 23, 2023, 09:54:34 pm
content: Reading their DOCs, it seems like if the key is pressed longer than 108ms, then you're going to get a repeat code every 108ms until you release the button.So you'd have to be pretty quick with your button push not to get a repeat code.

author: Peabody
author_rank: Super Contributor
timestamp: October 24, 2023, 02:34:19 am
content: Well that's a tenth of a second. I made a special effort to tap the keys as briefly as possible, and I don't think they were depressed that long. But maybe you're right. Maybe all remotes do this. I just don't remember seeing it in other remotes I've decoded.

author: DavidAlfa
author_rank: Super Contributor
timestamp: October 24, 2023, 03:41:29 am
content: I've used Apple remotes, which have NEC protocol.Yeah, you'll get a repeat code unless you press the button very shortly.What I do is setting a timeout of ~150ms after something was received. Anything resets this timeout.After a command, I also count the repeats.Wether the timeout expired or not, when the repeat count is higher than 3, I issue a long press action.When the timeout is expired and got less than 3 repeats, I run normal press action.Of course you must hold the last command and clear it when executed to prevent any random repeats taking action.So if you get repeat codes but there was no previous cmd, just ignore them.

author: Peabody
author_rank: Super Contributor
timestamp: October 24, 2023, 02:29:45 pm
content: Then presumably the receiver will work ok without the repeats. Well, I'll find out soon enough.But it seems to me that while some keys should produce repeated action as long as they are held down, like the volume rocker, other keys should only trigger once no matter how long they are held down. The channel numbers for example. Or the mute button. Most keys would be in that group.

author: DavidAlfa
author_rank: Super Contributor
timestamp: October 24, 2023, 02:45:07 pm
content: Yes, if you're emitting IR codes any device should work without repeats, except long-press actions.