Advice on using Ultrasonic Distance Sensor?
Veritas
Posts: 4
Hey everyone,
New to the forum, new to tinkering with electronics, more specifically the "Ultrasonic Distance Sensor" and generally electrical/mechanical engineering in general. Please excuse me in advance for my ignorance with dealing with these things.
Basically I'm working in a lab and trying to figure out how to use a motion/distance sensor to make an audible "Beeping" that becomes louder and more frequent as an object gets close to the sensor. How do I accomplish this? I purchased the Ultrasonic Distance sensor today but am unsure what kind of controllers I will need to connect and how to code the device to make it perform the functions I want it to. Also, would I be able to code it to have adjustable sensitivity/range? Any help would be greatly appreciated! Thanks.
New to the forum, new to tinkering with electronics, more specifically the "Ultrasonic Distance Sensor" and generally electrical/mechanical engineering in general. Please excuse me in advance for my ignorance with dealing with these things.
Basically I'm working in a lab and trying to figure out how to use a motion/distance sensor to make an audible "Beeping" that becomes louder and more frequent as an object gets close to the sensor. How do I accomplish this? I purchased the Ultrasonic Distance sensor today but am unsure what kind of controllers I will need to connect and how to code the device to make it perform the functions I want it to. Also, would I be able to code it to have adjustable sensitivity/range? Any help would be greatly appreciated! Thanks.
Comments
which sort of sensor did you buy? Did you buy a PING? There is information for that here:
http://www.parallax.com/product/28015 Click on the Downloads tab for info on that page.
Also, what sort of microprocessor are you planning on using (Basic Stamp, Propeller, etc.)? And over what range will you be using this sensor?
I purchased a PING sensor. I'm going over the downloads now. . .
Does it matter which microprocessor I'm using? We're working with objects that will be moving within 0'-10' of the sensor. The PING Ultrasonic Sensor is capable of 0'-9' (which is fine). I'd like to use a processor that can transmit a signal to a speaker that makes the beeping noise.
Please look at the Basic Stamp Syntax and Reference Manual for information on the TONE statement for producing audible tones and the PWM statement for producing voltages.
The Propeller can also be used and has the ability to make much more varied sounds at different volumes and tones. Here are two examples of tone generators (this and this).
Once you get the PING up and running to your requirement, then you can explore the methods to change the volume. There is some simple code for the Propeller that can work to change the volume of a square wave beep, which can be sent direct from the Propeller pin to a piezo, or an amp that amplifies the signal to a speaker or piezo. You can also set the frequency of the beep to change based on the distance.
It is fairly easy to test the results of the PING with a Prop stick or other Prop development board. You can even show the results of the distance on the Parallax LCD, I use the 2 x 16 backlit version that works well with the Prop.
You need to specify what you mean by "wirelessly." I know that the Propeller chip is easily interfaced with an Xbee module, for example. I think the Basic Stamp works, too. Much depends on what sort of data you want to transmit, how far, etc.
Look at the download tab on this page for the pdf of the text:
http://www.parallax.com/product/122-32450
There is also a Bluetooth device:
http://www.parallax.com/product/30086
There are also cheaper transmitter/receiver combinations that use other frequencies. These are akin to the type of radios used in garage door openers, etc. I'm guessing that for what you want to do, you have a lot of options.
Processor doesn't matter. Easiest and cheapest is Prop + HC06 bluetooth in my opinion. HC06 allows us to use an android device running blueterm to as serial terrminal.
This is fantastic. I think the Bluetooth device would work perfectly for my needs. So from what I understand, I need to wire the Ultrasonic Sensor to the Basic Stamp microprocessor, then wire the bluetooth device to the Basic Stamp processor board as well, then write up the code to make the sensor send a signal wirelessly to a speaker (via bluetooth) with a beeping sound that varies in volume and frequency as an object nears. . .right?
It seems like a reasonable idea to me. As Braino said, the processor doesn't matter very much for something like this. You just need to keep in mind the distances you wish to wirelessly transmit. Also heed what T Chap said about the PING not providing reliable data at larger distances. What sort of surface your PING is bouncing its sound off of will also affect the sensitivity and repeatability of your measurements. Things that absorb sound or that are tilted at an angle might show up very differently than, say, a hard surface that is approaching flat toward your sensor. The best way to know, of course, is to try it out.