ROBOTC.net forums
http://www.robotc.net/forums/

gp2d120 sensor type?
http://www.robotc.net/forums/viewtopic.php?f=41&t=4391
Page 1 of 2

Author:  topastop [ Fri Mar 23, 2012 12:17 pm ]
Post subject:  gp2d120 sensor type?

Hello!

I have bought a gp2d120 Infrared distance sensor, but I don't know how to use it with the NXT...
Does anyone know?
Shall I connect it as a Light* sensor?
Is there a "pragma" instruction for it?

Thanks in advance,
topastop

Author:  mightor [ Fri Mar 23, 2012 3:24 pm ]
Post subject:  Re: gp2d120 sensor type?

You should connect it as an analogue inactive sensor but you're going to need to do some serious voltage to distance translation yourself. Is there a reason you didn't buy the Mindsensors short range IR sensor or the digital variety Sharp IR Sensor? They would've made your life a lot simpler.

- Xander

Author:  mattallen37 [ Sun Mar 25, 2012 12:06 am ]
Post subject:  Re: gp2d120 sensor type?

Take a look at this artical for help with the voltage to range conversions.

Author:  topastop [ Fri Mar 30, 2012 1:07 pm ]
Post subject:  Re: gp2d120 sensor type?

Dear mattallen37,
thanks for the article. It will be useful to establish a threshold value. I only need to detect the presence of an obstacle at a close distance.

Dear Xander,
thanks for the suggestion. I'm not using those mindsensors versions just because they're expensive ($49.95) and for that value I can buy 4 of the basic GP2D120 !
And since I already had a few I bought a few years ago...

My problems now are,

(1) what declarations to use with RobotC:
- I have already tried "SensorType[S1]=sensorLightinactive" with "SensorMode[S and1]=modePercentage", but the NXT fails to read the sensor.

- are these options correct? shall I try different ones?

(2) I believe the electrical connections are also very important!
- I'm powering the GP2D120 externally with 5V, and use the white output and GND as the NXT inputs (lines 1 and 2).
- my doubt is: is it safe to interchange lines 1 and 2?
- do I have to use power from the NXT instead of external?
- anyhow, I'm not finding a way to make it work !

---> Can you make suggestions regarding commands and electrical connections?

I'd be grateful !!!

Author:  mattallen37 [ Fri Mar 30, 2012 2:22 pm ]
Post subject:  Re: gp2d120 sensor type?

On the sensors ports, pins 2 and 3 are Gnd, and pin 1 is analog in. As long as you have a common ground, it doesn't matter if you power the sensor from a different supply.

Author:  mattallen37 [ Fri Mar 30, 2012 2:31 pm ]
Post subject:  Re: gp2d120 sensor type?

One problem I foresee is that the analog line of the NXT is pulled to 4.3-4.7v using a 10k resistor. If the sensor can only pull a line up, then you will need an OP amp.

Author:  plopes [ Mon Apr 02, 2012 1:01 pm ]
Post subject:  Re: gp2d120 sensor type?

Dear mattallen37,

(1) pulling-up line 1

This really is a valuable information!
The GP2D120 may have an output resistance much higher than those 10KOhm an so it spoils everything!
I'll try using a follower opamp... !

Thanks a lot for the suggestion!
Regards.

Author:  plopes [ Tue Apr 03, 2012 2:54 pm ]
Post subject:  Re: gp2d120 sensor type?

IT WORKS !

I have used a LM324 opamp and the sensor finally manages to send its analog value to the NXT!

Thanks so much mattallen37 for your suggestion!


(and also mightor for the information regarding the sensor type)


plopes and topas.

Author:  mightor [ Tue Apr 03, 2012 3:03 pm ]
Post subject:  Re: gp2d120 sensor type?

Can you post some pics of your setup? It's always cool to see what people have created.

- Xander

Author:  mattallen37 [ Tue Apr 03, 2012 3:52 pm ]
Post subject:  Re: gp2d120 sensor type?

Awesome!

I would also like to see your setup if possible!

Author:  plopes [ Fri Apr 27, 2012 4:25 pm ]
Post subject:  Re: gp2d120 sensor type?

Dear mightor and mattallen37,

Here is my setup for GP2D120 using an LM324.
Thanks again for your precious help!

Paulo.


[img]"J:\__\DSCN7709_25%.JPG"[/img]

[img]"J:\__\DSCN7710_25%.JPG"[/img]

[img]"J:\__\GP2D120%20+%20LM324%20(b).jpg"[/img]

[img]"J:\__\GP2D120%20+%20LM324%20(a).jpg"[/img]

Author:  magicode [ Fri Apr 27, 2012 4:29 pm ]
Post subject:  Re: gp2d120 sensor type?

plopes wrote:
[img]"J:\__\DSCN7709_25%.JPG"[/img]

[img]"J:\__\DSCN7710_25%.JPG"[/img]

[img]"J:\__\GP2D120%20+%20LM324%20(b).jpg"[/img]

[img]"J:\__\GP2D120%20+%20LM324%20(a).jpg"[/img]

We can't see files that are stored on your computer. From the path names, it looks like you're trying to link to the images from your hard drive. If you want other people to see them, you'll have to upload them online somewhere.

Author:  NeXT-Generation [ Fri Apr 27, 2012 4:30 pm ]
Post subject:  Re: gp2d120 sensor type?

plopes wrote:
Dear mightor and mattallen37,

Here is my setup for GP2D120 using an LM324.
Thanks again for your precious help!

Paulo.


[img]"J:\__\DSCN7709_25%.JPG"[/img]

[img]"J:\__\DSCN7710_25%.JPG"[/img]

[img]"J:\__\GP2D120%20+%20LM324%20(b).jpg"[/img]

[img]"J:\__\GP2D120%20+%20LM324%20(a).jpg"[/img]


Umm, when using the "[img]" tags, you need a link to a website hosting the image. For what your doing, you need to use the "upload" feature found at the bottom of the posting page.

EDIT: ARGGHHH :evil: magicode beat me by one minute!!!

Author:  plopes [ Fri Apr 27, 2012 5:49 pm ]
Post subject:  Re: gp2d120 sensor type?

Image
Image
Image
Image

Author:  NeXT-Generation [ Fri Apr 27, 2012 5:56 pm ]
Post subject:  Re: gp2d120 sensor type?

Interesting! Since this is configured as RCX sensor on the NXT, could it be used like this with the RCX? Mightor, magicode?

Page 1 of 2 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/