Browse over 10,000 Electronics Projects

Object Detector using PIC16F877 and GP2Y0D340K

Object Detector using PIC16F877 and GP2Y0D340K

This is to try the Sharp GP2Y0D340K infrared object detector. It is cheap, the disadvantage is that is will detect an object but it has no indication of the distance of this object. The detection range is highly reflectiveness (thus color) dependent.
A (shiny) black object was detected at 23 cm while a white object was detected at 59 cm.

The schematics are straight forward. The blue LED flashes so it is clear that the PIC is operational, the green LED indicates if an object has been detected. I didn’t know they made resistors of such small value (the data sheet calls for 1 ohm) so I had to go the shop to buy one. And of course they were out so I had so settle for 1.5 ohms which works just as fine.


The long wires in the left hand side are from the Wisp628 in-line programmer. Note that for the A version of the 16F877 (so the 16F877A) you need Xwisp version 1.08 or higher. The switch and LED on the right hand side are simply the on/off switch and thus not on the schematic. The green LED is on; meaning the sensor has detected the photographer!

The program is even simpler than the schematic. The sensor signal is reversed so the light is on when detecting something. And this time I thought I’d handle the flashing a bit different. I pretty much like the simplicity of this program.

Visit Here for more.