Ultrasonic Range Finder

testerrrs

New Member
Whilst the SRF005 is a very nicely built module, I wanted to build a system myself.

The system is based on the one outlined on this page: http://www.siliconchip.com.au/cms/A_103243/article.html

However I have customised the circuit. Input amplification means the system has a range of more than a metre, as opposed to just 120mm. Once calibrated, the system is accurate to approx 7mm. The free running oscillator has been completely changed and now gives a more stable 40kHz output. The program has had a couple of changes too.

The transducers are generic ultrasound ones, and output is via an LCD screen.






The circuit schematic is attached.

Code:
#picaxe08m

symbol receiver	= 1
symbol receiver_in	= PIN1
symbol receiver_high	= %00000010
symbol receiver_low	= %00000000
symbol transmitter	= 4
symbol transmitter_high	= %00010000
symbol transmitter_low	= %00000000
symbol sample_count	= w0
symbol time_to_echo	= w1
symbol burst_time	= w2
symbol distance	= w3
symbol minimum_value = 30

charge:
gosub clearlcd
serout 2,N2400,(254,192,"Initialising...")
pause 100
let dirs = receiver_low + transmitter_high
let pins = receiver_high + transmitter_high
charge_loop:
output receiver
input receiver
if receiver_in = 0 then charge_loop	
let pins = receiver_low + transmitter_high

discharge_pulse:
output receiver
input receiver
let sample_count = 0

discharge_loop:
if receiver_in = 1 then discharge_pulse
let sample_count = sample_count + 1
if sample_count < 30 then discharge_loop
gosub clearlcd
serout 2,N2400,(254,192,"Scanning...")

low transmitter
input transmitter
pulsin receiver,0,time_to_echo
high transmitter
if time_to_echo = 0 then no_echo
low transmitter
input transmitter
pulsin receiver,1,burst_time
high transmitter
let time_to_echo = time_to_echo + burst_time

no_echo:
let distance = distance / 10
gosub clearlcd
if w3 > minimum_value then
serout 2,N2400,(254,128,#w3,"mm      ")
else
serout 2,N2400,(254,192,"No Response")
endif
pause 1000
goto charge

clearlcd:
serout 2,N2400,(254,192,"               ")
pause 30
return
 

Attachments

Last edited:

kevrus

New Member
Thats quite impressive, I wonder if waterproof transducers as used in car reversing sensors would work...
 

BeanieBots

Moderator
Well they DON'T work as replacements in either the SRF04 or SRF08 modules as discovered by someone (can't remember who) earlier on and was kind enough to post their findings here.
I would guess that it is simply because they have a lower sensitivity and hence require higher gain. So I would guess they could be MADE to work with a few minor changes to the circuit. Also possible that they don't have the 'standard' 40kHz resonant frequency.
A datasheet would of course answer all those questions:rolleyes:
 
Top