1
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ If I understand correctly maybe you're trying to do distance measurement? I've never used a AIC1863 but after a quick look at the datasheet it appears to be a on/off output, so I'd expect at some distance it will simply go from on to off, which is what you're seeing by blocking off the IR source. \$\endgroup\$
    – PeterJ
    Feb 16, 2013 at 12:21
  • \$\begingroup\$ No distance measurement. I just need detect the presence of some object between LED and IR diode. Maximum distance is 3 meters but I have tested on 1-2 cm. \$\endgroup\$ Feb 16, 2013 at 13:24

1 Answer 1

1
\$\begingroup\$

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.

\$\endgroup\$
10
  • \$\begingroup\$ Ok. Will try. One question more. I have connected IR photodiode' anode pin to ground, as showed here: robotroom.com/ReversedLED.html So, anode or cathode should I connect to the ground? \$\endgroup\$ Feb 16, 2013 at 13:33
  • \$\begingroup\$ Yes, AIC1863 is connected to PA7, which is not 5V tolerant (I hope the pin still alive). So I need to use voltage divider. \$\endgroup\$ Feb 16, 2013 at 13:46
  • \$\begingroup\$ That article is correct, the cathode of the LED needs to be towards the positive supply, and the anode towards ground. \$\endgroup\$ Feb 16, 2013 at 15:20
  • \$\begingroup\$ I have connected AIC's out pin to PA8 (it is 5V tolerant pin) and made simple loop for testing LED. If I short AIC's out to ground this LED is off else on. For bandpass resistor I use 120 kOhm. It is near by 36 kHz and should work well. But I get 5V on out pin all the time. \$\endgroup\$ Feb 16, 2013 at 16:25
  • \$\begingroup\$ Looking to Frequency of bandpass filter table: 40kHz = 104k, 38kHz = 110k, 37kHz = 114k, 36kHz = 118k, 33kHz = 130k 120k = 36.5kHz \$\endgroup\$ Feb 16, 2013 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.