Hiya, I've implemented two proximity detectors with a PIC16C505 and I can offer you a few comments about it. 1. You will have to come up with a routine to pulse an IR LED at the appropriate frequency while polling the IR Detector. Not hard, but it will take a bit of playing around. 2. You will have to characterize the IR Detector that you are going to use. I found some that will respond after two pulses, others will respond after six or seven. My code sends eight with the idea that if the object is in range, the IR Detector will respond. I then stop pulsing the LED for 1 msec because the IR Detector will continue to be active for several hundred microseconds. Your mileage may vary - decide on the IR Detector to use, characterize it and don't change it. 3. What is the object? I found that this set up will have problems with glass/mirrored surfaces if the reflected light is not directly pass the IR LED output to the detector. As well, rough black plastic will absorb the IR signal and not reflect anything. Anything in between these two extremes will probably be fine. 4. You might want to put an opaque object between the IR LED and the IR Detector. I used the 47 uF caps that filter the power going into the IR Detector. 5. 12"+ is somewhat extreme and you might have problems caused by reflections on the flat surface your detector sits on. If possible, you might want to place it 6" or more above the surface to avoid the surface from giving you false reflections. 6. Instead of a straight current limiting resistor, use a pot (I used a 10K) and vary it until you have the sensitivity you want. For my application (a robot), I was looking for objects at 2" to 4", but just trying the test rig out, I can detect objects 2' away. 7. The sensor I came up with is pretty binary. Don't expect it to be very good at giving you any kind of distance measurement. I have been working on a robot all summer that does collision detection using this method and it is quite reliable, especially for the shorter distances. The big advantage of this method (along with reliability) is that it is a very inexpensive way of implementing a proximity sensor. Let me know and I'll pass along the test code I've developed. I'll be putting the entire robot design up on my web page in the next three weeks or so when the work crunch is finished. myke ----- Original Message ----- From: "Micro Eng" To: Sent: Friday, August 24, 2001 12:06 PM Subject: [PIC]:Using IR....determing position? > I am trying to decide if I can use an IR setup to determine if something is > in range. I could use ultrasonic, but I wondered if IR might be easier. > All I want is PIC watching the inputs and if the box is moved within a > certain range (12"-16") turn on an LED. Simple in concept.... > > _________________________________________________________________ > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu