|
Hi Sebastian,
> 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.
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 testing the four GP2D12-inputs on our
Lepomux v3.0 prototype. Unstable readings, less range. There was a certain
jitter on the 5 Volt line that I couldn't explain. Afterwards, I found out that
the reason was just an empty battery ;-)
As the GP2D12 is doing a lot of signal processing on the transmitted/received IR
stream, a bad power supply will most certainly lead to bad sensor readings.
> 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.
your should get the full range of 10 to 80 cm (10 to 0 cm give similar values
like 10 to 20cm but in reverse order)
> 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.
I don't know how NQC implements active/passive sensor modes, but legOS/BrickOS
is permanently fetching sensor values from the A/D converter - no matter if
we're in active or passive mode. The only difference between these two modes is
that the sensors are powered in active mode while there's no A/D converter
activity. Power is switched off before sampling the data and switched back on
afterwards.
This means that you don't even need to switch to passive mode. Something like
the following should work (and power the interface permanently):
ds_active(&SENSOR_2);
sharp = SENSOR_2 >> 6;
The bitshift is necessary because the 10 Bit A/D value is located in the upper
10 bit of the 16 bit value of SENSOR_2. If you want a stable reading (and less
resolution ;-) you can simply shift 8 instead of 6 times - so the sensor value
will only contain the 8 most significant bits.
Kind regards
Gunther
|
|
Message is in Reply To:
| | GP2D12 Please help
|
| 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 (...) (21 years ago, 29-Nov-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
|
|
|
|