kowatec IRF150 User Manual

IRF150 --- Infrared Range Finder
Overview
IRF150 is an infrared range finder module consisting of
a GP2Y0A02YK reflective optical sensor module,
which emits infrared light to detect the reflective
infrared intensity and an Analog-to-Pulse (A2P)
Converter board. The A2P Converter board converts the
measuring the pulse width, the analog readings can be
obtained with the PulseIn command. The analog output
can also be read directly with the command GetADC
command from the I/O Extender module. The
recommended detection range is 20~150cm.
Applications
Short distance range finding
Proximity detection for collision
Contactless switch
Features
Measurement not affected by the color of object
Analog to Pulse (A2P) module available
Recommended detection range 20~150cm
Input voltage 5V
Compact size for tight space
Connection
Mechanical Hole
Mechanical Hole
IR Light Emitter
IR Light Detector
Pins from left to right:
Vo, GND, VDD
Figure 1 GP2Y0A02YK Component Description
Vdd Input
Vdd Input
Pulse out pin
GND pin
Analog input pin
GND pin
Figure 2 A2P Component Description
Figure 3 Connecting GP2Y0A02YK for analog output
Figure 4 Connecting GP2Y0A02YK with A2P for pulse output
Specifications
Figure 5 GP2Y0A02YK Voltage vs. Distance Characteristic Curve
A2P Pulse Duty
Instead of connecting the analog output to an AD converter to get the GP2Y0A02YK analog
voltage value, use the A2P Converter module to measure the pulse width directly. The pulse
is emitted every 10ms (1ms=1/1000 sec). The low pulse width represents the analog voltage
value. Its width varies from 0 to 4096 us (1us=1/1000 ms) with 2us resolution.
Figure 6 A2P Pulse Duty
The conversion formula is:
Width = Vi(analog input) / Vdd x 4096 (us)
Assuming the analog voltage output from GP2Y0A02YK is 3V and the supplied voltage is
5V. Applying the above formula:
3 / 5 x 4096 = 2457.6 ≒≒ 2458 (us)
the low pulse width will be 2458us.
Dimensions
Figure 7 GP2Y0A02YK Dimensions
Figure 8 A2P Board Dimensions
Example Program
Example I
Use PULSEIN command to read GP2Y0A02YK analog output data through A2P module.
Connect the GP2Y0A02YK to A2P board. Then connect the Pulse Output pin of A2P to
BASIC Commander® pin 0 to measure the pulse width.
Sub main()
Dim temp As Word
Do
Pulsein 0,0,temp ‘measure pulse width
Debug “Input Signal =”, Temp,CR ‘display pulse width
Pause 100 ‘wait 100ms
Loop ‘infinite loop
End Sub
Example II
Use GETADC command of I/O Extender to measure GP2Y0A02YK analog output directly.
Set the DIP switch of the I/O Extender module to 0 and connect it to the BASIC Commander®.
Then connect the Analog Output pin of GP2Y0A02YK to I/O Extender pin PA0.
Peripheral MyIO As IOExtenderA @ 0 ‘declare module ID as 0
Sub main()
Dim temp As Word
MyIO.SetADC 1 ‘start pin PA0 AD conversion
Do
MyIO.GetADC 0,temp ‘read AD value
Debug “Input Signal =”, Temp,CR ‘display AD value
Pause 100 ‘wait 100ms
Loop ‘infinite loop
End Sub
Loading...