audio frequency tone detection in software


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Nov 2009
    Location
    Dallas, Texas, USA
    Posts
    10

    Default audio frequency tone detection in software

    I have an old (1983) Heathkit clock that synchronizes itself to the time code information broadcast by US radio station WWV (the 5, 10 & 15 MHz signals, not VLF like new consumer type clocks) that I am interested in improving the performance of.

    A weak aspect of the original design is the use of 70's vintage NE567 PLL ICs to detect the 100Hz and 1000Hz tones in the WWV data stream. In poor signal to noise ratio conditions (like now, at the bottom of the sun spot cycle) the PLLs go fairly flaky, especially the 100Hz portion of the circuit.

    This problem is compounded by the interference produced by almost every modern electronic gadget made, which makes picking up a quality shortwave AM signal difficult even under the best of conditions. When the clock was designed in '83, the world was a lot more RF quiet than it is today.

    I strongly expect that timing pulse width (PULSIN) isn't going to afford the noise immunity I need to significantly improve the design.

    Does anyone have any tips on how best to implement such a detection scheme using a PIC?

    Thanks for the help!

    Mike

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Hi, Mike

    IF a NE567 isn't sufficent to filter the signal ... I do not see what a simple PIC could do better ...

    May be a DSPic ... if any amplifier was available in it ...

    That said it's a problem of cleaning the signal before filtering it ... and I , personnaly, would add a little signal filtering card before the 567 Input ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Nov 2009
    Location
    Dallas, Texas, USA
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    Thanks for the reply, Alain.

    A simple single op amp bandpass filter is used in both the 100 and 1KHz segments prior to the NE567s. I haven't swept them using a variable oscillator and a scope, but I'm sure they're fairly broad. Better than nothing, though, as you say.

    I have heard that the Goertzel algorithm

    http://en.wikipedia.org/wiki/Goertzel_algorithm

    can be used to do this job on a moderately fast (10+MHz clock) uP, but I have no experience with coding such a thing. And as you can see at that URL, the math is not trivial.

    A DSP PIC would probably do a great job in this application, but I have no tools to program those chips, and wouldn't even know where to start with trying to do so in assembler. Whatever I do will have to be done in PBP or C.

    At any rate, thanks for your reply,

    Mike

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Post

    Hi, Mike

    This filter requires floating point calculations ... trig functions are not exactly PbP's best feature nor ...

    so, I do not think it could be a good Idea ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    I agree with Alain, sounds pretty difficult. But decoding can be done. Here is one dtmf decoding example in assembly: http://dtmf.voipintouch.net/content/dtmf.htm . It uses a 16F877, and a modified version of the Goertzel algorithm. Of course you would have to modify it to detect the time code tone for your application.

    Attached is microchips dtmf decoding app note AN257 (assembly) for PIC18F chips
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by ScaleRobotics; - 23rd May 2010 at 15:02.

  6. #6
    Join Date
    Nov 2009
    Location
    Dallas, Texas, USA
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    Thanks for the files.

    The problem that I see right off is that the PDF says that the worse case s/n ratio for that design is 23dB. That's quite reasonable for working with DTMF signals off a phone line, but not a source picked up using an AM shortwave radio.

    You guys have just about convinced me that any scheme using a plain digital PIC isn't gonna fly.

    There are lots of DTMF decoder chips, but I expect that they require a s/n ratio similar to that normally found on a phone line i.e. pretty good. Plus, hacking them to do 100 and 1000Hz might be a big problem seeing as how they were designed from the ground up to do DTMF.

    Other than the NE567s already in use, does anyone have any other ideas? Suggestions on development tools for DSP PICs that don't have a huge learning curve?

    Thanks again,

    Mike

  7. #7
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mlmccauley View Post
    Suggestions on development tools for DSP PICs that don't have a huge learning curve?

    Thanks again,

    Mike
    Would a "pulse divide by" logic chip slow the pulse timing down enough to be of use to an 8 bit PIC?

    Norm

  8. #8
    Join Date
    Nov 2009
    Location
    Dallas, Texas, USA
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    The problem is not the speed/frequency of the signal. 100Hz and 1000Hz isn't all that fast, especially to a 30+MHz clock PIC. The signal is analog, not digital, and it's not at all clean.

    If it were a nice clean square wave, PULSIN would do the job great. But it's a distorted sine wave combined with a great deal of white noise.

    Thanks for the reply, at any rate,

    Mike

  9. #9
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Thought you might be interested in this thread as well. Here a guy measures the note for a guitar using a pic. But he uses a "sustainer" which filters out harmonics, etc, so his sound wave is very clean. Just thought you would be interested.

    http://www.picbasic.co.uk/forum/showthread.php?t=12813

    Walter

  10. #10
    Join Date
    Nov 2009
    Location
    Dallas, Texas, USA
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    Thanks, Walter. That's interesting stuff, but as you say that guy was working with a very clean sine wave at a high s/n ratio. Relatively speaking, I'm trying to process some real junk.

    Although I'm still interested in anyone's comments regarding doing this with a PIC, either conventional or DSP, I've started looking at general purpose switched capacitor filter ICs to use as replacements for the single op amp RC tuned bandpass filters. The thinking there is that the NE567s would probably work way better if less trash was being shoved into them.

    Thanks again,

    Mike

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts