Go to Post Ah AndyMark and your $2 a piece pool noodles - mlantry [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 28-01-2008, 22:43
nekng's Avatar
nekng nekng is offline
Former 1836 Captain
AKA: Nate
FRC #1836 (MilkenKnights)
Team Role: Alumni
 
Join Date: Aug 2006
Rookie Year: 2007
Location: Los Angeles
Posts: 43
nekng is on a distinguished road
Ultrasonic Range Finder

My team recently bought these ultrasonic range finders. We are having a few problems wiring and programming them.

Attched is a diagram that shows how we wired them.
To program them we used:
Code:
	if (run_count<2){
		rc_dig_out13 = 1;
	} else if(run_count >= 40){
 		rc_dig_out13 = 0;
		run_count =0;
		Get_Encoder_1_persec = Get_Encoder_1_Count() - last_count;
		last_count = Get_Encoder_1_Count();
		//printf("Sensor: %d \r", (int)Get_Encoder_1_persec);
	
	}
	printf("Sensor: %d \r", Get_Analog_Value(rc_ana_in01));
	run_count++;
However when it outputs all we get is the number 11. Does anyone know what is wrong?
Attached Thumbnails
Click image for larger version

Name:	Sensor.jpg
Views:	110
Size:	60.8 KB
ID:	6166  
  #2   Spotlight this post!  
Unread 28-01-2008, 22:52
wt200999's Avatar
wt200999 wt200999 is online now
Texas Instruments
AKA: Will Toth
FRC #3005 (Robochargers)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Dallas, Texas
Posts: 325
wt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud of
Send a message via MSN to wt200999
Re: Ultrasonic Range Finder

I believe that you must use 2 digital ports, no analog. How this thing works is you send a 10 microsecond (us) pulse to it, then you have to wait until you get an input pulse on your digital input port, and you have to measure the length of the pulse. This diagram from that site should help



from
http://www.robot-electronics.co.uk/htm/srf04tech.htm

For sending the output pulse you can simply do

Code:
rc_dig_out18 = 1;
for(x=0;x<10;x++);
rc_dig_out18 = 0;
or something similar.

To measure the pulse you have to set up an interrupt on whichever port you are using as an input (I would suggest port 1 or 2) and a timer. I ended up using timer3. I also wrote it to work with two sensors on 2 outputs and 1 input. I haven't tested the second one yet, but it should work. The only problem I am having is converting my time to millimeters...

If you have any questions about that ask away. I believe there is code somewhere on these forums for this as well, or I can post up mine tomorrow when I get back to school.

Edit: Take a look at this:
http://www.chiefdelphi.com/forums/sh...ad.php?t=42717
Interesting code that you could try.
__________________
Programming in LabVIEW? Try VI Snippets!

FIRST LEGO League 2004 - 2005
FRC Team 870 Student 2006 - 2009
FRC Team 3005 Mentor 2013 -

Last edited by wt200999 : 28-01-2008 at 23:23.
  #3   Spotlight this post!  
Unread 29-01-2008, 23:41
mluckham's Avatar
mluckham mluckham is offline
Registered User
FRC #0758 (Sky Robotics)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2006
Location: Ontario, Canada
Posts: 116
mluckham will become famous soon enoughmluckham will become famous soon enough
Re: Ultrasonic Range Finder

If you are unable to get the pulse-width measurement stuff working, the Maxbotics Ultrasonic sensors interface to an Analog In port and are much easier to program. Cheap, too.

http://www.maxbotix.com/
  #4   Spotlight this post!  
Unread 29-01-2008, 23:52
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: Ultrasonic Range Finder

I strongly suggest the Parallax PING))) sensor. 1024 has used these for a while now with great success. You can use my driver for them if you'd like.

As a side note, about half way through this season I will be releasing the 2008 version of the PING))) driver which supports simultaneous, asynchronous measurement from four PING))) modules using a single hardware timer and four I/O pins, plus it has high efficiency interrupts and an easy to understand interface. Two encoders can still be operated in parallel with the four ultrasonic sensors.

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #5   Spotlight this post!  
Unread 30-01-2008, 07:30
barstow's Avatar
barstow barstow is offline
Registered User
FRC #1939 (Kuh-nig-its)
Team Role: Electrical
 
Join Date: Oct 2007
Rookie Year: 2005
Location: Kansas City
Posts: 10
barstow is an unknown quantity at this point
Re: Ultrasonic Range Finder

This is sort of a tangent question to the discussion above. We put the vex ultrasonic sensor on our bot for some tests, and the guys ( a generic term for males AND females in my vocabulary ) returned with the statement that it absolutely would not detect curved objects (like the ball) unless it was absolutely directly under it. Now I understand angle of reflection and all that, but it seems that a sensor that can only detect objects lined up at exactly 90 degrees is not very effective in ANY situation. Is there another type sensor that
would work better, or is that just how these sensors work and we should try to detect the line on the floor instead?

Ann
Barstow Kuh-Nig-Its
Team 1939
(Gotta make a real signature one of these days)
  #6   Spotlight this post!  
Unread 30-01-2008, 10:50
wt200999's Avatar
wt200999 wt200999 is online now
Texas Instruments
AKA: Will Toth
FRC #3005 (Robochargers)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Dallas, Texas
Posts: 325
wt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud of
Send a message via MSN to wt200999
Re: Ultrasonic Range Finder

From how far are you trying to find it? My sensor (parallax PING))) ) seems to pick up the ball fine. I still have a bit more testing after school to do, but it seems to be fine...
__________________
Programming in LabVIEW? Try VI Snippets!

FIRST LEGO League 2004 - 2005
FRC Team 870 Student 2006 - 2009
FRC Team 3005 Mentor 2013 -
  #7   Spotlight this post!  
Unread 30-01-2008, 12:17
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: Ultrasonic Range Finder

Quote:
Originally Posted by barstow View Post
We put the vex ultrasonic sensor on our bot for some tests,
Well, we tried the vex ultrasonics once and never had a whole lot of success with them. As i mentioned above, and as is mentioned just above this post, the Parallax PING))) sensor is a very robust option.

Round (cylindrical, parabolic, spherical) objects can be viewed from any angle since the wave from the ultrasonic sensor (which is a section of a sphere in shape) can find a perfect tangent point from any angle to the round object. For example, if you wanted to... say... find a pipe... (have no idea why you want to do that ) it looks the same from any side (since there aren't really any sides to a circular surface).

What you say is true for flat objects. Within a narrow margin of off-axis, ultrasonics measure fine. But as you go off axis your measurements are distorted then soon disappear. That's we use a number of different schemes of data processing/collection from multiple ultrasonic sensors depending on the situation to get reliable data (this lead to the development of the aforementioned quad-ultrasonic driver) As a hint, one of these incudes mounting the ultrasonic sensor on an airplane servo.

Questions, Post!

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #8   Spotlight this post!  
Unread 30-01-2008, 23:00
barstow's Avatar
barstow barstow is offline
Registered User
FRC #1939 (Kuh-nig-its)
Team Role: Electrical
 
Join Date: Oct 2007
Rookie Year: 2005
Location: Kansas City
Posts: 10
barstow is an unknown quantity at this point
Re: Ultrasonic Range Finder

Thanks for answering my question. I suspected that there must be a way. I ordered a Ping))) sensor for the team. Each year we slowly add a sensor or two to the robot. Someday we will be ready for that camera

Ann
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
Ultrasonic range sensors for Vex Robot OneCoolDude Programming 1 01-12-2007 09:22
Ultrasonic will not work with another Ultrasonic plz help Jackel148 Programming 10 10-05-2006 15:31
Using VEX range finder on the full-size FRC CronosPrime1 Programming 3 08-02-2006 23:29
Ultrasonic Range Finder polyBot Control System 15 29-01-2006 12:46
Wanted! Dew Reward for Finder! JVN General Forum 11 16-04-2003 13:41


All times are GMT -5. The time now is 21:12.

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