Go to Post I personally hope they change the terrain of the playing field ... if only to "level" the playing field. - Daniel_LaFleur [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-05-2008, 00:40
eagleslg eagleslg is offline
Registered User
FRC #1047
 
Join Date: Apr 2008
Location: Cali
Posts: 12
eagleslg is an unknown quantity at this point
Sonar Sensor help

Hey guys,
I am attempting to connect a MaxBotics EZ0 Sonar sensor http://www.sparkfun.com/commerce/pro...oducts_id=8502 to the 2008 FRC robot controller.
I have read through this post: http://www.chiefdelphi.com/forums/sh...ght=mike+sonar
and have attempted to use Mike's code to get data from my EZ0 sensor.
The code that Mike posted was designed for Parallax Inc. PING)) Ultrasonic Rangefinder and the Vex Robotics Ultrasonic Range Finder,
but is it possible to use the code with the MaxBotics sensor?
are there any other ways to get a signal from this sensor?
Any help i can get with this sensor is highly appreciated, from getting signal to general operation tips, because i am new to Sonar.
thank you in advance
  #2   Spotlight this post!  
Unread 05-05-2008, 01:35
dtengineering's Avatar
dtengineering dtengineering is offline
Teaching Teachers to Teach Tech
AKA: Jason Brett
no team (British Columbia FRC teams)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Vancouver, BC
Posts: 1,830
dtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond repute
Re: Sonar Sensor help

The Maxbotics Sonars are great... and easy to work with, too. Probably the easiest out there to interface to the IFI controller, in fact. We have used them the past two years.

The simplest way to connect them is using the analog signal. If you look at the datasheet (find the link at the bottom of the page you referenced) you will see that there is an "AN" pin that gives you an analog output of the last measured range. If you hook up your +5, GND and AN (take a servo cable, cut one end off, and solder it to the appropriate points on the sonar, then plug it into the RC's analog I/O) then all you need to do is read the analog value of the appropriate pin whenever you need a distance measurement. (Page 16 of this document discusses reading the analog inputs.)

You might want to use a printf routine to show you the values that you get at different ranges.

There are more complex ways to use these sonars, too... but this should get you up and running.

Jason
  #3   Spotlight this post!  
Unread 05-05-2008, 11:26
gunsanbob gunsanbob is offline
spartanrobots
no team
 
Join Date: Apr 2008
Rookie Year: 2005
Location: Lansing
Posts: 18
gunsanbob is an unknown quantity at this point
Re: Sonar Sensor help

i would rather use the lego mindstorms ultrasonic sensor

which much easier to program

Here is the link http://mindstorms.lego.com/Products/...%20Sensor.aspx

Just have look at the other sensor and give me reply if they can be used with the FRC robots
  #4   Spotlight this post!  
Unread 05-05-2008, 12:21
dtengineering's Avatar
dtengineering dtengineering is offline
Teaching Teachers to Teach Tech
AKA: Jason Brett
no team (British Columbia FRC teams)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Vancouver, BC
Posts: 1,830
dtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond repute
Re: Sonar Sensor help

Quote:
Originally Posted by gunsanbob View Post
i would rather use the lego mindstorms ultrasonic sensor

which much easier to program

Here is the link http://mindstorms.lego.com/Products/...%20Sensor.aspx

Just have look at the other sensor and give me reply if they can be used with the FRC robots
First off, pretty much ANY sensor can be made to work with any processor. The question is how much effort is involved.

The lego minstorms sensor is specifically designed to work with the LEGO platform, so when you refer to it being "easier to program" are you referring to it being easy to program on the NXT or on the IFI Robot Controller? It is certainly easy to program on the NXT because the NXT compiler contains code to interface with that specific sensor.

The Maxbotix sensor, however, is about the easiest sonar to interface to the IFI RC if you use the analog input (which is really, really easy to use... just one line of code!) This is that because rather than returning raw sensor data, the Maxbotix actually contains a PIC chip that processes the data and provides the information in a variety of formats suitable for a wide range of processors.

Jason
  #5   Spotlight this post!  
Unread 05-05-2008, 12:43
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,708
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: Sonar Sensor help

Quote:
Originally Posted by gunsanbob View Post
i would rather use the lego mindstorms ultrasonic sensor

which much easier to program

Here is the link http://mindstorms.lego.com/Products/...%20Sensor.aspx

Just have look at the other sensor and give me reply if they can be used with the FRC robots
As Jason said, pretty much anything can be made to work, but the LEGO NXT Ultrasonic sensor works off of I2C communications, as opposed to something simple like an analog output. So getting the LEGO NXT sensor to work on the IFI RC is going to be extremely difficult compared to the maxbotix. I2C is a whole communication protocol that you'd have to implement yourself on the RC using digital IOs. Think of it as akin to reading a speedometer by pressing a button to light up and individual segment/bar on a 7-segment LCD, versus looking at where the needle's pointing. You might get more accuracy if you do it the first way fast enough, but it'd be pretty painstaking.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
  #6   Spotlight this post!  
Unread 05-05-2008, 16:18
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Sonar Sensor help

As others have stated, the Parallax PING))) is just awesome. Here's a link to a place where I posted my driver for the PING))) sensor.

Only needs 1 pin/sensor, and have really narrow angle acceptance ranges (narrow beam) which is great for finding objects. Not to mention, the price isn't half bad either.

Oh, and if you don't mind my asking... what are you using this sensor for?

-q

p.s. If anyone is interested, I have code that will run four PING)))-type ultrasonic sensors at once (simultaneously/asynchronously) that just needs a little clean up to be post worthy. Just let me know.
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #7   Spotlight this post!  
Unread 05-05-2008, 17:51
eagleslg eagleslg is offline
Registered User
FRC #1047
 
Join Date: Apr 2008
Location: Cali
Posts: 12
eagleslg is an unknown quantity at this point
Re: Sonar Sensor help

oh, so it should just be one easy line..
im using kevin's code, so Get_Analog_Value does not exist,
im trying to get a value with Get_ADC_Result, but it still comes up as 0.
Should Get_ADC_Result work?

oh btw this sensor will be used for avoiding obstacles
  #8   Spotlight this post!  
Unread 05-05-2008, 18:03
eagleslg eagleslg is offline
Registered User
FRC #1047
 
Join Date: Apr 2008
Location: Cali
Posts: 12
eagleslg is an unknown quantity at this point
Re: Sonar Sensor help

aha, finally got data,
i didnt configure adc.h to read from 2 channels instead f just 1 (we have a gyro taking that one up)

a preliminary thing ijust noticed is when i put my finger right on the sensor, to represent something being really close to it, instead of 0 it read 52, how come?
  #9   Spotlight this post!  
Unread 05-05-2008, 18:19
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Sonar Sensor help

Quote:
Originally Posted by eagleslg View Post
aha, finally got data,
i didnt configure adc.h to read from 2 channels instead f just 1 (we have a gyro taking that one up)

a preliminary thing ijust noticed is when i put my finger right on the sensor, to represent something being really close to it, instead of 0 it read 52, how come?
The ultrasonic chirp may be coming back so fast the Maxbotix sensor misses the return echo.

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #10   Spotlight this post!  
Unread 05-05-2008, 21:14
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 7,011
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Sonar Sensor help

Quote:
Originally Posted by gunsanbob View Post
which much easier to program
Easier than a single line?
Quote:
Originally Posted by eagleslg View Post
oh, so it should just be one easy line..
im using kevin's code, so Get_Analog_Value does not exist,
So write your own. It is just a single line to get an analog value, same as getting the value of a potentiometer. The FRC conrtroller gives 10 bits (0-1023) so your answer is in 1/4 inch increments.
Quote:
Originally Posted by eagleslg
when i put my finger right on the sensor
Too close, try 2 or 3 inches minimum.
__________________

I am N2IRZ - What's your callsign?
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SONAR Sensor Software Driver MikeDubreuil Programming 55 08-03-2008 11:03
Sonar Function Issue Andrew Blair Programming 2 20-02-2007 13:39
Maxbotix Sonar Sensor DonRotolo Electrical 17 04-02-2007 12:27
VEX Sonar question Joohoo Programming 2 06-05-2006 01:18
Help with sonar sensor supertw Electrical 3 24-01-2006 23:41


All times are GMT -5. The time now is 03:18.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi