Building a multi-frequency IR detector? (Arduino sample/DSP)

I'm in need of guidance!

I want to build a generic IR remote control receiver. Unfortunately, those guys come in many kinds of protocols and carrier frequencies. One way to do it is to get a bunch of pre-made detectors at various frequencies, and tie them all to different input pins. However, that will cost a lot! Another way to do it is to sample a phototransistor with 940 nm center sensitivity, and run some DSP on the signal on the Ardy itself (at 16 MHz, it might keep up).

So, I wired up that circuit (+Vcc, photo-transistor, A0 in, 600 kOhm, GND), and then became sad when I realized that analogRead() takes a significant amount of time to complete. The documentation says 100 microseconds, and I don't have data to say that it's wrong. That gives a 10 kHz sample frequency, which doesn't work well with 38 kHz (or up to 60 kHz!) carrier frequencies.

So -- I will only ever sample one analog pin, so any kind of multiplexing is not needed. Is there some way to lock the multiplexer at a particular input and sample at a higher frequency? Or is the ADC just slow?

analogRead is not the way to go. An IR receiver yields a digital (on/off) output, so you ought to use digitalRead.

Use direct ADC registers manipulation, up to ~150 kHz: http://oscilloscopeexpress.blogspot.com/ And you need buffer amplifier, with output impedance a few hundred ohms, your 600 k is way too much even for 10 kHz sampling.

runaway_pancake: An IR receiver yields a digital (on/off) output, so you ought to use digitalRead.

That's true. But I'm using a phototransistor. Because I want to sample broad-spectrum IR, rather than just a specific carrier frequency. And when sampling a phototransistor, or other analog input part, I need analogRead().

Magician: Use direct ADC registers manipulation, up to ~150 kHz: http://oscilloscopeexpress.blogspot.com/ And you need buffer amplifier, with output impedance a few hundred ohms, your 600 k is way too much even for 10 kHz sampling.

That's an interesting article! It's more like what I want to do. I also assume that you mean input impedance, rather than output impedance ;-) I'm wondering whether I'll end up putting in an opamp of some sort, and end up building a comparator out of the photo transistor... But then how do I do automatic gain in software?

I also assume that you mean input impedance, rather than output impedance ;-)

In this concept design, arduino analog pin is input, with DC impedance 100 MOhm, or so (the same time around 10 kOHm for AC). Phototransistor plus resistor to ground are signal source with output impedance around half value of the resistor. This is output impedance.

But then how do I do automatic gain in software?

I don't think you need automatic gain control in common sense, as there is no issue if signal get distorted, but you do need feed back to compensate different lighting conditions. In this simple design, value of R should be variable, to keep output of the circuitry around 1/2 Vp all the time. Probably, you can use JFET instead of R, and arduino will drive PWM to gate via RC filter

Have you got any solution?

The OP left sometime within the >8 years since they opened this thread.

akshaypatil419: Have you got any solution?

No it was a silly idea in the first place.