收藏 分享(赏)

夏普公司推出的红外测距传感器GP2D12外形很小.doc

上传人:weiwoduzun 文档编号:2416665 上传时间:2018-09-15 格式:DOC 页数:10 大小:192KB
下载 相关 举报
夏普公司推出的红外测距传感器GP2D12外形很小.doc_第1页
第1页 / 共10页
夏普公司推出的红外测距传感器GP2D12外形很小.doc_第2页
第2页 / 共10页
夏普公司推出的红外测距传感器GP2D12外形很小.doc_第3页
第3页 / 共10页
夏普公司推出的红外测距传感器GP2D12外形很小.doc_第4页
第4页 / 共10页
夏普公司推出的红外测距传感器GP2D12外形很小.doc_第5页
第5页 / 共10页
点击查看更多>>
资源描述

1、夏普公司推出的红外测距传感器 GP2D12 外形很小,可测量范围为 10-80 厘米,其接口是标准的三线接口(Vcc/GND/Output) 。我们可以做一个转接电路,让它能与 RCX 相连,其硬件和编程可以参考: http:/ 。 应用: 可以在灭火比赛中应用,也可以应用在机器人走迷宫等等。 例子: 1.沿墙壁走的机器人2.沿墙壁走的机器人的行走状态This article, complete with text and images, was written by Philippe Hurbain. Introduction I long thought that a distance s

2、ensor would be a nice addition to Mindstorms robots, but ultrasonic ones were bulky and power hungry (Ive since found the SRF04 Ultrasonic Range Finder that can perhaps be used), and simple infrared methods like the one I used in my radar car detect obstacles but dont give true distance measurement.

3、 The solution came from Andreas Peter (thanks Andreas for showing me these devices !) who interfaced a Sharp GP2D05 to RCX. 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 ref

4、lectivity and ambient light. For more informations, see the GP2D12 datasheet and the Acroname article: Demystifying the Sharp IR Detectors. Andreass sensor interface has a few drawbacks though. The Sharp GP2D05 he used has a digital serial output not well suited to RCX analog input, thus requiring a

5、 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 the GP2D12 used 35mA under 5V, while RCX sensor input is current-limited to a

6、bout 14mA! 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 the GP2D12 is not powered, then release it during measure. Of course there is a penalty with this technique: conversion time is longer

7、. The GP2D12 requires 50ms per measure, while my circuit needs 300ms. there is no free lunch! The first designs I imagined were rather complex, with timers and a sample-and-hold amplifier, then I slowly came to this streamlined circuit: Using the Circuit Charging phase During 250ms, sensor is config

8、ured 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 non-conducting too, preventing current f

9、low through D3/R5/Q2. So the only significant current diverted from C1 charging is through R1 (less than 2mA), and at the end of this phase C1 is fully charged. Measurement phase During the following 50ms, sensor is configured as a touch sensor (passive). SENSOR+ is now only pulled up to +5V through

10、 10Kohm (inside RCX), insufficient to block Q1. Q1 and Q3 are then conducting, and GP2D12 is powered. Q2, mounted as an emitter follower, buffers GP2D12 output and its value is available to RCX through D3 and R5. Sample code to read sensor: SetSensor(SENSOR_1,SENSOR_LIGHT);Wait(25);SetSensor(SENSOR_

11、1,SENSOR_TOUCH);Wait(5);SetSensorMode(SENSOR_1,SENSOR_MODE_RAW);distance = SENSOR_1;/Enable C1 charge as soon as possibleSetSensor(SENSOR_1,SENSOR_LIGHT);Component Selection D1 prevents destroying the sensor in case of reverse connection. I didnt use the full-bridge rectifier used in Lego sensor tha

12、t enables sensors to work when connected backwards (number of needed diodes jumps from 3 to 8!). I considered that someone able to build this sensor is also able to connect it in the right way. For those who want it, here is the diagram with full bridge rectifier. I used 1 Amp Shottky diode 1N5819 f

13、or D1, which is inexpensive and readily available. Its low forward drop voltage is less than 0.1V for the current that flows through it, this enables it to charge C1 to the highest voltage possible. C1 stores energy that will be used during measurement phase. It must provide +5V at the end of this s

14、tage. Assuming typical values for the GP2D12 (I=35mA, conversion time=50ms) and an initial +7.5V across C1, its value is C = I * dT / dV = 35 * 50 / (7.5-5) = 700 F. Small margin with 1000 F. U1 is a low drop out 5V regulator in TO92 case. I used a Telcom/Microchip TC55RP5000 but other regulators wi

15、ll probably work, such as STMicroelectronics L4931-50. Standard regulators such as 78L05 will NOT work because they require more than +7V at input to get a +5V output. Take care with some low drop regulators such as LM2931 that require more than 25 mA when powered at 1V. With RCX current limitation,

16、 this hog eats all energy. (I was caught with this one.) Q1 switches power on and off for GP2D12. At 35mA current, I originally used a plain vanilla BC548. My sensor began to work with it, but exhibited strange behavior. Looking to GP2D12 power supply I then discovered 2V dips! I then looked at the

17、GP2D12 consumption and discovered that it was pulsed (220mA pulses 1/8th of time, superimposed to a 8mA constant current. See oscilloscope captures here ). At such a current, BC548 has a low gain, and since I couldnt lower base resistor R1 (main current drain during capacitor charge) I used a high p

18、erformance Zetex transistor, ZTX718 that offers high gain at high current (other similar devices can work!). C2 stabilizes U1 and helps absorb peaks of current. A low ESR version would be better (see “grass“ on 5V output when GP2D12 works).Main Component Datasheets (PDF Format) GP2D12 PDF datasheet

19、BC548 1N5819TC55RP5000GP2D12(old documentation, 900k) BC558 ZTX718Oscilloscope Screen Captures See them here. Building the Sensor Interface Module: Photo Gallery The interface module is build on a 1“ square proto-board Top view Top view, with components identification Bottom view. A notch in circuit

20、 is cut for big C1. A single layer circuit board would be very easy to draw. Everything fits in 3 hollowed 4x2 bricks Pretty tight ! Complete module. GP2D12 fixations were cut to match Lego brick width. Ready to work ! The Prototype A much more ugly circuit.mounted on a test vehicleA Real Applicatio

21、n: Wall Follower See it here ! Test programs Here are some NQC test programs (they require RCX 2.0 firmware that you can get here ). GP2D12-3-a.nqcDownload “GP2D12-3-a.nqc“ here/ Read GP2D12 Sensor output and displays/ raw value on RCX display (requires RCX 2 firmware)int value;task main()SetUserDis

22、play(value,0); / Display “value“ on LCDSetSensor(SENSOR_1,SENSOR_LIGHT); / Active mode: starts charging sensorWait(100); / Wait for full charge on startupuntil (false)SetSensor(SENSOR_1,SENSOR_TOUCH); / Passive mode: starts measureWait(5); / Wait for GP2D12 conversion time (50ms)SetSensorMode(SENSOR

23、_1,SENSOR_MODE_RAW);value=SENSOR_1; / reads and display valueSetSensor(SENSOR_1,SENSOR_LIGHT); / Recharge sensorWait(25); / for 250 msGP2D12-3-b.nqcDownload “GP2D12-3-b.nqc“ here/ Read GP2D12 Sensor output and displays distance (in cm)/ on RCX display (requires RCX 2 firmware)int value,temp;task mai

24、n()SetUserDisplay(value,1); / Display “value“ on LCDSetSensor(SENSOR_1,SENSOR_LIGHT); / Active mode: starts charging sensorWait(100); / Wait for full charge on startupuntil (false)SetSensor(SENSOR_1,SENSOR_TOUCH); / Passive mode: starts measureWait(5); / Wait for GP2D12 conversion time (50ms)SetSens

25、orMode(SENSOR_1,SENSOR_MODE_RAW);temp=SENSOR_1; / reads sensor valueSetSensor(SENSOR_1,SENSOR_LIGHT); / Recharge sensorWait(25); / for 250 mstemp=10000/(21*temp+6*temp/10)/100-72)-20; /linearize and convert in mmvalue=temp; / displays distance in cm (format:xx.x)Distance vs. Sensor ReadingLinearized curve: 1000/(distance-2) vs. Sensor Reading + Best Fit LineRevision History 4/26/01 - Created. 5/08/01 - Added full size images of circuit boad construction.

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 经营企划

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报