Arduino and the PING Ultrasonic Sensor - Question

Discussion in 'General Electronics Chat' started by krow, Jan 26, 2011.

  1. krow

    Thread Starter Member

    May 25, 2010
    49
    0
    Hey guys,

    I was reading the code the Arduino uses to turn on the Ultrasonic Sensor and I see it's pretty straightforward, I was curious about something I noticed, I'm not an expert in this field, worth mentioning.

    We all know the PING sensor is basically a transceiver (receiver and transmitter) so, I read that the Arduino sets one of its pins to HIGH and then, a few microseconds later it is switched as an input so that it picks up that signal after bouncing off the object, nothing extraordinary so far.

    I was wondering, if I use a mic and a speaker instead of the sensor wouldn't it work the same way? I send a tone through the speaker and then I set the mic as an input which will pick up that signal after bouncing off the object like in the first case. Would that work?

    With this "experiment" that I'm sure so many people have already done I would like to find a way to, for example, measure the dBs of that incoming signal which will help me find out how much absorption that object offers, something like that. Has anybody tried this before? Is there any way I can measure dBs with the Arduino and this sensor?

    I'd love to hear from you and thanks for reading.
     
  2. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Lower audio frequencies are very non-directional.

    This is noticeable with human hearing, where you can't immediately locate the direction of bass, such as a big boom, without higher harmonics.

    Electronics are more fussy than a human ear, so for reliable detection, the audio must be in a "beam" (actually, a very narrow cone shape, about 10 degrees), which can only be achieved with shorter wavelengths (>15kHz-ish).

    Your project will work, but only to the extent that an awareness of "something" is nearby, but not the precise direction, probably about 100 degrees or so depending on speaker and microphone. Think of the small echo when you talk in a bathroom, for example.

    In addition, human speech and everyday sounds cloud that area of the audio spectrum, causing false alarms.

    With a good enough microphone and high enough sample rate, a uC can be used as an SPL (dB) meter, with the right calibration, and code for different weighting (A or C), and to work around any non-linearities of the microphone.
     
  3. krow

    Thread Starter Member

    May 25, 2010
    49
    0
    Hey man, thanks for the reply. With this experiment I didn't want anything too professional but I just thought it'd be fun to try that out. I'm just trying to combine my knowledge of programming (I'm in learning process) with electronics. I'm still amazed by how well these two fields get along.

    Cheers.
     
  4. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    It's a very fun place to play. uCs and hobbyist circuits are like bread and butter.

    If you like doing hardware, you can increase the amount of hardware to reduce coding.

    If you like coding, you can get something along the liens of an arduino and just plug stuff together.

    I'm pretty sure uCs are responsible for the rather large "revival" of hobbyists, many shrunk away in the 90's, but are coming back now.
     
  5. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    I agree with thatoneguy's comments about the role played by uCs in the resurgence of electronic hobbyist. It doesn't hurt that the Internet has made the access to the basic knowledge needed to answer the many questions that a newbie encounters on their journey to electronic proficiency. Add to that the availability of electronic forums like AAC and others and you have a recipe for an explosion in interest.

    What I believe you will find is that your choice of the Arduino opens up the availability of a ton of free library functions at the www.arduino.cc website.

    hgmjr
     
Loading...