Page 1 of 1

Sonar sensor disturbancies

Posted: 20 May 2011, 17:23
by ricardocrl
Hello all,

I've been experiencing some issues with the sonar sensor. It sometimes sense short distances when there is nothing in its front.

The scenario is the following: emmiter and receiver quite close to the table floor. Some other NXT's around using sonar sensor as well, but pointing to other directions, not agains the one I'm using.

I'm guessing the lights (fluorescent) can be messing with the sensor by the reflection occured near the table's floor. Can it be the problem? Could there be any programming way to calibrate/overcome somehow this situation, like configuring signal frequences (just blind shot :-).

Another question. Would EOPD HiTechnic sensor be a more robust solution?

/Ricardo

Re: Sonar sensor disturbancies

Posted: 20 May 2011, 19:54
by mattallen37
What kind of other sensors are you using? If you are using two ultrasonic sensors near each other, you should most definitely use them in single-shot mode so they don't mess up the readings of each other.

Light should have absolutely no effect on the ultrasonic sensor. The only way for a fluorescent light to have any effect, would be it the light was making noise (like the transformer running at the frequency of the ultrasonic sensor).

An EOPD is supposed to be fairly good in a situation without controlled lighting, but it will be a lot more likely to give problems due to light than an ultrasonic sensor.

Re: Sonar sensor disturbancies

Posted: 20 May 2011, 20:41
by ricardocrl
I have just one sensor alone in a robot, but I'm using several robots with the same sensor configuration in the surroundings. What do you mean by single-shot mode? Is there any options to control it with NXC? I thought there was only a single way to run it.

Then, the lights shouldn't be a problem, because they are not even close to the sensors (more than 5 meters distance, in the ceil).

Re: Sonar sensor disturbancies

Posted: 20 May 2011, 22:00
by mattallen37
If you have any other Lego ultrasonic sensors within the area, they will most likely cause an error in the read value.

Single-shot mode is a way that you can control when the ultrasonic sensor "makes noise". It sends a single burst of sound, and waits for it to return. It only does it once per command, instead of constantly. So if you have a robot with 4 ultrasonic sensors, you can read them all in single-shot mode, one at a time. That way they won't hear each other and get confused.

I don't think the functions have been implemented by John, so you probably can't use a fancy API for it. However, you can "tell" the sensor to use single-shot mode by issuing an I2C write. All the register info is in the hardware dev kit you can download from the mindstorms website (the name of the PDF you want, has something to do with ultrasonic I2C protocol).

Re: Sonar sensor disturbancies

Posted: 21 May 2011, 07:14
by HaWe
I can copy the issue with US sensor noise.
This is why I always use a median filter (of 3) to filter out the low or high peaks.

Re: Sonar sensor disturbancies

Posted: 21 May 2011, 16:37
by ricardocrl
Hm, good solutions, both the filter and single shot.

The filter is straight forward, but still uncertain (a little) that it can succeed.

Regarding the single-shot, I got your point. I will check the documentation. The interesting thing is that I was thinking that I was using single shot, because I only check the sensor every 500ms. But the truth is that the distance is asked and read from a register, and not actually read by the hardware at that time.

Nice tips. ;) Thanks!

Re: Sonar sensor disturbancies

Posted: 23 May 2011, 19:48
by linusa
The EOPD is pulsed, so ambient light shouldn't be a problem. However, the range of the EOPD is very limited, roughly about 10 to 20cm...