I'm trying to build a device that is able to learn the code sent from an IR Remote when a button is pushed and that is able to subsequently recognize it when received. I need my device to be compatible with all TV Remotes, so that is able to save and recognize a code independently from the protocol used by the remote.
In my opinion, since I need to recognize only one sequence, the better choice is to analyse the raw signal without decoding it the protocol. In this way I don't need to program the uC to recognize different types of protocols and it will works with every remotes, and those that use uncommon protocols.
My idea is this:
When the device need to be "programmed" it starts to sample to IR Receiver output signal every X time until the signal return to idle. These samples are saved in the uC memory.
When the device is normally working, if an event occurs (the receiver output goes low or high), the uC starts to sample the received signal and compare it to the reference signal, previously saved.
It this method good or is there a better way to do this?
If this is the better choice, what could be a good sample frequency (considering the difference between the protocols and that they works at different frequencies like 36 kHz and 38 kHz)?