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 / 969
968  |  970
Subject: 
Problems reading active sensors with legos? Is there a solution?
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Thu, 30 Mar 2000 22:37:37 GMT
Viewed: 
2598 times
  
I'm a bit confused with the reading of my light sensor with legOS.

I'm getting values with a lot of "noise"... For example, reading the value
for white, I'm getting values with a "noise" from 36 to 24 (raw) around the
right value.

Reading some post on lugnet and legOS sources, I've found that LegOS is
reading sensors with a very fast frequency.

Please, correct me if I'm wrong: sensor are read in "single mode" in turn.
As soon as an A/D conversion is finished, a new one is started. For reading
an active sensor, output on that
single sensor is switched off some instruction before A/D sampling is
started. Kekoa said in a message on lugnet that probably the output should
be switched off with a more little delay before the A/D conversion take
place.

I report some statement from the msgs I've found about this problem:

Kekoa Proudfoot  wrote:
Markus L. Noga <noga@inrialpes.fr> wrote:
In my case, since I scan all 4 a/d inputs at once, the one that really
matters is the first one, a/d input a, which corresponds to sensor 2.
Without the delay, I get raw 10-bit values for sensor 2 that are off • by a
wildly varying 50-100 units compared to sensors 0 and 1.  With the • delay,

The current legOS sensor read cycle is this (i=illuminate, c=A/D
conversion)

S1: iii iii iii ccc
S2: ccc iii iii iii
S3: iii ccc iii iii
S4: iii iii ccc iii

If you find your sensor 2 readings to be still accurate, maybe a better
cycle would look like this:

S1: iii iii --- ccc
S2: ccc iii iii ---
S3: --- ccc iii iii
S4: iii --- ccc iii

The current LegOS model really hammers the sensors, almost to the point of
oversampling them.  It only takes a short while (less than 0.1 ms, I think)
to sample all four sensors; I think LegOS samples the next sensor
immediately after finishing the current one, thus sampling all four sensors
every 0.1 ms, or something like that.  The ROM samples all four sensors in
rapid succession (using the scan mode to do this), but only samples all
four sensors every 3 ms.  My code is similar but samples every 4 ms.

The reason my code needs the delay is because I start A/D conversion at the
same time I turn off power to all four sensors.  There is no fancy timing
to turn off power to the sensors some measurable time before starting A/D
conversion, just the short delay loop.

Because LegOS manages its sensors differently, you can surely turn off the
power to the sensors one phase early, but that is risky in my opinion,
since your duty cycle for charging the sensors is now approaching 50%,
which doesn't seem like enough to guarantee a full charge between sensor
readings, especially if e.g. you are reading a light sensor and the light
source is really bright, which causes the internal capacitor to drain
quickly.  In contrast, the duty cycle used by the ROM is something like
97%, which I am almost certain charges the capacitor fully.

I've tracked down my problem and I've written a small program to check the
values read with light sensor attached to port 2 in a very past loop. I'm
quite sure that anyone that is using legos 0.2.x will get same noise values
using this prg.

To solve (?) the problem, I've also made some modification in the ISR
routine for sensors in legOS 0.2.4. I've noted that with a 32 clock states
of delay I can get a noise down to 2 (raw) instead of 10 times the same
value of noise without the delay (24 to 36 raw)...

Please, can someone tell me if I'm right if I think that this delay is the
key for the solution? Is there anyone that is getting same noise problems
reading active sensors?

Note that I can post here my patch for dsensor.c and the "test" prg if
someone is interested...

I can also send the files in attach via E-Mail if someone like to test them.

Thanks for reading,

    Paolo.

---
No analogy serves. There is nothing "like" the net. (Doktor DynaSoar
Iridium)



1 Message 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