The SRF005 sensor is an ultrasonic distance measuring module which requires either one PICAXE I/O line or an input plus output line to use. The SRF005 sensor produces a pulse of varying length which corresponds to the distance between itself and a detected object or obstacle when it is instructed to do so. The sensor can detect objects with 3cm to 3m range.
Ultrasonic SRF05
Schematic
![](_/thumbnail9129.jpg)
PCB
![](_/thumbnail3995.jpg)
Read distance via SRF005 sensor in single-pin mode
This program demonstrates single-pin mode, using a single line to control trigger and read the echo pulse
- Code Example:
-
symbol trig = C.1 ; Define pin for Trigger & Echo (All M2, X2 parts) symbol range = w1 ; 16 bit word variable for range main: pulsout trig,2 ; produce 20uS trigger pulse (must be minimum of 10uS) pulsin trig,1,range ; measures the range in 10uS steps pause 20 ; recharge period after ranging completes ; now convert range to cm (divide by 5.8) or inches (divide by 14.8) ; as picaxe cannot use 5.8, multiply by 10 then divide by 58 instead let range = range * 10 / 58 ; multiply by 10 then divide by 58 debug range ; display range via debug command goto main ; and around forever ; Note that X2 parts operate at 8MHz instead of 4MHz and so modify the calculation ; let range = range * 10 / 58 / 2 ; multiply by 10 then divide by 58 then divide by 2
Copy Code Submit an Example
Create Module
![](../../../thumbnail602b.jpg)
The SRF005 ultrasonic sensor is connected to the SRF005 adapter PCB, which then connects via a 3 way cable to the servo create module. This allows the SRF005 to be moved whilst it is still connected to the create motherboard.
Bill of Materials
Description | Code | Qty | |
---|---|---|---|
Ultrasonic Range Finder | SRF005 | 1 | Buy Now |
5-pin 0.1" r/a header socket | CON043 | 1 | Buy Now |
Simulation
Submit Your Own Code!
You must be logged in to submit code examples. Login now.
Share