I have a Sharp GP1UX311QS IR detector connected to a msp430 launchpad. I wrote a small bit of code to read the output signal from the detector and print the on/off times. However, without emitting any IR light (from a remote) a small pulse appears on the output signal every 5 to 20 seconds. I tried shielding the detector with aluminum foil for about 5 minutes and the random pulse never showed up. After removing the foil the pulse starts showing up again about 20 seconds later.

Screenshot of the signal from my oscilloscope:


Took a few samples of the small pulse to see how much it differed:


I also tried just a simple circuit that supplies 3.6 V to the IR detector and get the same results as above when connected to the launchpad.

The fact the detector only detects modulated IR at 38 kHz makes me wonder why I get interference. Any ideas where the interference may be coming from and what I can do about it? I would prefer a hardware solution rather then accounting for it in software. Thanks.

  • 1
    \$\begingroup\$ You're going to have to deal with invalid inputs in software one way or another. What happens if your device is operating in the same room as a tv set that also has a 38 kHz remote? \$\endgroup\$
    – The Photon
    Oct 20, 2012 at 4:33
  • \$\begingroup\$ Do you have lights on in the room? \$\endgroup\$ Oct 20, 2012 at 8:28
  • \$\begingroup\$ Please do the following experiments to help us help you. If you cover the window with black tape (not the foil) just optical block, do you see the pulses? If not, you need to look at power supply noise, if you do it is optical noise. Depending on the source, we can recommend alternative approached. For optical problem, you must add a filter (optical bpf) for power supply noise, add 0.1 and 1u caps to the supply and check again. \$\endgroup\$
    – Ktc
    Oct 20, 2012 at 10:06
  • \$\begingroup\$ Also, you can capture the supply voltage during this problem? Another alternative test is to use a simple photodiode with 1K resistor between its legs (better if you have an amplifier board lying around) you capture the optical environment noise. These tests will tell you what you are seeking. \$\endgroup\$
    – Ktc
    Oct 20, 2012 at 10:08
  • \$\begingroup\$ @Ktc I covered the IR detector using some black electrical tape and the noise disappeared. Since that hints at optical noise, I tried just turning off my ceiling light and again the noise disappeared. So it looks like the interference is coming from my ceiling light. Is it actually possible to add a custom optical bpf to the detector? \$\endgroup\$
    – pughar
    Oct 21, 2012 at 4:30

1 Answer 1


The datasheet warns in point 9 on the last page:

There is a possibility that noise on output may be caused by environmental condition (Disturbing light noise, Electromagnetic noise, Power supply line noise, etc.) even if there is no input transmission signal.

So it sounds like the manufacturer accepts that you may get false positives once in a while. Other than controlling your environmental conditions and having good power supply bypassing, you're probably going to have to filter out these glitches in software. You could have a circuit that filtered them based on minimum duration for example, but this so easily done in firmware that it's not worth the cost+area involved in a pure hardware filter.

  • \$\begingroup\$ noise noise and noise ! This is a problem about noise. You have explained in your answer, so I'm not going to repeat it back. \$\endgroup\$ Oct 20, 2012 at 5:19
  • \$\begingroup\$ @apalopohapa I am more comfortable making the filter in software. However, my goal is to learn more about hardware/circuits. Could you point me in the right direction for a filter based on minimum duration? \$\endgroup\$
    – pughar
    Oct 21, 2012 at 4:53
  • \$\begingroup\$ @pughar Well, you could have it charge a cap via a resistor, and the output go to a comparator that goes high when the cap is charged enough (say 2/3 of the way). Add a diode between cap and input so it gets discharged quickly (not through R). This way only pulses long enough (RC determines the time) will be seen at the output. You can probably do all this using a 555 (no need for the diode, the 555 has a discharge mechanism using a bjt). \$\endgroup\$ Oct 21, 2012 at 8:41
  • \$\begingroup\$ @apalopohapa With this approach, will I need a time constant c in firmware when I am timing the on/off pulses, where c is equal to the minimum pulse duration? When the msp430 detects the input signal goes from off to on, I subtract c from the previous off time and add c to the new on time to account for the filter? \$\endgroup\$
    – pughar
    Oct 21, 2012 at 17:21

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.