I've made 3 programs. One is written in python, c++ processing and bash.

Everything seems to be okay but then sometimes I get a signal from the arduino that activates the function to lower down the volume on the python code listening for serial data. This is sometimes random but it seems that I can reproduce the same behavior when I turn the light on. I can cause the same disruption if I wave my hands over it quickly.

How can I filter this? I know that IR is part of the electromagnetic spectrum in which the visible light takes part. The sensor is facing upward for a type of omnidirectional receptor. I've placed a TV IR blackish cover over it but with the same results. Do I need to use the function to hash decode the incoming signal? I suppose that it needs a simple circuit as any other sensor.

I want to discard the possibility of a random activation in my code.


Taken into consideration the answers until now I can confirm that this is part of a physical phenomena due to the distance between my light and the device.

As for the solution to my volume problem It seems that I used "0" in the same statement as the ir code I remapped in the python code. It turned out to be part of the IRlib library of the arduino code that returns a "0" when it encounters an unknown signal. (due to protocol specification? - out of useful range? )

The thing is that I can change the if statement value for other than "0" but that won't stop it from returning "0" and that's a disadvantage. The solution that came to me is simply intercepting the signal and use continue to skip this.

Is there any alternative to this?

  • 1
    This is why IR communications uses actual protocols instead of just presence of the signal. – Ignacio Vazquez-Abrams Oct 13 '15 at 21:16
  • Can you explain? I use a library to read IR signals from a remote control of a portable dvd player – DarkXDroid Oct 13 '15 at 21:34
  • You'll need to find out what encoding the remote uses, that will be trial and error. You might be better of buying a cheep one that you know the encoding for off eBay or aliexpess. – Code Gorilla Oct 13 '15 at 22:11
  • Yes mine use the NEC protocol that seems generic because I have another that use the same protocol. I've kinda found my solution so I'll edit my first entry. Thanks – DarkXDroid Oct 14 '15 at 3:53
  • Remote controls use a carrier wave to make it easier to distinguish IR noise from IR signals. What kind of IR-sensor are you using? – Gerben Oct 14 '15 at 15:28

Yes, a light bulb will put out some infrared light.

Decoding remote control signals isn't that hard - there is a tutorial at instructables - http://www.instructables.com/id/The-Easiest-Way-to-Use-Any-IR-Remote-with-Ardiuno/?ALLSTEPS

This also means you can tell the difference between different buttons.

P.S. - when posting in this forum, it helps to include your code and your wiring.

| improve this answer | |
  • Yes that seems to be correct. Thanks for the link and fast answer. My bad but I did not know where to point that first issue. With the help received I can propose an answer myself now. So I'll post some code for reference – DarkXDroid Oct 14 '15 at 12:07

What kind of light bulb is it? Try using e.g. an LED instead of incandescent; you might get less IR signal.
Having a more complicated signal that is decoded by the receiver reduces your false positives.

| improve this answer | |
  • That's a good idea!! Thanks This can be reproduced depending on intensity of light, velocity of action(no slow dim), type of artificial light and distance between. We are talking about a physical phenomena here. I'll edit my question to propose an explanation. – DarkXDroid Oct 14 '15 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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