Author |
Message |
topastop
Rookie
Joined: Fri Mar 23, 2012 12:11 pm Posts: 2
|
 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
|
Fri Mar 23, 2012 12:17 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 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
_________________| Professional Conduit of Reasonableness| (Title bestowed upon on the 8th day of November, 2013) | My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
Fri Mar 23, 2012 3:24 pm |
|
 |
mattallen37
Expert
Joined: Thu Sep 29, 2011 11:09 pm Posts: 184 Location: Michigan USA
|
 Re: gp2d120 sensor type?
Take a look at this artical for help with the voltage to range conversions.
_________________ Matt
|
Sun Mar 25, 2012 12:06 am |
|
 |
topastop
Rookie
Joined: Fri Mar 23, 2012 12:11 pm Posts: 2
|
 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 !!!
|
Fri Mar 30, 2012 1:07 pm |
|
 |
mattallen37
Expert
Joined: Thu Sep 29, 2011 11:09 pm Posts: 184 Location: Michigan USA
|
 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.
_________________ Matt
|
Fri Mar 30, 2012 2:22 pm |
|
 |
mattallen37
Expert
Joined: Thu Sep 29, 2011 11:09 pm Posts: 184 Location: Michigan USA
|
 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.
_________________ Matt
|
Fri Mar 30, 2012 2:31 pm |
|
 |
plopes
Rookie
Joined: Fri Aug 03, 2007 9:28 pm Posts: 7
|
 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.
|
Mon Apr 02, 2012 1:01 pm |
|
 |
plopes
Rookie
Joined: Fri Aug 03, 2007 9:28 pm Posts: 7
|
 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.
|
Tue Apr 03, 2012 2:54 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: gp2d120 sensor type?
Can you post some pics of your setup? It's always cool to see what people have created.
- Xander
_________________| Professional Conduit of Reasonableness| (Title bestowed upon on the 8th day of November, 2013) | My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
Tue Apr 03, 2012 3:03 pm |
|
 |
mattallen37
Expert
Joined: Thu Sep 29, 2011 11:09 pm Posts: 184 Location: Michigan USA
|
 Re: gp2d120 sensor type?
Awesome!
I would also like to see your setup if possible!
_________________ Matt
|
Tue Apr 03, 2012 3:52 pm |
|
 |
plopes
Rookie
Joined: Fri Aug 03, 2007 9:28 pm Posts: 7
|
 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]
|
Fri Apr 27, 2012 4:25 pm |
|
 |
magicode
Moderator
Joined: Tue Sep 14, 2010 9:19 pm Posts: 496
|
 Re: gp2d120 sensor type?
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.
_________________ sudo rm -rf /
|
Fri Apr 27, 2012 4:29 pm |
|
 |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 Re: gp2d120 sensor type?
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  magicode beat me by one minute!!!
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
Fri Apr 27, 2012 4:30 pm |
|
 |
plopes
Rookie
Joined: Fri Aug 03, 2007 9:28 pm Posts: 7
|
 Re: gp2d120 sensor type?
|
Fri Apr 27, 2012 5:49 pm |
|
 |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 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?
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
Fri Apr 27, 2012 5:56 pm |
|
|