ΣSigmaStudio Ask AI Русский Log in

Using DSP to control GPIO pins.

SigmaDSP & SigmaStudio richard0980 Jan 6, 2018 00:00 1 replies Original on forum ↗
Subscribe
richard0980 Question
Jan 6, 2018 00:00

Hi. I'm a beginner in DSP. I want to use tones to turn GPIO pins HIGH or LOW. It looks like it would be good to employ DSP to achieve this. I've been directed towards the ADAU1701 product, but it could be that another one is more suitable. But, for now, lets stick with the ADAU1701. I've downloaded SigmaStudio so I can mess about.

I believe the technique I should be employing is to filter the signal (a set of discrete tones at about 18Khz - only one present at any moment). Now, what filter should I be using? A bandpass filter? I was thinking of having 100hz between tones. Not sure how realistic this is. If I can be given a heads up on the filter type I can start messing about. Thanks.

Audio Signal Processors

SigmaDSP Audio Processors

dsp filter

adau1701

KJBob Reply
Jan 6, 2018 00:00

Hello Richard,

You'll find a Peaking Filter choice in the General Second-Order Filter, as shown below. These operate as bandpass filters. With your frequencies barely 0.5% apart, these filters do not appear to be up to the task. For example, below I made two banks of ten cascaded peaking filters, one at 18.0 KHz and the other at 18.1 KHz. The plot obtained with the Stimulus-Probe tool shows much overlap between the filter responses, thus not separating the tones.

Back in the days B.C. (Before Computers), tone decoding was often done with a phase-locked loop (PLL) technique. Interestingly, the ADAU1701's SigmaStudio toolbox has everything you need to implement a PLL. I've used this method to activate a GPIO for a given DTMF Touch-Tone. You'll find an example software PLL running on a -1701 here:

https://ez.analog.com/message/56843?commentID=56843#comment-56843

By the way, this thread mentions FFT (Fast Fourier Transform), which at that time wasn't possible with SigmaDSP. Today it's available on the ADAU1452 and similar Sigma 300 and Sigma 350 chips. In theory a 256 bin FFT at a 48 KHz sample rate could resolve tones 94 Hz apart. SigmaStudio support for FFT is still growing and honestly I don't know if such a project can be done.

The Goertzel Algorithm effectively detects tones so it's the go-to DSP method. Alas, no ready-made SigmaStudio block is available. I had tried making my own, but it didn't provide a very sharp response (perhaps I didn't "code" it properly). Also the -1701 can't do branches, so it performs every programmed calculation on each sample, even if a certain result is needed only once in a hundred samples (rendering the Goertzel Algorithm inefficient). If you're curious, look up Goertzel in Wikipedia, also see my ADAU1701 implementation at:

Tone Detection with the Goertzel Algorithm

You can definitely run the Goertzel Algorithm on a SHARC programmed in C code, but that's out of my league entirely.

Best regards,

Bob

8508.e04170f00c5deb7cb2fb50a2828c9fc4.png
8508.e04170f00c5deb7cb2fb50a2828c9fc4.png
8508.e04170f00c5deb7cb2fb50a2828c9fc4.png-620x342.png
8508.e04170f00c5deb7cb2fb50a2828c9fc4.png-620x342.png