by Pev » Thu Mar 09, 2006 10:14 pm
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)
I wouldn't suggest that an upwards facing sonar was normal
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)
I wouldn't suggest that an upwards facing sonar was normal
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