28x2 Axe200 Srf005 Ultrasonic Problem

tonto2k

Member
Hi I can't get a reading off my srf005 with my Axe200 project board. I read somewhere about the Srf005 not liking to run at 8MHz? However I can't change the frequency of the Axe200 because it uses an external resonator.

28x2 Code:

***********************************
symbol trig = c.5
symbol echo = c.3
symbol range = w1

main:

pulsout trig,2
pulsin echo,1,range
pause 20
let range = range * 10 /58/2
debug range

goto main

'***********************************

I have successfully had the Srf005 working with a 28x1(4Mhz).

28x1 code:

***********************************

symbol trig = 7
symbol echo = 9
symbol range = w1


main:

pulsout trig,2
pulsin echo,1,range
pause 20
let range = range * 10 / 58
debug range

goto main

********************************

Any ideas please?

Thanks.
 

eclectic

Moderator
Use

#picaxe 28X2
setfreq m4

The 8MHz res. is for the top speed of 32MHz.
(4 x res.)

See Manual 2, p.214

e
 

hippy

Technical Support
Staff member
Also in what way do you mean you cannot get a reading ? That it returns zero or is not what you expect ?

Double check you have the right pins selected ( Pin "9" for the 28X1 is dubious - presumably that was connected to pin 1 ? ) and haven't got the wires crossed over.

The SRF005 should work with 8MHz but it may be necessary to increase the trigger pulse ( perhaps from 2 to 4 ) and you will have to adjust the range calculation ( which you appear to have done ).

Added : No need to change the trigger pulse from 2 as this is 20us and meets the 10us minimum when at 8MHz. The range does need to change as described on page 2 of the SRF005.PDF datasheet.

With suitable adjustment the SRF005 works with a 28X2 up to 32MHz (tested) and should work up to 64MHz.
 
Last edited:

hippy

Technical Support
Staff member
Works for me

Your code worked fine for me without change using a 28X2 and should work just as well for the 28X2-5V on an AXE200. I suspect a hardware or wiring error.
 

tonto2k

Member
Hi the led on the back of the Srf005 doesn't flash which is what I meant. I Have tried different pins and still no luck. I also checked the wiring and I can't find any faults? I am really stuck !

Pin 9 and pin 7 are inputs and outputs on my axestack28 board :)
 

hippy

Technical Support
Staff member
I've no experience with an axestack28 board as it's not a Rev-Ed product but it looks fortuitous that using the board's pin numbering happens to work with the 28X1.

If the LED's not flashing when connected to the AXE200 it suggests you've not got it wired correctly.
 
Last edited:

eclectic

Moderator
I've no experience with an axestack28 board as it's not a Rev-Ed product but it looks fortuitous that using the board's pin numbering happens to work with the 28X1.

If the LED's not flashing when connected to the AXE200 it suggests you've not got it wired correctly.
@Tonto

I can only repeat hippy's comments.
I've just tried the program on an AXE200,
on a breadboard,
and it works fine.

Please see Manual 1, page 36
and RE-check your connections.

PS. Why do you need half the measured distance? :)

e
 

Attachments

Top