Posted by James Hall on January 18, 2008 at 7:12pm
Could someone tell me why my ultrasound ranging is all over the place? I took data while I aimed it toward the carpet to simulate grass at a field. The return varies a lot. Is it the parallax ping sensor or do I need some sort of filter? The idea is to control hover below 3 meters altitude and hold it. Other suggestions are highly welcome! The vertical scale is in centimeters.
You need to be a member of diydrones to add comments!
I have spent about 2 hours on something that should take about 10 minutes. Tried to set up the ArduPilot board just with the PING)) sensor code below (not other codes loaded). Which digital pin can I use? I got zeros, and some inconsistent numbers here and there. I must be using the wrong digital pin. I got 5V and Gnd to the Ping from same supply as ArduPilot. Running the Ping singal to a digital pin on ArduPilot.
I tried to change in the code for pin 7 (D7?), 9 (servo 1 signal?), 10 (sevo 2 signal?). Can some one tell me which pin can I use and where that pin is on the ArduPilot board?
========================================
unsigned long echo = 0;
int ultraSoundSignal = 7; // Ultrasound signal pin
unsigned long ultrasoundValue = 0;
Havent worked with sonar yet but the elctronics supplier I use mostly (www.futurlec.com) sells optical (laser presumably) sensors that work with a range of up to 5.5m, this may be suitable for your project (and at $19.90 USD it is reasonably priced too)
I don't know too much about this but, I thought I would throw a couple of things out there that might give someone else an idea...
Could you use some sort of 'electronic tape measurer'? They are pretty cheap and would actually tell you how far from the ground you are. I think they also have different ways of sensing (sonar, ir).
I like the laser idea, but I would look into some sort of stereo setup. If you aim them precisely and cross the beams so they converge at a known height (1m) it should be relatively easy to compute distance based on how far the dots are from each other.
Also, it might be helpful to use two different color lasers. That way when you are at your known height, they are converged. If the aircraft goes below your known height the red laser would be on the left indicating you are too close to the ground, when you move above the known height the green dot would be the left indicating a safe distance from the ground.
The full story is on the Jack Crossfire blog. The answer is yes, if aggressively filtered in software, isolated from rotor wash, the Maxbotics EZ1 can sense altitude 1-2m off the ground.
If it's on the ground, too high, or it doesn't receive a reflection, the Maxbotics outputs a maximum altitude. Most of the time it just outputs a random glitch & it's up 2 U to detect it. On 5V, it simply doesn't generate enough sound pressure to cut through engine noise & reflect off grass.
The Maxbotics EZ4 might reject engine noise better, but we've played this game before. There's no such thing as a free lunch. It looks like it rejects noise but has shorter range.
Built a test stand to isolate it from rotor wash. Could not be calibrated properly like this, although we haven't seen much difference with the calibration. Sonar is not guiding altitude in the photos.
Had pretty awful results with the Maxbotics EZ1. It seems to not handle the noise & vibration of helicopter flight. In handheld tests, it probably glitches from multipath reflections in the confined apartment but results R much better. Maybe there's something we're missing.
A number of people (both companies and private individuals) have tested our sensor line up against many of the other low cost range sensors. The MaxSonar lineup (EZ0, EZ1, EZ2, EZ3, and EZ4) were all less effected by outside acustic noise such as would be found on an MUAV (or even wheelchairs). In addtion, some of the competing sensors have trouble with moving objects, or too wide a detection zone, all of which will contribute to errors. Check of the performance data section of the MaxBotix Inc., web site for more info.
We have tested the EZ0 and EZ1 with 45mph wind without any noise effects, and at 55mph some readings were affected, but it was still useable. The EZ2, EZ3 and EZ4 we would expect to have better noise immunity (more stable readings).
On our website we have not yet posted the results of the Ping))) sensor on our page. It does not pass the moving target test (a swinging tether ball about 7 inches in diameter). We have not yet posted this information as yet because we felt that the Ping))) sensor tried to narrow the beam and this resulted in poor detection of a moving object (or smaller objects), and they do a good job of showing how their sensor operates (again with real data). The MaxSonar line of sensors have a longer range and do a better job of handling noise.
When you consider the price of our sensor lineup together with the measured performance (we show you how we perform with real world measruements), and for about $25 to $29 (at most resellers), it is hard to beat the cost and performance.
Looks much better.
Do you think it will be accurate enough for autonomous landing?
How quickly does the sensor react to changes in altitude, considering
the averaging required?
Do you have any specs on the beam pattern ? 3 meters is actually a fairly long distance for sound off a surface with poor reflection characteristics. You might want to look at the Maxbotics ultrasonic sensors- they have different models with different beam patterns - the EZ0 has the widest beam, and EZ4 is narrowest (as I recall) - the narrower beam will probably give you more consistent results.
I have experimented with the EZ0 for exactly this application (control of hover height), and got pretty reasonable results. In any case, I would be using a software filter for averaging of measurements and triggering an alarm.
One additional note - you can use an accelerometer to detect changes in altitude with some accuracy - you might want to combine the accelerometer measurements with your sonar readings to help in validating the data.
Replies
I tried to change in the code for pin 7 (D7?), 9 (servo 1 signal?), 10 (sevo 2 signal?). Can some one tell me which pin can I use and where that pin is on the ArduPilot board?
========================================
unsigned long echo = 0;
int ultraSoundSignal = 7; // Ultrasound signal pin
unsigned long ultrasoundValue = 0;
void setup()
{
Serial.begin(9600);
pinMode(ultraSoundSignal,OUTPUT);
}
unsigned long ping(){
pinMode(ultraSoundSignal, OUTPUT); // Switch signalpin to output
digitalWrite(ultraSoundSignal, LOW); // Send low pulse
delayMicroseconds(2); // Wait for 2 microseconds
digitalWrite(ultraSoundSignal, HIGH); // Send high pulse
delayMicroseconds(5); // Wait for 5 microseconds
digitalWrite(ultraSoundSignal, LOW); // Holdoff
pinMode(ultraSoundSignal, INPUT); // Switch signalpin to input
digitalWrite(ultraSoundSignal, HIGH); // Turn on pullup resistor
echo = pulseIn(ultraSoundSignal, HIGH); //Listen for echo
ultrasoundValue = (echo / 58.138) * .39; //convert to CM then to inches
return ultrasoundValue;
}
void loop()
{
int x = 0;
x = ping();
Serial.println(x);
delay(250); //delay 1/4 seconds.
}
Havent worked with sonar yet but the elctronics supplier I use mostly (www.futurlec.com) sells optical (laser presumably) sensors that work with a range of up to 5.5m, this may be suitable for your project (and at $19.90 USD it is reasonably priced too)
http://www.futurlec.com/Distance_Sensors.shtml
Just a suggestion, hope that It may have been of some help
Bruce
Could you use some sort of 'electronic tape measurer'? They are pretty cheap and would actually tell you how far from the ground you are. I think they also have different ways of sensing (sonar, ir).
I like the laser idea, but I would look into some sort of stereo setup. If you aim them precisely and cross the beams so they converge at a known height (1m) it should be relatively easy to compute distance based on how far the dots are from each other.
Also, it might be helpful to use two different color lasers. That way when you are at your known height, they are converged. If the aircraft goes below your known height the red laser would be on the left indicating you are too close to the ground, when you move above the known height the green dot would be the left indicating a safe distance from the ground.
If it's on the ground, too high, or it doesn't receive a reflection, the Maxbotics outputs a maximum altitude. Most of the time it just outputs a random glitch & it's up 2 U to detect it. On 5V, it simply doesn't generate enough sound pressure to cut through engine noise & reflect off grass.
The Maxbotics EZ4 might reject engine noise better, but we've played this game before. There's no such thing as a free lunch. It looks like it rejects noise but has shorter range.
Built a test stand to isolate it from rotor wash. Could not be calibrated properly like this, although we haven't seen much difference with the calibration. Sonar is not guiding altitude in the photos.
sonar09.jpg
sonar11.jpg
sonar01.jpg
sonar02.jpg
We have tested the EZ0 and EZ1 with 45mph wind without any noise effects, and at 55mph some readings were affected, but it was still useable. The EZ2, EZ3 and EZ4 we would expect to have better noise immunity (more stable readings).
On our website we have not yet posted the results of the Ping))) sensor on our page. It does not pass the moving target test (a swinging tether ball about 7 inches in diameter). We have not yet posted this information as yet because we felt that the Ping))) sensor tried to narrow the beam and this resulted in poor detection of a moving object (or smaller objects), and they do a good job of showing how their sensor operates (again with real data). The MaxSonar line of sensors have a longer range and do a better job of handling noise.
When you consider the price of our sensor lineup together with the measured performance (we show you how we perform with real world measruements), and for about $25 to $29 (at most resellers), it is hard to beat the cost and performance.
Do you think it will be accurate enough for autonomous landing?
How quickly does the sensor react to changes in altitude, considering
the averaging required?
I have experimented with the EZ0 for exactly this application (control of hover height), and got pretty reasonable results. In any case, I would be using a software filter for averaging of measurements and triggering an alarm.
One additional note - you can use an accelerometer to detect changes in altitude with some accuracy - you might want to combine the accelerometer measurements with your sonar readings to help in validating the data.