Before we begin, we need to get some data. In particular, we'll need the 'power' codes for each TV we want to disable. That's the infrared transmissions, how often to turn the LED on and off. Back when we designed the TV-B-Gone kit Mitch provided me some data that I used to create the ATtiny85 lookup tables. But its been a long time and there's been a few 'generations' of updates to the code database. But we didn't have access to the code itself, it basically provided in binary-format only, on the raw chip that Mitch uses. So we'd have to extract those codes ourselves!
The simplest way to do that is to hook up an IR receiver and point it at the IR transmitter (LED) on the TV-B-Gone like so:
Then on the Arduino or CircuitPython board, run a program that will capture the Infrared signals and print them out. We have some code on how to do that in this guide here. But then I realized right after I wired the whole thing up that it actually wouldn't work. Why? Because the IR receiver is tuned to 38KHz but the transmission bursts can be modulated at a bunch of different frequencies, sometimes as high as 56KHz. While the receiver will still likely receive the data, it could get garbled, and in any case, it's demodulated so we can't know the original encoding frequency, and the TV's we're blasting may be more sensitive.
It's Logic Analyzer Time!
OK no worries, we have the technology to solve this! Instead of using an IR receiver to demodulate the signal, we'll tap directly into the GPIO pin on the TV-B-Gone and listen to the signals. In this case we're going to use an old Saleae logic analyzer, but sigrok can also do the job and may be more affordable. The data rates we're talking about here, no faster than 60KHz, are fairly slow. It's just that the data is very long, the TV-B-Gone transmits for over a minute!
Once we've performed the capture, we'll get a waveform like this:
Each of those 'pillars' is a pulse of infrared light at a certain frequency, the submodulation means its easier for the TV receiver to tell the signal is for it. As mentioned before, that submodulation can vary, from 34KHz to 50KHz or more. If we zoom into the data we can see the details of each 'pillar' above:
Wonderful! now we just have to extract the frequencies, the time 'on' and the time 'off'. Its parsing time!
Text editor powered by tinymce.