I have used a GP2D15 (a digital output for specific distance) but the
datasheet that I have has the 12 and 15. Looking on the top of the
sensor, pins facing toward you, sensor facing away from you, the pins
are Vo, Gnd, Vcc. If you have a multimeter, you can connect +5 to
Vcc, Ground to Ground and read the output (Vo) with you meter with
respect to ground. You should see approximatly 2.5V with an object
about 10 cm away from the sensor and as you move the object away, the
voltage shoud decay. According to my data sheet (and IR knowledge)
you need to have a reflective object in order to get the sensor to
work. A white sheet of paper should work fine. There does appear to
be some ripple in the output waveform. A small capacitor from the
signal line to ground should clean this up. I would recommend
something on the order of ~0.01uF. Use a ceramic cap, not
electrolytic. If you would like the schematic/picture of what I
used, let me know and I will get one to you. Again, I was using the
15, not the 12 but the pinouts are the same.
-Bill
--- In oopic@yahoogroups.com, "Mike Martin" <xaviour2me@...> wrote:
>
> Hello All (newbie question)
> I'd like to ask two things.
> 1)Is the diagram on http://www.oopic.com/gp2d12.htm wrong? The
> datasheet in the sensors & detectors folder in the files section
have
> the pinout different to that on the oopic site (as well as the
wiring
> colours). If I look at mine face-on, from left to right the wiring
is
> yellow/black/red for Vo/GND/Voc but the website suggests
GND/Voc/Vc.
> So you see, I'm having trouble figuring out if it even works.
> 2)Also, does someone have a code snippet (or a known working
diagram)
> I could borrow to test it? I'm not entirely sure what to read from
> the IO line. What does IR.Value produce? So far all I can get out
of
> it is an integer value of 46. I'm using B.1.0 firmware. How can a
> digital IOline read fluctuating voltages? Is it converted to
varying
> pulses? The code I'm using is below:
>
> 'Turns on a RED LED - fishing for a value out of the IR
> Sub main()
> Red.IOLine = 1
> IR.IOLine = 3
> Red.Value = 0
> ooPIC.ExtVRef=0
> IR.Operate=cvTrue
> X = IR.Value
> If X = 46 Then 'discovered this value by trial and error
> Red.TurnOn
> End If
> Delay = 1000
> Red.TurnOff
> End Sub
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/oopic/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/oopic/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
No comments:
Post a Comment