I've got the data from hundreds of remote-control transmissions in a handy file format. What would a statistician do? Analyze it, of course!
Remember that the XBox remote transmits in the RCA protocol; that protocol allows for 5 different sorts of pulses:
- mark_4ms: nominal 4 ms "mark" (active IR transmission)
- space_4ms: nominal 4ms "space" (no IR transmission)
- mark_500us: nominal 500μs mark
- space_1ms: nominal 1ms space (logic 0)
- space_2ms: nominal 2ms space (logic 1)
The real world is usually a bit messy - in this particular case, the data I measured coming out of the IR receiver module diverges from those nice values. So, by trial and error, I determined an upper and lower bound for each pulse type. I bin the data into the 5 types according to these thresholds (a value falls in a bin if it is in the range (min-bin-value, max-bin-value), where the parens represent noninclusive boundaries):
bin | min-bin-value | max-bin-value |
---|---|---|
mark_4ms | 4.01 | 4.07 |
space_4ms | 3.9 | 4.0 |
mark_500us | 0.5 | 0.56 |
space_1ms | 0.9 | 1.0 |
space_2ms | 1.94 | 2.0 |
Notice that the "mark" bins have larger than nominal values, while the "space" bins have smaller than nominal values. (By the way, by design, every duration value I collected falls into one of the 5 bins.)
Here are some statistics on the collected data, grouped by bin:
bin | average value | min value | max value | deviation from nominal (%) | number of samples |
---|---|---|---|---|---|
mark_4ms | 4.046216011 | 4.02744 | 4.06724 | +1.155% | 1514 |
space_4ms | 3.979702576 | 3.96054 | 3.99844 | -0.507% | 1514 |
mark_500us | 0.539785722 | 0.51732 | 0.55442 | +7.957% | 37850 |
space_1ms | 0.95811015 | 0.94466 | 0.98132 | -4.189% | 18168 |
space_2ms | 1.965947435 | 1.94998 | 1.98714 | -1.703% | 18168 |
Average, min and max are useful, and reveal basic facts, but also hide other things. For a full picture, there's nothing like... a picture. I discovered something interesting when I plotted each bin's data as a histogram. Click on a chart thumbnail to see the full-size version:
IR Receiver Output
Bin | Histogram | mark_4ms |
---|---|
space_4ms | |
mark_500us | |
space_1ms | |
space_2ms |
Isn't that peculiar? The data for each bin is clustered into groups rather than being a nice normal distribution.
Well. The measurement is made on the output of the IR receiver; could that receiver be distorting my nice clean data? Moving upstream a bit, I took apart the Xbox remote control, and found a very simple circuit driving the IR LED. (The box labled "micro" is an integrated circuit whose markings were pretty much indecipherable - presumably some simple microcontroller.)
I've taken a new set of measurements between the cathode of the IR LED and ground.
Internal-toXBox-Remote, IR cathode-to-ground
Bin | Histogram | mark_4ms |
---|---|
space_4ms | |
mark_500us | |
space_1ms | |
space_2ms |
These histograms show that the XBox remote itself is emitting pulse durations which tend to cluster into sub-bins separated by about 20μs. The histograms have higher peaks than those measured at the IR output - perhaps the IR receiver circuit has a "smearing" effect (I can imagine that the automatic gain-control part of the receiver would have this effect).
Move forward!
This measurement and analysis is fun laboratory work, but I'm anxious to get started on some firmware. Were I to continue in this vein, I'd work on some of these tasks:
- Investigate the effect of transmitter-to-receiver distance on pulse durations
- Get at least one more Xbox remote, and compare pulse duration statistics
- Try to find a datasheet for the alleged microcontroller in the Xbox remote
- Probe more pins on the alleged microcontroller - try to correlate pulse duration with power supply, incoming clock frequency, ...
But instead, now it's time to get back to my long-neglected f2013. As a preliminary step, I plan to learn about the f2013's clock source options think about the problem of debugging visibility in embedded systems.
Oh, right. Here are the up-to-date tb_6 (IR receiver measurement) and tb_7 (IR LED cathode measurement) files.