Can't get infrared detector to work
SSteve
Posts: 808
I just got the StampWorks kit and I've been going through the experiments. I'm having trouble with experiment #20. I'm assuming it's supposed to detect when the IR from the LED is blocked, but it acts like it's always seeing the IR. Even if I completely remove the IR LED, it still says "All Clear".
I think I have the LED connected correctly. (My background is in programming and I know very little (so far) about analog circuits.) I have the long lead connected to the resistor that goes to Pin 0. The short lead is connected to ground. I have the detector connected as shown in the diagram.
The program is working correctly. If I connect Pin 1 to ground, it shows "Intruder Alert!". With pin 1 connected to VDD it shows "All Clear".
So it seems like the Detector is always detecting IR but when I completely remove the LED from the circuit, it still always says "All Clear".
The thing that seems weird to me is that if I reverse the leads on the LED, the program always says "Intruder Alert!".
I'm stumped. Can anyone figure out what I'm doing wrong?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
I think I have the LED connected correctly. (My background is in programming and I know very little (so far) about analog circuits.) I have the long lead connected to the resistor that goes to Pin 0. The short lead is connected to ground. I have the detector connected as shown in the diagram.
The program is working correctly. If I connect Pin 1 to ground, it shows "Intruder Alert!". With pin 1 connected to VDD it shows "All Clear".
So it seems like the Detector is always detecting IR but when I completely remove the LED from the circuit, it still always says "All Clear".
The thing that seems weird to me is that if I reverse the leads on the LED, the program always says "Intruder Alert!".
I'm stumped. Can anyone figure out what I'm doing wrong?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Beau: I had tried turning the LED around like I said in my first post and the program always said "Intruder Alert". I just tried it again and the program switches to "All Clear" when I break the beam (which I would swear it wasn't doing before). Just to double-check: Was I was correct in originally connecting the long LED lead to Pin 0 through the resistor and the short lead to ground? If so, then this LED is backward.
Also, the program works opposite from what I'd expect. It says "Intruder Alert" when the IR is detected and "All clear" when the beam is broken. Is that the way it's supposed to work or is it a bug in the program? (I'm using the experiment 19 program I downloaded from the StampWorks product page.)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
In your original post...
I'm a little confused, since I don't have a StampWorks book in front of me. However, looking online at experiment #20, it has something to do with Sound effects.
see www.parallax.com/html_pages/downloads/sw/sw.asp
Aside from that, I'm glad you got something working.
In your original post... In your latest post...
Without looking at your code, both of the statements above seem to logically agree.
In your latest post...
Not necessarily, the Anode or Cathode being longer than one another can vary depending on what the manufacturer decides.
"Usually" the Anode is longer, but it is not an absolute requirement. I don't have one of our IR-LED's to check against so I can't
confirm which of ours is longer or shorter.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 3/22/2006 11:55:05 PM GMT
Well that's good to know. Now that I know I can see IR with my camera's display, I'll be able to check in the future.
You're right. But I was confused because the program from the book was doing the opposite of what I expected. I assumed it would say "All Clear" when it detected IR and "Intruder Alert" when it didn't.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
Also, is the short lead also the side that holds the larger "part" inside the lens --i.e., the part that contains the LED's cone-shaped reflector?
If so, then it seems maybe the leads were cut the wrong lengths.
(The flat side, and the large "part" are (supposed to be) the cathodes too, along with the short lead.)
PAR
Cruel trick to play on a beginner, though.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
Cruel trick? I'm not so sure about that.
Consider that you just had a valuable, first hand learning experience that you'll probably never forget. The real lesson here is: to have trust in what you know and can prove, and not in what you think you know, based merely on convention. The "you" here is third person.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
I meant the cruel trick comment more as a joke, but you are correct. It was a good lesson that didn't hurt anything and I learned a great way to test IR LEDs.
-Steve
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
But, above you respond to my questions with "Yes" (i.e., that your *short* lead is on the same side of the LED as the flattened surface and the large cone-shaped reflector). So, it sounds like your short lead was correctly placed, and should not have been trimmed.
No? Yes?
PAR
short lead = cathode = flat side of lens = larger plate in body = the lead that gets connected to ground
long lead = anode = smaller plate in body = the lead that gets connected to VDD
I just tested this with a red LED, a green LED, and a yellow LED and it and it was true for all of them. But to get the IR LED to light up (looking at it through the screen on my digital camera) I connect the lead on the flat side of the lens with the larger plate in the body to VDD and the lead with the smaller plate in the body to ground. I'm not sure what to think at this point.
(Just to be complete: the side of the LED with the smaller plate in the body went through a 220 Ohm resistor to VDD.)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
PAR
I'm really sorry that this was the first thread I started on this forum. I think it has made me look like a complete idiot when, in reality, I'm a reasonably intelligent person.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows