Ultrasonic Sensors
Archiver
Posts: 46,084
Hello,
I just ordered a set of ultrasonic sensors. I looked on the parallax
site and found reference to them but not any examples with just the
stamp and the sensors. Does anyone know of an example?
Thanks,
Curtis
I just ordered a set of ultrasonic sensors. I looked on the parallax
site and found reference to them but not any examples with just the
stamp and the sensors. Does anyone know of an example?
Thanks,
Curtis
Comments
sonar project I did using an SRF04. It beeps based the
distance that the sonar detects. feel free to pick it apart.
====================
Hello,
I just ordered a set of ultrasonic sensors. I looked on the
parallax
site and found reference to them but not any examples with
just the
stamp and the sensors. Does anyone know of an example?
Thanks,
Curtis
=====================
'
=============================================================
=================
'
' File...... SonarCane.BS2
' Purpose... Devantech SRF04 Ultrasonic Range Finder for
the Visually Impaired
' Author.... Dave Evartt
' E-mail.... davee@w...
' Started... 27 JUN 2002
' Updated... 01 Jul 2002
'
' {$STAMP BS2}
'
'
=============================================================
=================
'
' Program Description
'
'
' This program uses the Devantech SRF04 to measure the
distance between the
' unit and a target. Display is in inches. sound uses
different pitch for each 1 foot resolution and a triple for
within 2 feet
'
' Conversion formulas:
'
' inches = echo_time / 73.746 (use 7.3746 for
tenths)
' centimeters = echo_time / 29.033 (use 2.9033 for
tenths)
'
' Revision History
'
'
' I/O Definitions
'
TriggerPort CON 0
EchoPort CON 1
SpeakerPort CON 15
FilterLoop CON 2
'
' Constants
'
MoveTo CON 2 ' cursor
position control
'
' Variables
'
pWidth VAR Word ' pulse
width from sensor
rawDist VAR Word ' filtered
measurment
distance VAR Word ' converted
value
blips VAR Nib ' loop
counter for measurement
i VAR Nib
temp VAR Word ' value for
RJ_print
digits VAR Nib ' used by
RJ_Print
sym VAR Byte
lastDistance VAR Word
feet VAR Byte
'
' EEPROM Data
'
'
' Initialization
'
Init:
' DEBUG CLS
' DEBUG "SonarCane v1.1",cr
' debug "TAU infotek", CR, cr
FREQOUT speakerPort,200,800
FREQOUT speakerPort,200,600
FREQOUT speakerPort,200,800
'
' Program Code
'
distance=0
lastdistance=0
feet=0
Main:
FOR i = 0 TO 3
GOSUB Get_Sonar ' take
sonar reading
distance = rawDist ** 8886 ' divide by
7.3746
temp = distance / 10
distance=temp
feet=distance/12
'now react to the difference between the current reading and
the previous reading
'
IF feet<2 THEN within12
IF feet=lastdistance THEN continue
GOSUB soundoff
GOTO continue
within12:
GOSUB soundoff
GOSUB soundoff
GOSUB soundoff
GOTO continue
continue:
DEBUG "<Range>", DEC distance,"</Range>",CR
lastdistance=feet
PAUSE 10
NEXT
GOTO Main
END
'
' Subroutines
'
SoundOff:
DTMFOUT speakerport,[noparse][[/noparse]feet]
RETURN
Get_Sonar:
rawDist = 0
FOR blips = 1 TO FilterLoop
PULSOUT TriggerPort, 5 ' 10 uS
trigger pulse
PULSIN EchoPort, 1, pWidth ' measure
distance to target
rawDist = rawDist + (pWidth / filterloop) '
simple digital filter
PAUSE 10 ' minimum
period between pulses
NEXT
RETURN
--
Regards
Dave Evartt
American Hovercraft
I am working with a transmitter and receiver ultrasonic sensor that
I bought. The datasheet sucks and the markings are just R and T.
Does anybody have an idea for a simple circuit for me to test their
functionality. I was tried using a circuit just like the infrared
circuit and code from parallax.
My code:
'{$STAMP BS2}
us_transmit_p CON 1
us_rec_pin VAR IN0
led_pin CON 13
main:
FREQOUT us_transmit_p,1,38500
IF us_rec_pin = 0 THEN main
GOTO getp
getp:
HIGH led_pin
PAUSE 1000
RETURN
END
Thanks,
Curtis
> I am working with a transmitter and receiver ultrasonic sensor that
> I bought. The datasheet sucks and the markings are just R and T.
Curtis:
You will have to give us part numbers to be sure, but those parts may be
just the emitter and the receiver. To measure distance with them, you would
have to design a circuit and it isn't a straightforward one. It could be a
fun project and you'd learn a lot about rangefinding, but "how-to-do-it"
isn't a quick answer in this case.
Exactly what are the parts?
Gary
I used jameco part# 136653. This is a pair of sensors.
40 khz. will I have to use an amplifier?
Thanks
Curtis
--- "Gary W. Sims" <simsgw@c...> wrote:
> From: "cenlasoft" <cenlasoft@y...>
>
> > I am working with a transmitter and receiver
> ultrasonic sensor that
> > I bought. The datasheet sucks and the markings are
> just R and T.
>
>
> Curtis:
>
> You will have to give us part numbers to be sure,
> but those parts may be
> just the emitter and the receiver. To measure
> distance with them, you would
> have to design a circuit and it isn't a
> straightforward one. It could be a
> fun project and you'd learn a lot about
> rangefinding, but "how-to-do-it"
> isn't a quick answer in this case.
>
> Exactly what are the parts?
>
> Gary
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed.
> Text in the Subject and Body of the message will be
> ignored.
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/basicstamps/
>
> To unsubscribe from this group, send an email to:
> basicstamps-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
> I used jameco part# 136653. This is a pair of sensors.
> 40 khz. will I have to use an amplifier?
>
Yes, I thought that's what you had there Curtis. I have a couple of pairs
myself for "the week when I have lots of time on my hands". I figure any
year now<g>. I'm too tired tonight to remember all the details, but you can
see the circuit diagram of a successful sonar rangefinder at:
http://www.robot-electronics.co.uk/files/srf1.pdf
That diagram is the Devantech SRF-04 sold by Parallax. Basically, an
ultrasound rangefinder works like submarine sonar. (They compare about like
a tin can and string compare to ISDN phone service. Same objective with a
lot more subtle design, and a wee cost difference<g>.)
What you have to do to use that emitter/receiver pair from Jameco is create
a pulse shaping circuit that will drive the emitter; some technique for
blanking the receiver until the trailing edge of that pulse has time to pass
the receiver on its way outbound; and then a way to amplify the signal from
the receiver and detect when the leading edge of your pulse arrives. That
receiver is fairly notchy. That is, it's a bad microphone in that it will
only resonate with a narrow band of frequencies. 4 kHz around that 40 kHz
center frequency if I remember correctly. That saves you the trouble of
implementing a notch filter to block the response to ambient sounds that
otherwise would mask your returning pulse. It will respond strongly only to
a sound that is roughly the same frequency as it's matched emitter: 40 kHz.
Given those circuits to create an outbound pulse and recognize its returning
echo, you then need a way to let the Stamp measure the time interval -- the
round trip time for that acoustic pulse. From there, you do a bit of simple
arithmetic involving the speed of sound and you have the distance to the
strongest source of an echo return in the beamwidth of the emitter. No, I
mean closest, not necessarily strongest, unless you do a trick called
range-gating, but don't even get me started on how you deal with multiple
echo sources...
That code example you posted was the method used to interface the Devantech
I believe. I'm too tired to go back and check to be honest. If so, it is
based on Devantech's interface, which involves raising a level on one pin as
soon as the receiver starts listening and dropping that level when the
earliest returning echo of the pulse is detected. The Stamp measures the
time that pin stays high using RCTIME or PULSIN.
On their board, which uses nearly identical transducers to your own,
Devantech uses a PIC microprocessor just to manage all that
pulse-creation/echo-recognition/interface business. I'm not sure a separate
micro was needed but that's how they did it, and it gives you an idea how
much work lies between holding a pair of transducers and getting a range
measurement.
All that's why I said it's a project of its very own building a rangefinder.
Of course you'll spend a lot more money than it would cost to buy a
pre-built Devantech circuit from Parallax, but sometimes that's not the
point. If you do decide to build it, you can use that circuit that Devantech
published to create a single copy for your personal use; or you could do
your own design if you take time to learn how such sensors work. That second
approach is what I have in mind when I find that empty week<g>.
Good luck,
Gary
circuit.
http://www.restena.lu/convict/Jeunes/beacon.htm
Hope this helps. I have built something similar to this & it works fine
with the bs2.
Geoffrey
Original Message
From: "Gary W. Sims" <simsgw@c...>
To: <basicstamps@yahoogroups.com>
Sent: Thursday, January 22, 2004 4:24 AM
Subject: Re: [noparse][[/noparse]basicstamps] Ultrasonic Sensors
> From: "Curtis Desselles" <cenlasoft@y...>
>
> > I used jameco part# 136653. This is a pair of sensors.
> > 40 khz. will I have to use an amplifier?
> >
> Yes, I thought that's what you had there Curtis. I have a couple of pairs
> myself for "the week when I have lots of time on my hands". I figure any
> year now<g>. I'm too tired tonight to remember all the details, but you
can
> see the circuit diagram of a successful sonar rangefinder at:
> http://www.robot-electronics.co.uk/files/srf1.pdf
>
> That diagram is the Devantech SRF-04 sold by Parallax. Basically, an
> ultrasound rangefinder works like submarine sonar. (They compare about
like
> a tin can and string compare to ISDN phone service. Same objective with a
> lot more subtle design, and a wee cost difference<g>.)
>
> What you have to do to use that emitter/receiver pair from Jameco is
create
> a pulse shaping circuit that will drive the emitter; some technique for
> blanking the receiver until the trailing edge of that pulse has time to
pass
> the receiver on its way outbound; and then a way to amplify the signal
from
> the receiver and detect when the leading edge of your pulse arrives. That
> receiver is fairly notchy. That is, it's a bad microphone in that it will
> only resonate with a narrow band of frequencies. 4 kHz around that 40 kHz
> center frequency if I remember correctly. That saves you the trouble of
> implementing a notch filter to block the response to ambient sounds that
> otherwise would mask your returning pulse. It will respond strongly only
to
> a sound that is roughly the same frequency as it's matched emitter: 40
kHz.
>
> Given those circuits to create an outbound pulse and recognize its
returning
> echo, you then need a way to let the Stamp measure the time interval --
the
> round trip time for that acoustic pulse. From there, you do a bit of
simple
> arithmetic involving the speed of sound and you have the distance to the
> strongest source of an echo return in the beamwidth of the emitter. No, I
> mean closest, not necessarily strongest, unless you do a trick called
> range-gating, but don't even get me started on how you deal with multiple
> echo sources...
>
> That code example you posted was the method used to interface the
Devantech
> I believe. I'm too tired to go back and check to be honest. If so, it is
> based on Devantech's interface, which involves raising a level on one pin
as
> soon as the receiver starts listening and dropping that level when the
> earliest returning echo of the pulse is detected. The Stamp measures the
> time that pin stays high using RCTIME or PULSIN.
>
> On their board, which uses nearly identical transducers to your own,
> Devantech uses a PIC microprocessor just to manage all that
> pulse-creation/echo-recognition/interface business. I'm not sure a
separate
> micro was needed but that's how they did it, and it gives you an idea how
> much work lies between holding a pair of transducers and getting a range
> measurement.
>
> All that's why I said it's a project of its very own building a
rangefinder.
> Of course you'll spend a lot more money than it would cost to buy a
> pre-built Devantech circuit from Parallax, but sometimes that's not the
> point. If you do decide to build it, you can use that circuit that
Devantech
> published to create a single copy for your personal use; or you could do
> your own design if you take time to learn how such sensors work. That
second
> approach is what I have in mind when I find that empty week<g>.
>
> Good luck,
>
> Gary
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/basicstamps/
>
> To unsubscribe from this group, send an email to:
> basicstamps-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>