Here's one example using a comparator. http://home.cogeco.ca/~rpaisley4/ATDetIR.html
Here is one I am using for a "Laser Fence". It will also work for IR.
And the simple code to go with it.
R2 will adjust the sensitivity of the Photo Diode. Ambient light does need to be shielded. Have used the same with IR but R2 was a fixed 10meg. (Total darkness for a parts counter on a conveyor)Code:DEFINE OSC 4 Asm ERRORLEVEL -306 Endasm include "modedefs.bas" ANSEL=%00000000 CMCON=7 PAUSE 2000 TRAIN VAR BYTE TRAIN=$55 CNT VAR BYTE LP VAR BYTE START: COUNT PORTC.1,100,LP IF LP <> 1 THEN CHECK HIGH PORTC.5 PAUSE 50 LOW PORTC.5 PAUSE 50 GOTO START CHECK: COUNT PORTC.1,100,LP IF LP <> 1 THEN BREACH GOTO START BREACH: FOR CNT = 1 TO 5 SEROUT PORTC.4,T2400,[TRAIN,TRAIN,TRAIN,TRAIN,TRAIN,9,3] HIGH PORTC.5 PAUSE 100 NEXT GOTO START END
Using 3 volts because of the radio transmitter.
Dave
Always wear safety glasses while programming.
Looks like I need a lesson on image tags!
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1904&stc=1&d=118608738 4">
Got it!!
Last edited by mackrackit; - 2nd August 2007 at 21:47. Reason: Image problem
Dave
Always wear safety glasses while programming.
I am happy there are more people out there building things for their .....ahem..childrens amusment. Mine is a slot car track for my son. Bruce small internet I used the exact same schematic you sent me for the lay out and it is the one that is giving me the problems but Im sure I am being too sticky about the details and tonight I will try it out with the pic with the fence circuit and see how it works (in sure it will be great).
Thanks again for the help I will post if it works or not.
Snap
Beer is proof that God loves us and wants us to be happy.
Found this:
[html]<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=367">[/html]By: Darrel
Here:
http://www.picbasic.co.uk/forum/show...98&postcount=2
Ok, I got my ir detect to work on a pic 16f84a the secret is to ignore all of the internet info out there that suggest op amps comparators. The pic is smart enough to read a slightly variable input (you might have to pull up of down the port). and job is done. After all was working It still bugged me that I could not get the 741 op-amp working so I spent the night playing with diffent combinations of resistors and leds untill I thought I figured this little sucker out of course I will be wrong ...but I can tell you that the fence circut works.
Thank again for the speedy help
Snap
Beer is proof that God loves us and wants us to be happy.
Bookmarks