To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 3526
3525  |  3527
Subject: 
GP2D12 Please help
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Sat, 29 Nov 2003 05:42:32 GMT
Viewed: 
4238 times
  
Please help.
I just recently got a Sharp GP2D12 ir distance ranger plus RCX interface device
from mindsensors.
It is pretty cool, however I am getting alot of flucuation in the readings and
in turn I think that i am losing out on range.
The maximum distance I am able to read is 40 cm I think that because I cannot
get conistent data the sensor runs out sensitivity at that end of the scale.
There is a program for NQC and I have roughly translated it for LegOS.
The active sensor port cannot supply enough current so a capicitator in the RCX
interface acts as a battery.
When the capicatator has accumulated enough current(determined in program) the
sensor is switched to passive and a raw reading is processed.
The time for the passive sensor also has to take into account time for the
sensor to process (about 30-40ms).
Now I thought that because the legOS firmware continually takes a reading from a
passive sensor that the time taken to read the passive sensor would be much less
that that required from the standard firmware as in NQC.
After much testing I found the optimin setting to be 55ms and chage time 280ms.
Even with these settings i have to insert the readings in an array and take an
average and there is no difference for distances over 40cm.
Anybody have any ideas on how td this this differently or better to get more
accurate results?


unsigned long int range=0;

int main(int argc, char **argv)
{
ds_active(&SENSOR_2);
sleep(6);
while(1)
{
  ds_passive(&SENSOR_2);
  /*read time*/
  msleep(55);
  range=(SENSOR_2)/100;
  lcd_int(range);
  /*charge time*/
  ds_active(&SENSOR_2);
  msleep(280);
}
}



Message has 1 Reply:
  Re: GP2D12 Please help
 
Hi Sebastian, (...) I don't know the schematics of that sensor interface, but I think it's basically a bad idea to drive a device that needs 30 to 50 mA from a powersource that can only output about 10 mA. I've experienced similar effects while (...) (21 years ago, 2-Dec-03, to lugnet.robotics.rcx.legos)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR