Go to Post My favorite question of all time asked by "outsiders": How much does/did that thing cost? How can you put a price on the hard-work and dedication it took to build these machines? - KyleGilbert45 [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 19-01-2008, 11:56
the401tauntaun's Avatar
the401tauntaun the401tauntaun is offline
The Tauntaun
FRC #0401 (Hokie Guard)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Blacksburg, VA
Posts: 3
the401tauntaun is an unknown quantity at this point
Send a message via AIM to the401tauntaun
SRF04 Ultrasonic Rangefinder Unresponsive

we are using the Devantech SRF04 Ultrasonic Rangefinder. We have sent a 5v pulse to the input pin, and verified this with a voltmeter. The power supply is working. We are not getting any feedback. The voltage from the "echo output" pin stays at zero. The code we are using to send this signal folows:

if(p1_sw_trig == 0)
{
rc_dig_out02 = 0;
}
else
{
rc_dig_out02 = 1;
}

We are reading the output from the rangefinder using both a voltmeter and printfs, and neither one shows any output. We expected a pulse at the falling edge of our signal, to signify that it was "listening" for echoes. Is there something obvious we are missing here? These rangefinders are a few years old, so it's possible (though unlikely) that they are just broken.
  #2   Spotlight this post!  
Unread 19-01-2008, 18:59
Steve_Alaniz Steve_Alaniz is offline
Registered User
FRC #2848 (All Sparks)
Team Role: Mentor
 
Join Date: Mar 2007
Rookie Year: 1997
Location: Dallas
Posts: 211
Steve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond repute
Re: SRF04 Ultrasonic Rangefinder Unresponsive

Hi I have one here... I don't think you'll see anything on the Voltmeter... the echo is VERY short and most Meters are not fast enough. If you have access to an Oscilloscope, you might see the missing pulse.
How are you using the Printf? Once again... since the output is a pulse, your best chance of detecting it, without actually timing it, is to change a variable to "1" on the positive edge and use and
if variable == 1 then ... printf some message like "Found"
  #3   Spotlight this post!  
Unread 19-01-2008, 19:52
geeknerd99's Avatar
geeknerd99 geeknerd99 is offline
Fire Hazard
AKA: Daniel Lin
FRC #0401 (Hokie Guard)
Team Role: Programmer
 
Join Date: Oct 2004
Rookie Year: 2005
Location: Blacksburg, VA
Posts: 276
geeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud of
Send a message via AIM to geeknerd99 Send a message via MSN to geeknerd99 Send a message via Yahoo to geeknerd99
Re: SRF04 Ultrasonic Rangefinder Unresponsive

that is a very good idea. We had a printf running in the user_routines_fast of the default code, and basically I was hoping that it would catch it. I figured that it would show up, but maybe not, and I will definitely try doing a single printf. thanks! (btw, geeknerd = same team as tauntaun)
__________________

Last edited by geeknerd99 : 19-01-2008 at 19:54.
  #4   Spotlight this post!  
Unread 19-01-2008, 20:38
geeknerd99's Avatar
geeknerd99 geeknerd99 is offline
Fire Hazard
AKA: Daniel Lin
FRC #0401 (Hokie Guard)
Team Role: Programmer
 
Join Date: Oct 2004
Rookie Year: 2005
Location: Blacksburg, VA
Posts: 276
geeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud of
Send a message via AIM to geeknerd99 Send a message via MSN to geeknerd99 Send a message via Yahoo to geeknerd99
Re: SRF04 Ultrasonic Rangefinder Unresponsive

tried it. It is now official that we are not gettting any feedback...
__________________
  #5   Spotlight this post!  
Unread 19-01-2008, 20:43
basicxman basicxman is offline
Emily Horsman
FRC #2200 (MMRambotics)
Team Role: Programmer
 
Join Date: Oct 2007
Rookie Year: 2007
Location: Burlington, Ontario
Posts: 971
basicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant future
Send a message via AIM to basicxman Send a message via MSN to basicxman Send a message via Yahoo to basicxman
Re: SRF04 Ultrasonic Rangefinder Unresponsive

i have an SRF04 but also an SRF08, way better!!! and not to mention its controlled by i2c also it has a built in light sensor (CdS cell)
  #6   Spotlight this post!  
Unread 19-01-2008, 20:56
jgannon's Avatar
jgannon jgannon is offline
I ᐸ3 Robots
AKA: Joey Gannon
no team
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Pittsburgh, PA
Posts: 1,467
jgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond repute
Re: SRF04 Ultrasonic Rangefinder Unresponsive

Quote:
Originally Posted by geeknerd99 View Post
tried it. It is now official that we are not gettting any feedback...
I'm still not totally convinced. As Steve pointed out, the return pulse is very short, and it's possible that the pulse is coming and going faster than even the fast loop can keep up with. To be totally sure, could you set it up as an interrupt, and then see if you ever trigger it?
__________________
Team 1743 - The Short Circuits
2010 Pittsburgh Excellence in Design & Team Spirit Awards
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2007 Pittsburgh Website Award
2006 Pittsburgh Regional Champions (thanks to 395 and 1038)
2006 Pittsburgh Rookie Inspiration & Highest Rookie Seed

Team 1388 - Eagle Robotics
2005 Sacramento Engineering Inspiration
2004 Curie Division Champions (thanks to 1038 and 175)
2004 Sacramento Rookie All-Star

_
  #7   Spotlight this post!  
Unread 19-01-2008, 21:31
geeknerd99's Avatar
geeknerd99 geeknerd99 is offline
Fire Hazard
AKA: Daniel Lin
FRC #0401 (Hokie Guard)
Team Role: Programmer
 
Join Date: Oct 2004
Rookie Year: 2005
Location: Blacksburg, VA
Posts: 276
geeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud ofgeeknerd99 has much to be proud of
Send a message via AIM to geeknerd99 Send a message via MSN to geeknerd99 Send a message via Yahoo to geeknerd99
Re: SRF04 Ultrasonic Rangefinder Unresponsive

It says that if there is no "echo," it won't timeout until 18 ms have passed. I'm sure the fast routine loops faster than 18 ms.
__________________
  #8   Spotlight this post!  
Unread 20-01-2008, 00:11
dcbrown dcbrown is offline
Registered User
AKA: Bud
no team
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Hollis,NH
Posts: 236
dcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud of
Re: SRF04 Ultrasonic Rangefinder Unresponsive

how about something like this. It should fire a ~20us drive pulse and then listen on the echo line. The echo line should be asserted shortly after the sonar is fired and remain high until the first echo is detected -or- no echo and the line will drop in 36ms.

Code:
void ping()
{

unsigned int count;
char usec;
#define drive_pin rc_dig_in01
#define echo_pin  rc_dig_in02

    //~20uS pulse out
    drive_pin = 1;
    for (usec=20; --usec != 0; )
    {
	Nop();
	Nop();
	Nop();
	Nop();
	Nop();
    }
    drive_pin = 0;

    //echo pulse should start shortly... timeout in ~20ms
    count = 35500;
    while(echo_pin == 0)
    {
	count++;
	if (count == 0)
	{
	    printf( "whoa, where'd the pulse go?\n");
	    return;
	}
     }

     // ok, count the pulse width, count*2 is approx. uSec.
    count = 0;
    while (echo_pin != 1)
    {
	Nop(); Nop(); Nop(); Nop();
	count++;
            if (count == 0) break;
    }
    printf( "count = %d\n", count );
    return;
}
  #9   Spotlight this post!  
Unread 20-01-2008, 11:42
Gdeaver Gdeaver is offline
Registered User
FRC #1640
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 2001
Location: West Chester, Pa.
Posts: 1,370
Gdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond repute
Re: SRF04 Ultrasonic Rangefinder Unresponsive

You could always fire up Easy C and check the operation with a Known working code.
  #10   Spotlight this post!  
Unread 20-01-2008, 11:52
the401tauntaun's Avatar
the401tauntaun the401tauntaun is offline
The Tauntaun
FRC #0401 (Hokie Guard)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Blacksburg, VA
Posts: 3
the401tauntaun is an unknown quantity at this point
Send a message via AIM to the401tauntaun
Re: SRF04 Ultrasonic Rangefinder Unresponsive

thanks a lot for your help! I will try this tuesday, when I can go back to the shop.
  #11   Spotlight this post!  
Unread 20-01-2008, 12:39
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: SRF04 Ultrasonic Rangefinder Unresponsive

Or you could try my single-pin ultrasonic driver.

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
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 will not work with another Ultrasonic plz help Jackel148 Programming 10 10-05-2006 15:31
Programming Parallax Ultrasonic Rangefinder edman Programming 2 17-02-2006 08:35
Ultrasonic Sensor winners Programming 3 02-01-2006 20:55
Ultrasonic Rangefinder Operating On I2C Bus CapnBFG Electrical 10 04-06-2005 01:31
Unresponsive camera neilsonster Programming 9 17-02-2005 08:51


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

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