GP2D12 distance sensor

Posted on Feb 7, 2014

A distance sensor would be a nice addition to Mindstorms robots, but ultrasonic ones were bulky and power hungry, and simple infrared method like the one I used in my radar car detects obstacles but don`t give true distance measurement. The solution came from Andreas Peter (thanks Andreas for showing me these devices !) who interfaced a Sharp GP2D02 to RCX.

GP2D12 distance sensor
Click here to download the full size of the above Circuit.

These small and rather inexpensive infrared devices are able to measure distance between 10 and 80 cm with reasonable precision and good immunity to variations of obstacles reflectivity and ambient light. For more informations, read GP2D12 datasheet and Acroname article: Demystifying the Sharp IR Detectors. Andreas sensor interface has a few drawbacks though. The GP2D02 he could find has a digital serial output not well suited to RCX analog input, thus requiring a rather complex design, big and power hungry. So I decided to try to connect the analog output GP2D12 sensor using the simplest design possible - and use only power coming from sensor input. This was a real challenge since GP2D12 used 35 mA under 5 V, while RCX sensor input is current limited to about 14 mA ! (look at voltage versus current of sensor input power supply: The main concept to achieve this goal was quickly imagined: store energy in a capacitor while GP2D12 is not powered, then release it during measure. Of course there is a penalty with this technique: conversion time is longer. GP2D12 requires 50 ms per measure, while my circuit needs 300 ms. there is no free lunch! During 250 ms, sensor is configured as a light sensor (powered), C1 charges through D1 up to SENSOR+ voltage. Low drop regulator U1 generates a 5V regulated supply. Q1 is blocked by D2 (D2 maintains base to a voltage higher or equal to its emitter voltage), so GP2D12 is not powered. Q3 is...

Leave Comment

characters left:

New Circuits



Popular Circuits

BFO Circuit
12 Volt 20 Amp Solar Charge Controller
30KV Power supply / Generator
Music Instrument design
120Ac Shimmering Light Circuit
Wireless Lock Tone
2 Channels RF remote control
Cellphone-Based Device Control With Voice Acknowledgement
Mk1 Schematics
Data Receiver
Play Games with Nixie Tubes