Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

SRF04 Sonar

Hitec robotics including ROBONOVA humanoid, HSR-8498HB servos, MR C-3024 Controllers and RoboBasic
18 postsPage 1 of 21, 2
18 postsPage 1 of 21, 2

SRF04 Sonar

Post by Pev » Thu Mar 09, 2006 10:14 pm

Post by Pev
Thu Mar 09, 2006 10:14 pm

Have managed to get the SRF04 sonar module working. My setup is as follows:

Sonar is on Sonar port 5 - actual ports 10 and 11 (bank C top 2 connectors)
The trigger pulse input on the SRF04 (blue wire in pics) is connected to port 10 - Sonar Port 5 output, and the echo pulse output on the SRF04 is connected to port 11 - Sonar Port 5 Input (yellow wire in pics)

Image

Image

Image

I wouldn't suggest that an upwards facing sonar was normal :lol: but I wanted to test this by bouncing it off my ceiling, which was approx 1.45 m (57 inches) above the sensor. This resulted is a range of return values from 703 to 725 (this was with RN1 in a sitting position). When he stood moving the sensor 3 inches closer to the ceiling the readings decreased to a range 628 to 648. I then tried it over his shoulder 12 inches (30 cm approx) from a wall and got readings 42 to 51. All of these tests were repeated and gave similar values.

So now the funny bit. I linked the call to the sonar via a key press on the remote and output the value to the LCD port and thus my PC. Code here

k32: ' F
DIM DIST AS INTEGER

DIST = SONAR(5)
PRINT FORMAT (DIST,DEC,4)
PRINT " : "

GOTO main_exit

The LCDINIT was called right of the start of the program to initailise the link to the PC via the LCD port (4800,8-n-1).

The odd bit is I only got a valid (non-zero) reading once every 3 or 4 key presses. So as the roboBasic manual says you can get zero for no reading or a reading of up to 3000. Bit of a pain as I know these SRF04 units as I use them a fair bit and they are very reliable so I can't really see why there are so many missed readings. It also seems like the sonar is firing all the time, but I am hoping to investigate this later and work out what is going on.

Hope this is helpful and useful to some of you

Cheers

Pev
Have managed to get the SRF04 sonar module working. My setup is as follows:

Sonar is on Sonar port 5 - actual ports 10 and 11 (bank C top 2 connectors)
The trigger pulse input on the SRF04 (blue wire in pics) is connected to port 10 - Sonar Port 5 output, and the echo pulse output on the SRF04 is connected to port 11 - Sonar Port 5 Input (yellow wire in pics)

Image

Image

Image

I wouldn't suggest that an upwards facing sonar was normal :lol: but I wanted to test this by bouncing it off my ceiling, which was approx 1.45 m (57 inches) above the sensor. This resulted is a range of return values from 703 to 725 (this was with RN1 in a sitting position). When he stood moving the sensor 3 inches closer to the ceiling the readings decreased to a range 628 to 648. I then tried it over his shoulder 12 inches (30 cm approx) from a wall and got readings 42 to 51. All of these tests were repeated and gave similar values.

So now the funny bit. I linked the call to the sonar via a key press on the remote and output the value to the LCD port and thus my PC. Code here

k32: ' F
DIM DIST AS INTEGER

DIST = SONAR(5)
PRINT FORMAT (DIST,DEC,4)
PRINT " : "

GOTO main_exit

The LCDINIT was called right of the start of the program to initailise the link to the PC via the LCD port (4800,8-n-1).

The odd bit is I only got a valid (non-zero) reading once every 3 or 4 key presses. So as the roboBasic manual says you can get zero for no reading or a reading of up to 3000. Bit of a pain as I know these SRF04 units as I use them a fair bit and they are very reliable so I can't really see why there are so many missed readings. It also seems like the sonar is firing all the time, but I am hoping to investigate this later and work out what is going on.

Hope this is helpful and useful to some of you

Cheers

Pev
Pev
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 547
Joined: Sun Feb 26, 2006 1:00 am
Location: UK

Post by subpilot » Thu Mar 09, 2006 11:52 pm

Post by subpilot
Thu Mar 09, 2006 11:52 pm

Good job Pev. I'm drag out one of my SRF04s and give it a try. I have some IR sensors hooked up to a couple A2D ports but they are very short range and basically just act as bump switches.
Adding the sensors has made my Robonova a bit dangerous. If you happen to activate one of the sensors he takes off rather unexpectedly 8O It's downright creepy.
Good job Pev. I'm drag out one of my SRF04s and give it a try. I have some IR sensors hooked up to a couple A2D ports but they are very short range and basically just act as bump switches.
Adding the sensors has made my Robonova a bit dangerous. If you happen to activate one of the sensors he takes off rather unexpectedly 8O It's downright creepy.
subpilot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 146
Joined: Sat Feb 25, 2006 1:00 am
Location: Lake Arrowhead, Ca,USA

Post by Pev » Fri Mar 10, 2006 12:07 am

Post by Pev
Fri Mar 10, 2006 12:07 am

Love the sound of the creepy Robonova just setting off for the hell of it lol.
My real goal has got to be to make mine a bit more aware of his surroundings and a bit more autonomous. Am seriously considering having a go with a gyro too to try to improve his stability.

Next step though is to work out a way to make a mould of his front cover so I can produce a modified one that I can mount the SRF04 inside with just the two heads visible. lol

And I want one of those cool bluetooth modules you guys have over in the US too lol. Think I may just have to say what the heck and order one

Pev
Love the sound of the creepy Robonova just setting off for the hell of it lol.
My real goal has got to be to make mine a bit more aware of his surroundings and a bit more autonomous. Am seriously considering having a go with a gyro too to try to improve his stability.

Next step though is to work out a way to make a mould of his front cover so I can produce a modified one that I can mount the SRF04 inside with just the two heads visible. lol

And I want one of those cool bluetooth modules you guys have over in the US too lol. Think I may just have to say what the heck and order one

Pev
Pev
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 547
Joined: Sun Feb 26, 2006 1:00 am
Location: UK

Post by subpilot » Fri Mar 10, 2006 1:02 am

Post by subpilot
Fri Mar 10, 2006 1:02 am

What about putting the SRF04 inside the wrist? You could have him do a scan by waving his arm around. Or maybe mount it on the front of the knee. I think that stays clear.
What about putting the SRF04 inside the wrist? You could have him do a scan by waving his arm around. Or maybe mount it on the front of the knee. I think that stays clear.
subpilot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 146
Joined: Sat Feb 25, 2006 1:00 am
Location: Lake Arrowhead, Ca,USA

Post by Pev » Fri Mar 10, 2006 11:53 am

Post by Pev
Fri Mar 10, 2006 11:53 am

LIke the knee idea - need to ponder that one
The other thought I had was to take a leaf out of the KHR-1 book and rep-lace his head with a servo, then mount the sensor on that. That would atleast allow for a pan motion to check more than one distance before moving.

Pev
LIke the knee idea - need to ponder that one
The other thought I had was to take a leaf out of the KHR-1 book and rep-lace his head with a servo, then mount the sensor on that. That would atleast allow for a pan motion to check more than one distance before moving.

Pev
Pev
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 547
Joined: Sun Feb 26, 2006 1:00 am
Location: UK

Post by rep001 » Sun Mar 12, 2006 11:09 pm

Post by rep001
Sun Mar 12, 2006 11:09 pm

The BLUE wire you ref to in the text??? Is it Purpley ?
The BLUE wire you ref to in the text??? Is it Purpley ?
rep001
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 193
Joined: Thu Mar 09, 2006 1:00 am
Location: HERTS UK

Post by Pev » Mon Mar 13, 2006 1:50 pm

Post by Pev
Mon Mar 13, 2006 1:50 pm

Yes it is - sorry my raving colour blindness doesn't help

Pev
Yes it is - sorry my raving colour blindness doesn't help

Pev
Pev
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 547
Joined: Sun Feb 26, 2006 1:00 am
Location: UK

Post by subpilot » Wed Mar 15, 2006 7:57 am

Post by subpilot
Wed Mar 15, 2006 7:57 am

Pev, I just noticed that you are running the SRF04 off the servo bus voltage. The SRF04 is only rated to 5V and the servo rail can be quite a bit more.
Pev, I just noticed that you are running the SRF04 off the servo bus voltage. The SRF04 is only rated to 5V and the servo rail can be quite a bit more.
subpilot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 146
Joined: Sat Feb 25, 2006 1:00 am
Location: Lake Arrowhead, Ca,USA

Post by subpilot » Thu Mar 16, 2006 12:54 am

Post by subpilot
Thu Mar 16, 2006 12:54 am

I hooked up my SRF04 and see some problems. First off the readings are not consistant like Pev had seen. I put a scope on the trigger line and see that the module is getting a 1.5mSec wide pulse every ~13mSec without calling a sonar command. I think the problem may be that the servo output is enabled on the ports the sonar is using. I'm going to look into it.

EDIT:

I am sure that the fact that the 3024 trigger channel is constantly sending pulses is screwing things up. I can't seem to disable the output. I also see that the echo receive line is configured as an output by default (because it's set up for a servo) This causes the SRF04 output to be dragged down (bus contention). As soon as you issue a sonar command the line apparently switches to an input but the continuos triggers keep happening. I tried:
MOTOROFF 10
MOTOROFF 11

and also tried:

PWM 10, 0
PWM 11, 0

No go. Hope somebody (Pev) else can sort this out.
I'm going to try to give my I2C sonar module a go.
I hooked up my SRF04 and see some problems. First off the readings are not consistant like Pev had seen. I put a scope on the trigger line and see that the module is getting a 1.5mSec wide pulse every ~13mSec without calling a sonar command. I think the problem may be that the servo output is enabled on the ports the sonar is using. I'm going to look into it.

EDIT:

I am sure that the fact that the 3024 trigger channel is constantly sending pulses is screwing things up. I can't seem to disable the output. I also see that the echo receive line is configured as an output by default (because it's set up for a servo) This causes the SRF04 output to be dragged down (bus contention). As soon as you issue a sonar command the line apparently switches to an input but the continuos triggers keep happening. I tried:
MOTOROFF 10
MOTOROFF 11

and also tried:

PWM 10, 0
PWM 11, 0

No go. Hope somebody (Pev) else can sort this out.
I'm going to try to give my I2C sonar module a go.
subpilot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 146
Joined: Sat Feb 25, 2006 1:00 am
Location: Lake Arrowhead, Ca,USA

Post by Pev » Thu Mar 16, 2006 9:59 am

Post by Pev
Thu Mar 16, 2006 9:59 am

I tried the same things to turn off the output but had no luck either. Have a quiet weekend planned so will have another go from scratch and thanks for the comment on the power line. I know I was playing a bit on the edge - really must sort out a regulator for this robot, all my others have them lol

Pev
I tried the same things to turn off the output but had no luck either. Have a quiet weekend planned so will have another go from scratch and thanks for the comment on the power line. I know I was playing a bit on the edge - really must sort out a regulator for this robot, all my others have them lol

Pev
Pev
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 547
Joined: Sun Feb 26, 2006 1:00 am
Location: UK

Post by ullic » Thu Mar 16, 2006 3:24 pm

Post by ullic
Thu Mar 16, 2006 3:24 pm

I have seen the same problems. You can't switch off the servoports if they are used by commands like "Move G6A x,y,z...
But PWM 0, 1, 2 or OUT 32,1 (ADPort 0) works. So I hope these ports could be used to trigger the sonar sensor.

ulli
I have seen the same problems. You can't switch off the servoports if they are used by commands like "Move G6A x,y,z...
But PWM 0, 1, 2 or OUT 32,1 (ADPort 0) works. So I hope these ports could be used to trigger the sonar sensor.

ulli
ullic

Post by subpilot » Thu Mar 16, 2006 6:22 pm

Post by subpilot
Thu Mar 16, 2006 6:22 pm

Pev, BTW, where did you find info on where the sonar ports were? I didn't see anything in the documentation.
Pev, BTW, where did you find info on where the sonar ports were? I didn't see anything in the documentation.
subpilot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 146
Joined: Sat Feb 25, 2006 1:00 am
Location: Lake Arrowhead, Ca,USA

Post by Pev » Thu Mar 16, 2006 6:49 pm

Post by Pev
Thu Mar 16, 2006 6:49 pm

Subpilot

it's in the robobasic manual in the sonar section. It refers to the Sonar ports and links them to the DIO ports - it's a table on pages 133 and 134.

Pev
Subpilot

it's in the robobasic manual in the sonar section. It refers to the Sonar ports and links them to the DIO ports - it's a table on pages 133 and 134.

Pev
Pev
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 547
Joined: Sun Feb 26, 2006 1:00 am
Location: UK

Post by Pev » Thu Mar 16, 2006 7:16 pm

Post by Pev
Thu Mar 16, 2006 7:16 pm

Well I have had a chance to see if I could get the Sonar to stop firing all the time. I basically cut the roboBasic code down to this:

GOTO AUTO
FILL 255,10000

LCDINIT

MOTOROFF 10
MOTOROFF 11
'================================================
MAIN:

PRINT "Working "
GOTO MAIN

That is the entire program I downloaded. Guess what - the sonar still fires all the time GGGGRRRRRR. Not sure that there is a way to stop it firing now.

Pev
Well I have had a chance to see if I could get the Sonar to stop firing all the time. I basically cut the roboBasic code down to this:

GOTO AUTO
FILL 255,10000

LCDINIT

MOTOROFF 10
MOTOROFF 11
'================================================
MAIN:

PRINT "Working "
GOTO MAIN

That is the entire program I downloaded. Guess what - the sonar still fires all the time GGGGRRRRRR. Not sure that there is a way to stop it firing now.

Pev
Carl
-------------------------
www.alt-view.co.uk
Pev
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 547
Joined: Sun Feb 26, 2006 1:00 am
Location: UK

SRF04 - Yep, it's flaky

Post by dshinsel » Wed Mar 29, 2006 7:20 am

Post by dshinsel
Wed Mar 29, 2006 7:20 am

Hi all,

This forum has been great to get me started and see where some of the pitfalls are. It's nice when you beat your head against the wall to know that others have the same problem.

I can confirm that the sonar is really flaky.
1. It consistantly gives a reading one out of every 3 pings if pointed to and object the right distance away.

2. It will NOT read any object closer then 5-6 feet (at least mine doesn't)

3. Once you get it pointed at an object 6 feet away, it's fairly steady.

I think Robobasic has a bug where they can't service the timer fast enough, or, as others have said, there is a false trigger happening...

I plan to try I2C next... It doesn't look promising... I hate bit-banging I2C!
Hi all,

This forum has been great to get me started and see where some of the pitfalls are. It's nice when you beat your head against the wall to know that others have the same problem.

I can confirm that the sonar is really flaky.
1. It consistantly gives a reading one out of every 3 pings if pointed to and object the right distance away.

2. It will NOT read any object closer then 5-6 feet (at least mine doesn't)

3. Once you get it pointed at an object 6 feet away, it's fairly steady.

I think Robobasic has a bug where they can't service the timer fast enough, or, as others have said, there is a false trigger happening...

I plan to try I2C next... It doesn't look promising... I hate bit-banging I2C!
dshinsel

Next
18 postsPage 1 of 21, 2
18 postsPage 1 of 21, 2