Infrared LED and Receiver
TheIceman007
Posts: 2
Hi there. I'm new to Basic Stamp and wanted to try creating an infrared beam and detecting when an object breaks it. I downloaded the STamp weekend applicaction kit PDF and bought the IR LED and receiver and setup my board of eduction with the circuit described in the relevent project PDF. The only problem is my circuit just doesn't seem to detect when the beam is broken. I can literally place a cardboard blocking the receiver and it still says it works. Only when I disconnect the receiver does it come back with the "broken" text. Code from the Stamp Weekend Kit is here:
IR_detect var bit
low 7
loop:
pause 50
freqout 7, 1, 38500
IR_detect = in8
if IR_detect = 0 then unbroken
' Make sure to add six spaces to the debug statement
' below. That way both debug statements will have the
' same number of spaces for a better display.
debug home, "Beam is broken; object detected. "
goto loop
unbroken:
debug home, "Beam is unbroken; object not detected."
goto loop
I'm sure I have followed the circuit diagram correctly but if someone could post a board of education example that I can check I would really appreciate it.
Thanks
IR_detect var bit
low 7
loop:
pause 50
freqout 7, 1, 38500
IR_detect = in8
if IR_detect = 0 then unbroken
' Make sure to add six spaces to the debug statement
' below. That way both debug statements will have the
' same number of spaces for a better display.
debug home, "Beam is broken; object detected. "
goto loop
unbroken:
debug home, "Beam is unbroken; object not detected."
goto loop
I'm sure I have followed the circuit diagram correctly but if someone could post a board of education example that I can check I would really appreciate it.
Thanks
Comments
Look at the -Stamp Work.PDF- (Page 119) - EXPERIMENT #20: INFRARED OBJECT DETECTION -
You can download -Stamp Work- from Parallax web site:
Stamp Work:
http://www.parallax.com/Portals/0/Downloads/docs/books/sw/Web-SW-v2.1.pdf
Post Edited (electrosys) : 4/23/2010 10:23:40 PM GMT
Thanks for your quick reply. I've tried the link and it is practically the same code as the Stamp Weekend Application kit with interestingly the IR receiving the beam as 1 rather than 0.
However I still get the same problem with me placing an object between the beam and receiver and having it not registered.
If I take out the IR LED circuit the receiver correctly changes to show it isn't receiving the signal but not if an object is in the way.
I don't see why it must not work, if you are using the Stamp Works·code, the only problem that I could think of, it must be·the circuit connections.
Good Luck
Sounds like your IR is bouncing off walls and the detector is receiving the beam.
Try shrouding the receiver a small black tube so it has to directly line up with the ir beam or shroud the ir led to make a tight beam.
My TV controller controls the TV even when i point it 180 degrees from the TV as long as it bounces off a wall the receiver picks it up.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!