AIC1863: How to use this MC to detect the presense of IR transmission

infraredpwmstm32

I have build simple prototype on STM32 ARM Cortex microcontroller trying to understand the usage of AIC1863 IR Preamplifier for Remote Control System (see the handmade PCB on the breadboard).

STM32 circuit

MCU generates 36kHz PWM to LED. I have no oscilloscope on this time, so I use multimeter to check voltage on PCB. If I put something between LED and IR Receiver I see the voltage change on AIC1863's output pin. But I don't understand what it has to return me. It seems output should change its value if I open/close the area between LED and IR Receiver. Am I right?

P.S. I have checked the PWM. It's ok, its frequency is 36 kHz with 1 second period and 0.3 duty cycle.

Best Answer

Based on the contents of the question, and without an oscilloscope trace to validate this, it does appear that the circuit is correctly implemented.

The way the device should work is:

  • Set bandpass center frequency to the coding frequency of the incoming signal. For 36 KHz, a resistor of 118 kOhms needs to be connected from Pin 7 to Ground. Since this is not a standard resistor value, 100 kOhms and 18 kOhms in series would work well. Suitable resistor values are on the table on Page 7 of the datasheet.
  • Connect the IR sensor photodiode between pin 5 and Ground, anode to Ground.
  • When a 36 KHz IR signal is received by the IR sensor photodiode, this goes through a band-pass filter and integrator, so the output goes high within 520 to 670 mS (typical) and stays high until the incoming IR signal stops.
  • The AIC1863 contains internal automatic gain control, so it will continue to detect input and generate the described output for a wide range of signal strengths.
  • Presumably the 1 second period mentioned in the question indicates 0.3 second on, and 0.7 seconds off for the IR LED being toggled at 36 KHz. If so, the output signal should stay on for 0.3 seconds and off for 0.7 seconds.

Yes, output should work / not work depending on whether the path between the IR LED and the IR Photosensor is blocked. Note that if the IR LED is not highly directional, reflected IR signals from the walls and surrounding objects could still show as a valid signal at the detection end. This is how pointing a TV remote with fresh batteries at a wall still allows a TV to be controlled, without a direct line of sight.

In order to analyze or troubleshoot the circuit better, if needed, these steps would be helpful:

  • Feed the 36 KHz PWM to the IR LED for say 1 second on and 3 seconds off, direct the IR LED towards the IR photosensor.
  • This will cause the output pin of the AIC1863 to be high for 1 second and low for 3.
  • Feed this output through an op-amp based unity gain non-inverting amplifier using an op-amp specified to source at least 20 mA.
  • Wire a regular visible-color LED with a current control resistor in series (330 Ohms will work) to the output of the op-amp.
  • The result will be that this visible LED will flash on for a second, stay off for 3. This is easily seen without any oscilloscope.

The precision of the bandpass frequency adjustment resistance is important, because an adverse approximation in this will cause the center frequency of detection (the PWM frequency) to shift. The two undesirable outcomes of this are that the system's sensitivity to incoming correctly coded IR signal will reduce, and interference from any nearby IR sources coded at frequencies other than the desired one, such as other remote controls in the vicinity, can swamp the input.

See also this question, for a similar situation where the drift in frequency between emitting LED PWM and receiving device causes problems receiving desired remote control data.


Specific to the question title:

Check whether the microcontroller inputs are 5 Volt tolerant - I believe they are not, so a 3.3 Volt input is required. If they are 5 Volt tolerant, then skip the resistor voltage divider mentioned below.

Wire the output pin of the AIC1863 to a voltage divider, consisting of a 3.3 kOhm and a 5.6 kOhm resistor, then to ground. Connect the GPIO pin of the microcontroller to the point between the 3.3 k and 5.6 k, resulting in a signal of ~ 0 Volts LOW and ~ 3.1 Volts HIGH.

Use either pin-change interrupts, or straight digital reads, to read the value on that GPIO pin. It will be high when the IR LED is transmitting with 36 KHz modulation, and low when it is not.