PDA

View Full Version : [Question(s)] Maxbotix Sonar in a Ring.



Connor
12-27-2008, 11:58 PM
I just finished installing my Sonars in my bot. I've hooked everything up according to this document.

http://www.maxbotix.com/uploads/Chaining_Application_Notes__AN_Output_Constantly_L ooping_.pdf

My Problem is, I have to hold the RX pin HIGH continually to get the sonars to work.. Not to mention, I'm getting interferance from the other ones... After re-reading the document, I noticed it said return the RX to a "high impedance state".. I'm not sure I can do this, as I have it hooked up to a digitial I/O port on my Phidget 8/8/8. So my question is, how can I fix this? I can remove the loop, and just pulse the ring everytime I want a reading.. But, I was hoping to not have to do that.

Thanks, Connor

robologist
12-28-2008, 04:45 AM
Digital I/O pins can usually be made to go into 3 states : either high, or low, or "hi-z". That high impedance state should be achieved by simply turning the pin into an input, rather than having it output a high or low. I'm unfamiliar with the Phidgets configuration, but there should be some way of changing the direction of the pin from output to input, perhaps something even as simple as checking the pin.

4mem8
12-28-2008, 04:55 AM
You can use an inverter from your 8/8/8 output like a cmos 4069 inverter or a TTL 7414 schmitt trigger inverter or a TTL 7404 inverter. Also you should be able to change it in the software, I think.

As for you interference you can use a 0.1 - 0.15 ceramic capacitor across the + and - terminals on your sonar devices.

Connor
12-28-2008, 01:37 PM
The other thing I'm noticing is, the voltage coming from the Phidgets 8/8/8 is suppose to be 5v, however, it's reading around 4.87, and if I max out the CPU on the computer, it drops to 4.82.. This can cuase a very unstable reading on the distance.. I would think that the USB buss would be a steady 5v with the little bit of equipment I have on it. Maybe I need to make a independent 5v source and feed the phidgets directly with it instead of letting it leach from the USB.

Thanks, Connor

jes1510
12-28-2008, 01:53 PM
What is your main battery power supply doing? If it drops below the regulators minimum threshold then it will cause the 5v rail to dip. How many devices do you have plugged up to USB power? I believe the USB spec specifies a maximum of 100mA per device.

Adrenalynn
12-28-2008, 02:36 PM
Your error is well within specification for USB2.0.

The spec calls for the voltage to be no more than 5.25v and no less than 4.75v (A +/-5% tolerance)

Yes, a unit load is 100mA in USB2 (150mA in USB3...)

A low-power device can't draw more than 1 unit load, and must support a minimum operating voltage of 4.4v in USB 2 (4v in USB 3)

A device may request more than 1 unit load, but the bus doesn't have to provide it. Powered hubs can provide up to 1.5A when communicating at either low or full speed, and 900mA at high-speed.

[Sorry - designed waaay too many USB devices...;)]

lnxfergy
12-28-2008, 03:44 PM
The other thing I'm noticing is, the voltage coming from the Phidgets 8/8/8 is suppose to be 5v, however, it's reading around 4.87, and if I max out the CPU on the computer, it drops to 4.82.. This can cuase a very unstable reading on the distance.. I would think that the USB buss would be a steady 5v with the little bit of equipment I have on it. Maybe I need to make a independent 5v source and feed the phidgets directly with it instead of letting it leach from the USB.

Thanks, Connor

An independent 5V source is probably a good idea, just cause you are likely to exceed 100mA someday. However, 0.05V is a very small error (4.87 to 4.82) - and shouldn't cause "unstable reading" on the distance, what are you considering to be "unstable" ?

-Fergs

jes1510
12-28-2008, 07:16 PM
If you go for an external source make sure that you tie a common ground between the two power supplies

Connor
12-28-2008, 07:41 PM
I'm running the Camera, Speakers, USB-to-TTL converter and the phidgets 8/8/8.. As for the inaccuracy of the distance measurement. The formula is.. (AnalogValue * .005) / (Voltage/512) I've had to adjust the voltage from what I read on the meter which is around 4.87.. down to 4.68 or so to get the correct distance.. and the 4.87 isn't always steady, it varies from 4.88 down to 4.82.. I've never used any of this, so I didn't know if it was normal or not.

Thanks, Connor

Adrenalynn
12-28-2008, 08:52 PM
If it drops down under 4v, you have a problem. Otherwise, you either need external power (as Jes suggested), or you need to kick whoever designed the hardware to run off of USB power but designed it out of spec against USB. Is there a USB logo on the devices?

lnxfergy
12-28-2008, 10:12 PM
I'm running the Camera, Speakers, USB-to-TTL converter and the phidgets 8/8/8.. As for the inaccuracy of the distance measurement. The formula is.. (AnalogValue * .005) / (Voltage/512) I've had to adjust the voltage from what I read on the meter which is around 4.87.. down to 4.68 or so to get the correct distance.. and the 4.87 isn't always steady, it varies from 4.88 down to 4.82.. I've never used any of this, so I didn't know if it was normal or not.

Thanks, Connor

I'm not so worried about your voltage accuracy - like I said, 0.04 or 0.2V is not huge...

Further, if you look at how the Sonar sensor works it puts out a voltage of V/512 for each inch of distance. And then your phidgets gives you 1...1000 for the AnalogValue it detects. But this AnalogValue is a scaled number 1=0V, 1000=Voltage! Since the Phidgets and the Sonar have the same Reference Voltage for each, the actual value of the Reference Voltage is irrelevant (be it 4.86, 4.5, 4, or whatever). Your reading in inches is simply (512/1000) * READING (or as you called it, AnalogValue).

Have you actually run this yet though? I have a feeling that the Sonar values returned (when the robot is parked) shouldn't vary too much. Plus or minus 2-4 inches over the full range is likely well within any absolute tolerance you could hope for - your mapping, if well designed, should make up for this.

-Fergs

Adrenalynn
12-28-2008, 11:58 PM
As should your mounting on the 'bot.

OH - that's another thing to mention - how close are you trying to read? Don't forget that it's a cone. Too close and the measurements go ape-poo. So you should always inset the sensors by the minimum depth from the datasheet. For example - it may not detect closer than a few inches or even half a foot. So you bury it a half foot deep into the bot.

Connor
12-29-2008, 12:11 AM
These are Maxbotix sensors, so, they register 6" for anything closer than 6.. The sonar in the front is the one that's always erratic. The one in the rear, and one's too the left and right (pointed forward also) read pretty steady.. I thought it was interferance from the other sonars, but that's not suppose to be possible with chaning them the way I have. I even moved the input voltage over to a Digital I/O so I can turn the whole sensor array on/off to calibrate it when there is nothing close by.. It's gotten really strange.. Reading 52 inches, then jumping up to 120, then 80 then back to 52 for a few ticks.. I've swapped out the inputs on the Phidget and it follows the sensor, so the Phidget is working fine. I'm going to hook it back up to a 5v supply and see what happens...

lnxfergy
12-29-2008, 12:55 AM
Connor,

I know you mentioned this earlier, but have you actually tried removing the loopback (the 1K resistor and connection from last TX to first RX)? I'm just wondering if your Phidgets aren't going Hi-Z correctly, and maybe the pulse is getting messed up. It's not a fix, but it might help track down the problem (or at least eliminate one possible culprit)

-Fergs

Connor
12-29-2008, 01:15 AM
I know you mentioned this earlier, but have you actually tried removing the loopback (the 1K resistor and connection from last TX to first RX)? I'm just wondering if your Phidgets aren't going Hi-Z correctly, and maybe the pulse is getting messed up. It's not a fix, but it might help track down the problem (or at least eliminate one possible culprit)


Yes, That is now out of the loop, infact, it's no longer a loop, it's juat a chain. :happy: I'm now looping every .3 seconds, each time, sending a .1 second pulse to the command control loop. I've now reverted back to 5v vs the logic output from the phidgets 8/8/8 to power the EZ1's (looks like the logic output was around 3.2v).. This looks to be more stable at this point, however, this limits my ability to "restart" the sonars to calibrate them via code. I have to manually remove the power from them. Maybe I'm expecting too much from these things, just how accurate are sonars suppose to be? I would think within 1 inch..

Now, Slightly different topic.. How many American's use metric vs imperial ? I have a very hard time using metric, as, I think in inches, feet etc.. I have to "convert" in my head.. which is hard to do on the fly, it's very frustrating. The reason I ask is, the iRobot Create is setup in mm/s for movement.. which I had to convert to inch/s.. I'm just wondering if I need to stick to imperial, or switch to metric for everything.

Thanks, Connor

Adrenalynn
12-29-2008, 01:58 AM
I'm ambimeasurement. I switch back and forth depending on what I'm doing and the audience. I do tend to favor metric, especially for precision measurements. Figuring out 1/6 of an inch on a ruler is a lot more painful than figuring out 4 and a quarter mm... Frequently for me, it'd be like "4 and a smidge mm" which is more accurate than "a bit less than a quarter inch" when it's 0.167...

Connor
12-29-2008, 02:19 AM
OKay, what kind of enviornment should I be testing this in? I'm starting to think the sonar may be picking up multipath from it's own pulse.. Looks like it happens more often on further away targets. I'm testing it in my office on my desk.. all kinds of things in the room it could be reflecting from..


I'm ambimeasurement. I switch back and forth depending on what I'm doing and the audience. I do tend to favor metric, especially for precision measurements. Figuring out 1/6 of an inch on a ruler is a lot more painful than figuring out 4 and a quarter mm... Frequently for me, it'd be like "4 and a smidge mm" which is more accurate than "a bit less than a quarter inch" when it's 0.167...

Blah, I hate you! ;) Hehe...

Thanks, Connor

jes1510
12-29-2008, 07:58 AM
Sonar can be funny stuff. A small room can cause reflections all over the place. An object setting at an obtuse angle to the sensor can cause the sound to reflect away from the sensor and off into never never land. Or a small bump on the floor can be picked up as an object. I was playing with those exact modules on another robot and a seam in a concrete floor was detected as an object.

Also if I remember correctly the maxbotics units have a minumum distance that should be clear on power up. Make sure you follow that rule otherwise it throws all of the readings out of whack.

Finally make sure that your robot doesn't rely on any one sensor for navigation. It works fine for a small robot like my Darwin but for a machine the size of Argos make sure you are comparing several sensors to get a true reading (Ir, vision, sonar, etc) of what is going on in the outside world.

lnxfergy
12-29-2008, 09:32 AM
Yes, That is now out of the loop, infact, it's no longer a loop, it's juat a chain. :happy: I'm now looping every .3 seconds, each time, sending a .1 second pulse to the command control loop. I've now reverted back to 5v vs the logic output from the phidgets 8/8/8 to power the EZ1's (looks like the logic output was around 3.2v).. This looks to be more stable at this point, however, this limits my ability to "restart" the sonars to calibrate them via code. I have to manually remove the power from them. Maybe I'm expecting too much from these things, just how accurate are sonars suppose to be? I would think within 1 inch..

We have to remember that there is ACCURACY and RESOLUTION - the Maxbotix units have a RESOLUTION of 1 inch (since they have a digital processor that converts inches into analog.) - which means that they are always rounding to the nearest inch. However, the ACCURACY - how how close the measurement is to the REAL WORLD, is likely much worse - I would say 2-4 inches, the error will typically be lower on shorter measurements, but higher on longer ones.

Then there is the whole issue of REPEATABILITY. If the device has a low REPEATABILITY, then for two consecutive readings, even when the robot is not moving and the object is not moving, the difference could swing up to 8 inches (given the estimate of 2-4 inches accuracy). Really, the idea of REPEATABILITY is whether the error which is causing the low accuracy is random or is frequently constant. In the case of the sonar units, the items which cause the most error - air temp, humidity, angle to the object, object size - are all staying fairly constant, so the repeatability should be high.

Also, as jes said, the object shape can play a role.... And yeah, multiple spectrums of sensory are good for any bot, but especially larger ones. Just imagine entering a room with walls lined with sound absorbing material - sonars are gonna crap out fast....

-Fergs