PDA

View Full Version : MaxSonar EZ1 range sensor with Phidgets 8/8/8 Interface Kit



Dave
01-24-2007, 02:58 PM
I’ve been playing around with the EZ1 and the 8/8/8 interface board for the past few days, and I’ve made a few promising discoveries. First off, the sensor works fine if you just connect the 5V, ground, and analog pins to one of the 8/8/8’s analog input connectors. When the sensor’s serial lines are not in use, the sensor goes into a continuous run mode where it senses the range every 49 ms and outputs a continuous analog signal representing the distance as 10 mV per inch. This works great if you’re only using one sensor.

Multiple sensors ranging simultaneously will suffer from cross-talk (even if they’re pointing in different directions, sometimes. It’s all in the acoustics of the area you’re working in), so the sensors have to be pulsed on and off in sequence so that only one is running at a time. To do this, I cut the sensor’s 5V input wire and connected it to one of the digital outputs on the 8/8/8. By switching the outputs on and off, you can activate the sensors individually.

The only issue with this method is that the sensor calibrates itself during its first read cycle when it’s powered on. The spec sheet for the EZ1 states that if there is an object within fourteen inches of the sensor during calibration, the sensor may give erroneous range readings for short distances. When the sensor is allowed to calibrate properly, it will measure accurately down to about 6” and output the same value for distances of less than 6”. Here are the typical results I got from testing 3 sensors:

Obstruction greater than 8” away during calibration:
*Everything works fine.

Obstruction at 8” or closer during calibration:
*Sensor will sometimes glitch and read a much higher distance at this point.
*Sensor will sometimes output a noisy signal when detecting an object less than 8” from sensor.
*Measurements are accurate for objects more than 8” away.

In other words, 8 seems to be the magic number. When you calibrate with an object closer than 8”, the output gets worse for close range, but remains accurate for objects farther than 8”.

Another problem with the EZ1 is that I couldn't get it to detect anything beyond about 6 to 8 feet away, as opposed to the 6 meters that the spec sheet claims. Despite these shortcomings, I still think that this is a good sensor. It has a pretty narrow field of view, is simple to set up, and is very accurate (1" precision) as long as you stay in the 8 inch to 6 foot range.

Having said all that, I should also add that MaxSonar has just released a new revision of this sensor. The only difference I know of, until I get one in my hands to test out, is that you can power the new model with anything from 2.5V to 5V, instead of just 5V.

wmccafferty
01-25-2007, 12:26 AM
Dave,

Attaching the 5V input to the digital output to modulate on/off was clever, to say the least. I've been debating which sensor/controller route I should take, but with this idea from you, I've gone ahead and ordered an 8/8/8 board along with a 5-pack of the latest LV-MaxSonar-EZ1 sensors...can't wait to try it all out with MS Robotics Studio. I'll keep ya posted. If it works out well, I'll next try extending it to 16 concurrently queried sensors. (The idea being to get up to 24 sensors to be used in conjunction with iRobot's Create for an implementation of SLAM.)

Billy

feral
01-28-2007, 07:40 PM
<p>Is the SRF05 as easy to hook up? Anyone have a diagram ?</p>
<p>&nbsp;</p>
<p>thanks <img src="http://forums.trossenrobotics.com/images/smilies/robot/16x16_robot-wink.gif" border="0" alt="" title="Robot Wink" smilieid="19" class="inlineimg" /></p>
________
herbalaire (http://vaporizers.net/herbalaire-vaporizer)

Matt
01-29-2007, 11:37 AM
Hey Feral,

[EDIT] - Whoops, I was answering for the wrong sensor. I should read closer. I'll leave this info up anyhow for those who are interested in the EZ! I don't know about the SRF05, I'll let someone else take that.

Here is more info for you and everyone else on the EZ1 :)

Attached are two pics of how we made mounts for the EZ1's
We used a lynxmotion sensor bracket:
http://www.trossenrobotics.com/store/p/3263-Servo-IR-Sensor-Bracket.aspx

A medium perf board cut in half:
http://www.trossenrobotics.com/store/p/3518-Medium-Solderable-Perf-Board.aspx

And an analog sensor board jack:
http://www.trossenrobotics.com/store/p/3464-Board-Mounting-Analog-Jack.aspx




Also, here is a picture which shows the analog input wiring for the Phidget devices:
http://www.trossenrobotics.com/images/forums/AnalogWireEnd.jpg


Cheers,

Dave
01-29-2007, 12:46 PM
The SRF05 isn't that simple, since it has no analog output. To opperate the SRF05, you manually trigger the sonar pulse and measure the time until the sensor reports that it's received the return pulse. You won't have any luck with the SRF10, either. That one only has a serial (I2C) interface.

edit: And now, a little light reading. Here are some spec sheets if you want to take a look at the pinouts and interface methods for the various sensors I've mentioned.

SRF05 (http://www.trossenrobotics.com/images/productdownloads/SRF05_Sonar.pdf)

SRF10 (http://www.trossenrobotics.com/images/productdownloads/SRF10_Sonar.pdf)

EZ1 (http://www.trossenrobotics.com/images/productdownloads/MaxSonar-EZ1-Datasheet.pdf)

LV-EZ1 (http://www.trossenrobotics.com/images/productdownloads/LV-MaxSonar-EZ1-Datasheet.pdf)

The LV-EZ1 is the new guy. The only difference between it and the old-fashioned EZ1 is the flexible input voltage range.

wmccafferty
01-29-2007, 01:53 PM
I recieved my LV-MaxSonar-EZ1s today and was utterly blown away by how small they are (even after seeing pictures of them sitting on a quarter). Anyway, the documentation talks about reading multiple EZ1s with "only two pins from your micro controller, a diode for each sensor, and one resistor." (See answer to 6D at http://www.maxbotix.com/MaxSonar-EZ1__FAQ.html.) So my question is, can this technique be leveraged with the 8/8/8 board so that only one pair of input/output is used instead of one pairing for each sensor? Additionally, do you see this chaining technique causing cross-talk problems?

Thanks!
Billy

Matt
01-29-2007, 02:15 PM
Hey Billy,

It's an interesting thought, but if you are trying to control the firing of such sensors from a Phidget it isn't going to work. There is no way to control pulse time lengths from Phidgets in a manor like microcontrollers. Likewise, the inputs are not on par with micrcontroller speed and accuracy. This is one of the down sides to current PC based bridgeware, it's not quite real time in many cases and it lacks that razors edge accuracy which microcontrollers provide.

Toggling sensors on and off from code via the digital outputs while running a looping timer in cose is probably as fast and detailed as you will get. The only other thing I can think of is building a serial board by hand which can handle the timing aspects and interpret the results off the sensors. However, you are getting into pretty high end design at that point.

wmccafferty
01-29-2007, 02:24 PM
Yeah, being that I'm a software guy, that latter suggestion gives me the heebie-jeebies. ;) I'd guess you're probably right that coding control should be adequate. Since each sensor takes 1/50th of a second to complete a round-trip, I don't think chaining them will bring much benefit over using 8/8/8 boards. The only advantage would be having to use a bit less hardware (when considering the use of 16 sensors) but with the added cost of a lot more complexity.

Billy

Dave
01-29-2007, 02:50 PM
The chaining technique looks good, but like Matt said, it won't work through an 8/8/8 due to the input sampling rates being too low. It would be great if someone could make a USB interface board for reading multiple sonar sensors, though. Maybe this is something the good folks at Phidgets could look into in the future.

Matt
01-29-2007, 03:10 PM
That's a good thought proccess Billy. Sometimes we have to pause and ask ourselves if it's really worth the cost in time and effort for some of the things we want. God knows I've been there a hundred times. Having an extra board for less than X dollars can be the smart move in the long run. I've also learned a lesson about getting too married to hardware. Currently this market is so mercurial and fast that new solutions are popping up all the time. We have scrapped hardware two and three times during a single project because new technology arrives so fast. Best to concentrate on software theory and design while letting the hardware continually improve benieth it. (PS, if you haven't yet, please check out the TRS here (http://www.trossenrobotics.com/tutorials/TRS1.aspx))

>>>It would be great if someone could make a USB interface board for reading multiple sonar sensors, though

This has been on my wish list for years. I wish Phidgets or someone would make a USB board which can handle 8 sonic sensors and handle the timing issues at the microproccessor level while allowing people to queary the board at the code level for the data. I think it's only a matter of time until someone makes this given how fast the market is starting to catch on to the PC based robotics idea.

On a side note, Robotics Connection has their Serializer board which can handle many advanced sensors and has a .net API. We should be carrying his boards soon.
http://www.roboticsconnection.com/pc-16-5-serializer-net-robot-controller.aspx

feral
01-29-2007, 04:13 PM
<p>Any chance of being able to return my unused SRF05, purchased last week, and pay the difference for one of these? Its more what I'm looking for.... I'll email jen..</p>
________
volcano vaporizer (http://vaporizer.org/)

Matt
01-29-2007, 04:24 PM
Yes, Feral, no problem. I'll let Jen know.

wmccafferty
01-29-2007, 08:03 PM
I asked MaxBotix about their opinion of chaining with Phidgets and they responded with the following...

-- First chain the sensors, then you only command the first sensor to read. The next sensors follow in sequence. If you are using the analog outputs just connect each sensor to one AD converter. You run out of analog inputs after 8... You could try to power the sensors with a 3906 and a 3904 for each sensor, and turn on the sensors in two banks, using two digital lines for each bank. (these transistors are less than $0.10 each) but it would take a little work on your part. The con to this method might not allow the calibration cycle to run.
If all of the sensors point in the same direction, crosstalk could be an issue with the original MaxSonar-EZ1. Most users do not point the sensors in the same direction, so crosstalk is minimal. Even so,we have the new product, the LV-MaxSonar-EZ1 that sends serial information at the end of the 49mS cycle so the LV-MaxSonar-EZ1 will not have crosstalk. --

That's nice to see that there's supposed to be no crosstalk with new LV EZ1s...that's quite an enhancement. But, since each sensor will still need a separate analog input, it looks like chaining really doesn't save anything other than having to manually control the on/off of separate sensors.

Billy

Matt
01-30-2007, 11:27 AM
>>>then you only command the first sensor to read
How is this done? Can it be from a digital output off the 8/8/8?


>>>It looks like chaining really doesn't save anything other than having to manually control the on/off of separate sensors.

Actually, I give that some decent value. It reduces the work in code quite a lot in terms of controlling the timing. Instead of having to cycle through them manually, you could then just fire once per cycle and have them report in. I like it. I do worry about the ability of the system to keep up with the fast reporting however. Will the Phidget or the non-real time OS fumble the reporting? It would be okay to have it fumble a certain %. If you are firing the cycle once a second you could stand to lose a few signals here and there and still have enough data to operate smoothly.

As far as powering, wouldn't you just power each sensor from the +5 on each analog port? Aren't you just leaving them powered on?

If you have to use 16 sensors you would just use two 8/8/8 boards and fire them every other second toggling back and forth. Pretty elegant solution. Daisy Chaining also saves you a pile of digital outputs.

I'd love to hear your results if you try this daisy chaining out.

wmccafferty
01-30-2007, 12:46 PM
I'm scheduled to be getting the rest of the needed equipment (from you guys) over today and tomorrow...so I'll post a full analysis when available. My hope is to daisy chain as that will result in the fastest possible switching times. We'll see...will keep ya posted!

Ultimately, I am attempting to query 16 LV-MaxSonar-EZ1 sensors (
http://www.maxbotix.com/uploads/LV-MaxSonar-EZ1-Datasheet.pdf (http://www.maxbotix.com/uploads/LV-MaxSonar-EZ1-Datasheet.pdf)) using the iRobot (http://www.roombareview.com/cgi-bin/jump/jump.cgi?67) Create's Command Module. I know that I would be able to do this, alternatively, using two Phidgets 8/8/8 IO boards (http://www.phidgets.com/documentation/1013.pdf) by wiring each EZ1 +5 activation connection to a digital output and the EZ1's analog output to the analog input on the 8/8/8 board. But what I'd like to do is daisy chain the LV-MaxSonar-EZ1 sensors directly to an ePort of the Command Module. I've been discussing this with the makers of this sensor and believe it may be possible.

The EZ1 creators stated that you can chain the activation of the sonar senors so that they each fire in succession. Each later sensor fires when the previous sensor completes firing. Then, the serial output from each sensor, wired to the command module, includes serial information at the end of each 49ms cycle identifying which sensor the data came from. Here's the caveat...you can chain the serial output to one input on the command module if the following doesn't create problems: the sensors communicate in 9600 baud and the receiving uC/microcontroller ePort needs to accept TTL with one 2N3904 or 2N2222 to invert the signal.

I very much would like to try chaining the 16 sensors from one Command Module ePort but am not sure if it's technically possible. Do you believe it is possible based on the information I've provided? Any insight you can provide in implementing this setup would be greatly appreciated. Additionally, please let me know if you need further information to assist in providing a suggestion.

Thank you!!
Billy McCafferty

Dave
01-31-2007, 02:37 PM
I think the daisy-chaining method requires that you read from the PPM output, because the Tx line is used to trigger the next sensor in the chain. Any idea what the sample rates are for the Create's inputs?

wmccafferty
01-31-2007, 03:09 PM
That I'm not sure about...I'm quite bad about interpreting hardware specification manuals. If you'd like to take a look, the iRobot Create Open Interface Specification and iRobot Command Module Owner's Manual can both be found at http://www.irobot.com/sp.cfm?pageid=294.

I've decided to go with two, 8/8/8s instead of worrying about using the iRobt Command Module as a middle-man. I think it'll greatly simplify things to take this approach, instead.

I'm wondering if the answer to question 6D within http://www.maxbotix.com/MaxSonar-EZ1__FAQ.html is just one possible configuration among others. According to the documentation, it seems that the pulse width output from the sonar sensor was originally provided for compatibility reasons with other sensors such as the Parallax Ping or Daventech SRF04. (See answer
to question 5C within the FAQ.) This makes me wonder if the RX/TX lines can be used as the FAQ-6D describes, but then to put a wire, instead, from each AN output to a separate analog input on the 8/8/8 board. Then each GND would go to the respective GND on the 8/8/8 as well. FAQ-6D describes getting all sensor results from a single line. But if we don't care about getting all the results on a single line, and are OK with getting a separate result on separate 8/8/8 analog inputs, then perhaps we can forgo having to add a pull-down resistor and extra diodes, which only serve to keep the single-line of results in order.

Thoughts, rebuttals, concerns?

Billy

PS - It looks like the remainder of the equipment needed to start testing this out has arrived...can't wait to get home to start breakin' stuff! ;)

Matt
01-31-2007, 08:23 PM
Hey Billy,

First off, I've been meaning to ask you:
Are you mounting a miniPC onto the create? You want to use the 8/8/8's, but I haven't heard mention of a PC yet which is what Phidgets work with of course. So to get a high level understanding of where you are going with the project can you tell us what you are putting together in total? This will help us architect with you.

I looked at the Maxbotic FAQ 6d that you pointed to and I think the questions still all boil down to whether or not an 8/8/8 analog input can keep up with the signals being generated (along with your chosen processor and OS). A quick FYI: The Phidget analog and digital inputs operate at about 125kHz.

What you need to do is hook up a few sonar sensors as shown in the diagram and attempt to fire them. You will have to write a quick data logger in your language of choice. (Use the IFK example project from the phidget examples.zip file) I suggest throwing a textbox on the form and inside the onSensorChange event every time it reports write a line in the textbox reporting it's value. Then ping the 1st sensor and let the data stream back. Once you have a data set copy it into a column in an excel spreadsheet and use the graph wizard to quickly graph it. If it's working you will get a graph showing the hills and valleys of each sensor firing in turn. (you may also want to use timestamps for a more accurate graph.)

You may want to hook up just one sensor using the regular analog method first and build your data logger and play around with excel until you think you have it all working right, then move up to the daisy chaining. That's what I would do.

The data logging app will tell us whether or not the analog input can keep up with the sensor speed. If the data is too fast you would probably see a bumpy stream of data where you can't tell which sensor is #1,2,3 etc. The only way this will work is if you can discern which hill is which sensor. If you get a set of hills with a clear pause in between them your next step is to write a function which can break them apart and find the peak then report it to your application.

Sounds like you are on the right investigative path so far. Researching all the options in the hardware and comparing it against what is possible to do with the Phidget analog and digital I/O's. This is how we have worked through many different projects for PC based robotics. I think what you are proposing is possible. To recap I see the following items as your list to accomplish:
1) Be able to fire the daisy chain from the Phidget digital output
2) Be able to read in the data stream fast enough
3) Be able to break apart the signal into individual sensor reports

Another note: All the grounds on the 8/8/8 are the same. You only need to attach to one ground on any of the analog inputs or the shared digital output ground terminal blocks.

If all this fails you still have your option of wiring the sensors 1 to 1 to the analog inputs using the digital outputs to fire them. We already know this works. Then you merely have to write a function to cycle through them in code which is easy enough to do.

Keep plugging away. Many people are going to benefit from your research on this!

Matt
01-31-2007, 08:28 PM
On a side note, I just saw this in the Maxbotic FAQ under 6e:

6e) A User has designed a circuit that Controls/Reads up to 12 MaxSonar®-EZ1™ sensors.
This user wanted to run many sensors off the same RS232 port with added features.
The link below shows how this was done, and includes full details.
www.rgbled.org/maxbotix/index.html (http://www.rgbled.org/maxbotix/index.html)

forum link to same project (http://www.rgbled.org/forums/viewforum.php?f=3&sid=92307627e5a45180e136ef1f5e25ef3a)

This is an option that gives you serial port access to a string of sensors. I don't see where to buy the hardware kit yet, but I think he's working on it.

wmccafferty
02-01-2007, 10:46 AM
I recall seeing that when I first started considering my options but dismissed it when I saw I'd have to do some real circuitry. (I've always been purely a software guy and usually become awestruck when someone says "2N3904" and knows what they're talking about.) Ironically, I was up late last night with a breadboard in front of me bending EZ1s to my every command. So in hindsight, that might have been a promising, and economical, way to go. But alas, I've been having fun with the 8/8/8 and love how easy they are to programmatically interface with. I got my single-sonar setup successfully working last night and will tear into the multi-sonar setup this evening.

To answer your question concerning the use of a mini-PC... Let me first take a step back and explain all my dibolical plans. All the details can be found at: http://forums.trossenrobotics.com/showthread.php?p=3751. (I figured the description was far enough from the sonar converstation to warrant a new thread.)

Billy

wmccafferty
02-02-2007, 10:14 PM
Matt or Dave,

How did you fasten the EZ1 to the perf board as shown in http://forums.trossenrobotics.com/showpost.php?p=3693&postcount=4.

Thanks,
Billy

Matt
02-05-2007, 12:54 PM
If you grind up elf feet they are surprisingly sticky.

Actually, we didn't do any mounting beyond the soldering. That was enough to hold it in place so we left it alone. You could use double sided foam tape to make it more secure. We have used that on many other sensors in the past.

wmccafferty
02-05-2007, 01:54 PM
The ground elf feet kept causing shorts...I'll try the foam tape approach next.

Thanks for the tip!
Billy

Dave
02-15-2007, 03:57 PM
Eddy, from Wright Hobbies (http://www.wrighthobbies.net/catalog/index.php), sent us this schematic for serially triggering an array of EZ1's:

http://www.wrighthobbies.net/images/misc/linked-ez1.jpg

I like this design because it doesn't require pulse width measurement, like the circuit in the MaxSonar FAQ. Feed it a trigger pulse, and each sensor spews out its range measurement in turn. If you've got an RS232/TTL adaptor, you can send that data straight into your computer. [Edit: Output does not need to be inverted if you are sending it to a PC's serial port, so Q1 is unnecessary in this case. See Eddy Wright's post below.]

Visit Eddy's site. He's sells some cool stuff and seems like a pretty cool guy.

Matt
02-15-2007, 04:10 PM
Eddie does sell a TTL to RS232 converter :)
http://www.wrighthobbies.net/catalog/product_info.php?cPath=25&products_id=64

He says it's a great seller as well. We will probably carry it soon :P

wmccafferty
03-01-2007, 11:12 PM
Would Eddie's suggestion work with the 8/8/8? Furthermore, I'm finding that the sensors need from 3-5 range cycles to properly calibrate to give a reliable reading. Does Eddie's approach bypass the need to calibrate?

Thanks,
Billy

Dave
03-05-2007, 11:06 AM
Would Eddie's suggestion work with the 8/8/8?
Nope. You need something that will read RS232 serial data.


Furthermore, I'm finding that the sensors need from 3-5 range cycles to properly calibrate to give a reliable reading. Does Eddie's approach bypass the need to calibrate?
I haven't tried it yet, but if I'm reading the data sheet correctly, the sensor only calibrates when it's first powered on. Thus, controlling the sensor via the Rx line, while keeping the sensor powered on, should bypass calibration after the initial cycle.

wmccafferty
03-05-2007, 01:57 PM
Thanks for the clarification...both of your responses make sense.

Billy

wrighthobbies
03-06-2007, 09:11 AM
Hi Guys,

I updated the schematic above to include a pull down resistor on Q1's base. This will keep the base from floating when there's no serial data and should ensure a cleaner inversion of the signal through Q1. Q1 is required to invert the serial output so a microcontroller can receive it. Q1 is not needed if you are connecting it to a PC (still need R3 though).

Ryan Myrda had a good suggestion when stringing together many sonar sensors. You could trigger them in groups of 4 instead of triggering all 16. That would give you more control over which sonars you wanted active. This would require 4 I/O lines from a microcontroller but I think it would be a good approach. All 16 outputs can still be connected together as shown in the schematic.

Eddy Wright
Wright Hobbies Robotics
http://www.wrighthobbies.net

Dave
03-06-2007, 10:48 AM
Good call, Eddy. Thanks for the update.