Making the connectors
Software to drive it
Hints on using it
Excel spreadsheet to calculate conversion parameters for program to convert GP2D02 output to centimeters
Sources for the GP2D02
The GP2D02 is an ideal sensor for mobile robotics. It is relatively inexpensive at about $21.00 and offers excellent accuracy and repeatability. The device outputs an 8 bit digital value which corresponds to the range, yet requires only one digital input line and one digital output line. It is accurate in the range of about 10cm to about 80cm which is exactly the range that I cared about. The trick is that it requires a little software to make it work with the Handyboard.
The device has four wires coming out of its' connector. They are:
1) Ground
2) Input to GP2D02 (this line triggers a reading and then clocks the data back in).
3) +5 volts
4) Output from the GP2D02
In the image below: The connector is shown just before it is plugged in to the GP2D02. Pin 1 is on the right, pin 4 is on the left.
The input voltage going in to pin 2 cannot be greater than 3 volts so a IN4148 diode is connected in-line with the input pin (the green wire in the photo above).
The image below shows the diode in place before a piece of heat shrink tubing is slid over it.
Here is a close-up image of the diode, showing its' orientation:
Finally, you need to put HandyBoard compatible connectors on the ends of the wire. The Ground, +5, and input lines are wired just like any other sensor device for the HandyBoard. The output line can be just a single pin plugged in to one of the digital output lines on the expansion board. The completed connectors are shown in the following photograph: