IR sensor trouble

[FONT=Century Gothic]We are pretty sure that we have our IR sensor all hooked up right, but we are not getting a consistent output. When our sensor is pointed directly at the beacon (within 2 inches), we still get alot of 1s and not very many 0s. When we completely cover the sensor up, we get the same pattern. The only way the pattern stops is when we unplug the beacon. Is this normal output?[/FONT]

The sensors are very sensitive to light coming in from all sides of the package not just the front. This allows it to “see” reflections from everywhere. Try putting electrical tape around the sides and back of the sensor and try again. You have crossed the wires, right? The sensor is not pin to pin to a PWM cable.

It depends on how you have the IR sensors hooked up.
If you are testing with just an IR sensor hooked to a digital input and a printf, then the output you are seeing is correct. As Al said the “bald” IR sensor will just tell you that the beacon is on in the room somewhere, and covering it with your hand won’t prevent that.

Your next step is to shield the IR sensor so it isn’t exposed on the sides or back and use Kevin Watson’s Tracker s/w with the IR sensor handled by an interrupt. See Kevin’s web site atr http://kevin.org/frc/ for his IR FAQ and software.

With the tracker s/w you won’t be able to look at 1’s and 0’s at all. They should be hooked to the interrupts and a printf in an interrupt handler can play havoc with the code sequencing, because it can take so long. There are, however, other variables you can check to see that it’s working correctly.

Look in the “Programming” forum for most IR discussions.