Post Go back to editing

Audio filtering for radio communications using ADAU1700/1

Im working on a project that would benefit from DSP on transmit and receive in a radio communications transceiver. The test board we have, has 4 pots connected to 4 analog inputs. We want to use 2 channels both audio, one for transmit, the other for receive. The transmit channel would have boost for a preset range of frequencies but the receive side would have a variable filter giving a boost, and a variable filter giving a cut or a notch effect. I thought of using the first two pots to set the frequency and the 'depth' of effect for the boost, the last two pots to set the frequency and the depth of cut.

 

Is there any ready made software specifically for radio communications, SSB in particular, im pretty open minded how to approach this.

 

John

  •      Hello John,

         Since your post has gone without reply for two weeks, I'll assume that no one knows of any ready-made s/w out there for your application.  I don't know of any either, but perhaps I provide a little help with your design.

         Looking at the ADAU1701's toolbox in SigmaStudio, we can observe how wonderfully, gloriously analog it appears.  Designing a good transceiver is no mean task, and anyone who can do that sort of work can get comfortable with SigmaStudio in a few well-spent hours or days.  Thus the encouragement is for you to dive in, experiment with a few audio filters and such, make the beginner mistakes most of us have made, and have some fun designing the firmware that will ultimately power your tranceiver's audio path.  Yes it's fun -- much like the fun that folks who build their own PCs get when they power up their creations; the Frankenstein-like, "It's alive!" kind of fun.  At least it's more fun than reading the SigmaStudio license agreement.

         What arrangement does your test board have for getting compiled code into its -1701?  The best way is to run a USB cable from your PC through a Analog Devices USBi plugged into a compatible 10-pin header on your test board.  If your board lacks this header, you could add one following the schematic from the ADAU1701MINIZ board.  The real-time tweaking this arrangement affords is well worth the price of a USBi.  Although if you can afford it, you might consider getting the eval board, which includes the USBi -- it's always nice to have known hardware when developing software.  A distant second choice is a method to write the compiled code to a E2PROM from which the -1701 boots -- that's the good old, "burn and learn" technique.

         Likely in your final design. the -1701 boots from this E2PROM and the radio's users adjust audio with the pots.  This way you won't need a microcontroller.  However, if your transceiver already has a microcontroller commanding frequency synthesizers and such on a I2C or SPI bus, might as well hang the -1701 on this bus and let your uC call the shots.  This method is more challenging, but more versatile.

         Although the -1701's two A-D and four D-A converters and internal paths may often be considered as stereo audio or similar parallel paths, they also can be used the way you described -- isolated paths used in opposite directions in a two-way environment.  An important consideration when designing DSP into a radio is how much EMI its high-speed circuitry might produce.  In a proper PCB layout the -1701 and related components measure relatively RF-quiet in my informal test -- see https://ez.analog.com/message/62223#62223

        Although lacking ready made software, I do have an example project made up -- an adjustable notch filter.   If you're interested, reply in this thread and I'll post the project for you.

         Best regards,

         Bob

  • Thank you for taking the time to reply Bob, very informative.! Programming the test board can be done in more then 1 way with the setup we have, via Arduino, SPI or direct to the eeprom via a programmer, most likely via Arduino as that equipment is at hand and set up.

    I would be very interested in any software you have Bob if thats ok with you? Unfortunately, there's not a lot of information available for DSP in radio communication and as a result, its a little difficult to decide how to approach this problem.

    John

  •     Hello John,

        I had searched back issues of the ARRL's QST Magazine for DSP projects but could not find any for SigmaDSP.  They have a new book on Arduino ham radio projects which may be of interest to you.  Here's a few example projects related to peaking and notch filters to help get you started in your design, as well as demonstrate some of the crazy-fun stuff SigmaDSP can do.

         The -1701's toolbox includes a State-Variable Filter whose frequency can be adjusted by a control input pin.  Thus it's easy to adjust this filter with a pot in a self-boot system.   This example filter is adjustable from 100 Hz to 3 KHz, which you can customize by the DC and gain values as labeled.  The State-Variable Filter block includes the bandpass output used here, as well as lowpass and highpass outputs.  No notch filter, however.  You can subtract the filter's bandpass output from the input audio to make a notch, but it's hard to produce a deep notch this way.

         The General Second-Order Filter has a notch option that works very well.  These filters have no control input pins.  Thus, in a self-contained system you'll need to have your Arduino calculate the filter's five coefficients based on the desired notch frequency, then safeload them via SPI to your -1701.  Shown below is two General filters, one set up by SigmaStudio as a notch, and the other set by typing the needed coefficients for the same notch. calculated from a spreadsheet that's attached (see its rightmost column).  You could have your Arduino make the same calculations to get your coefficients.  By the way, if you would like to learn about how these DSP filters work and how to calculate their coefficients, see the book ADI makes available for download at The Scientist & Engineer's Guide to Digital Signal Processing | Learning and Development | Processors and DSP | Analog D…

         Perhaps at least at the beginning, you would prefer not to get involved with calculating and safeloading coefficients, instead using only the pots on your test board.  The example below makes an adjustable notch by shifting the frequency of the incoming audio before filtering with a fixed notch filter, then demodulating the result.  This works because the usual SSB bandwidth is about 3 KHz, giving us some room to modulate upwards.  In my example the fixed notch is at 12 KHz, the working frequency often used with sound card software radios.

         This project modulates the incoming audio to upper-sideband with a variable 9 KHz -- 11.9 KHz carrier, notch filters the result at 12 KHz, then demodulates back to audio.  Though quite convoluted, it uses only about 30% of your available program instructions, leaving room for more features.  As a bonus, since the adjustable carrier is a VCO, we can have the notch filter track the offending whistle so the operator need not constantly adjust for drift.  A quick listening test shows it works quite well.

         Have fun with your project!

         Best regards,

         Bob

  • Hi Bob,

    this is amazing, thank you so much for this project file!

    I'm playing around with it. I think I understand the upper part of the model (Hilbert to eliminate negative spectrum, modulate to upper sideband, notch filter, demodulate). But I am unclear what the lower half does exactly. Could you elaborate?

    Thanks, and best regards, Roman

  •      Hello Roman,

         That part of the project implements a "Phase-Locked-Loop" (PLL) that attempts to steer the project's VCO to match the whistle frequency, reducing the need for manual adjustment.  Like the AFC often used in FM radios, it helps compensate for frequency drift and such.  Here's how it works:

         The whistle in the modulated input signal (1) is best attenuated when at the notch frequency, 12 KHz.  A reference oscillator (2) is set at the same 12 KHz frequency as the notch filter.  Its output is multiplied (3) with the input, which as you know, produces sum and difference frequencies.  The sum frequency is killed by the lowpass filter (4), leaving a slow-moving difference signal.  When the oscillator and input whistle are in-phase, this signal tends toward a positive value.  If 180 degrees out of phase, the LP filter output is negative.  90 degrees phase difference results in a zero level.

         The clipper (5) limits the effect of this signal on the final result.  Then the difference signal is fed back using a feedback block (6) to the VCO input.  This tends to correct the VCO's frequency, to align the whistle to the same frequency as the reference oscillator -- and thus, the same frequency as the notch filter. As a result, the notch remains effective even though the original whistle from the radio drifts some.

         The loop filter (4) must be a first-order type to keep the loop stable.  In addition, it helps to bypass a small amount of signal around the filter, as shown.  The math behind this compensation arrangement is a bit complex, but really all you have to do is adjust the bypass amount for best performance (most reliable whistle nulling).

         Phase-locked loops have many other applications -- for example, see:

    https://ez.analog.com/message/172159#172159

         Best regards,

         Bob

  • Hi Bob,

    thank you so much for your explanation and the illustration!  It goes a long way!

    By the way I have noticed a 7-9dB difference in gain between the Baseband Filter output and the Audio Filter (Audio Filter output is lower).  Why would that be?  All broadband gains in the filter stages are 0 dB.

    I'm not quite sure why you need the bypass (with gain 0.005), but I'll take your word for it.  And 2 Hz is enough for the LP filter?

    Suppose I have a 1kHz tone on my input as a result of feedback:

    Upper Branch

    I have my filter frequency adjusted to 0K, thus the VCO will run at 12kHz and by the magic of Hilbert and the multipliers, I will end up qith a 13kHz tone before the notch filter (modulated input signal, #1 in your screenshot).  It filters 12kHz, so my 13kHz will pass through it.  It gets demodulated to 14kHz and 1kHz (sum and difference frequencies) and band-pass-filtered, so again I hear my 1kHz tone.

    PLL Branch

    13kHz tone (modulated input signal, #1 in your screenshot) goes into the multiplier and modulated with 12kHz from sine source. As you write, the results are a 1kHz tone and one at 25kHz - which at the sample rate appears as 23kHz (24 - (25-24))kHz.  The 2 Hz low-pass filter will attenuate this very greatly.  A first order LP at 2Hz will be down by about 27dB at 1kHz if my math is right.  The 0.005 gain corresponds to -46 dB, so essentially we get a very small 1 kHz signal. This goes through the clipper and then back to the subtractor block before the VCO, in theory modulating the VCOs frequency at 1kHz.  And this is what I don't understand... how wouldl the PLL ever drive the VCO towards around 11kHz so that my feedback tone should get eliminated by the notch?

    Update

    I played around with the filter frequency adjuster and the algorithm works pretty well when I have a sufficient initial guess as to what my feedback frequency will be.  Is there any way of a blind approach?  I need to use this in a system with a pretty broad range for feedback (tbd, but I think between 600Hz and 2kHz)

    Also, there's still that gain difference between Baseband filter output and Audio Filter output...

    Thanks, Roman

  •     Hello Roman,

         The demodulator loses 6 dB because only half its output is the recovered signal.  The other half is the sum frequency, which is then filtered out.  In mathematical terms,

         sin(A) x sin(B)  =  0.5 x [cos(A-B) - cos(A+B)]

         Unfortunately as you're finding out, phase-locked loops only work within a relatively narrow frequency range for which they were designed.  This is sufficient for this project's original purpose -- a manually adjustable notch filter for amateur radio, where the PLL tracking was a neat little bonus.  PLLs are not suitable for blind frequency measurement.

         If your application is auto feedback nulling for sound reinforcement, likely you'll need  more horsepower than SigmaDSP can provide.  For example, I've helped install a few auditorium sound systems which included a Behringer Ultra-Curve DSP EQ.  Inside (I got curious, see my avatar!) is two SHARCs and a Blackfin.  Any one of these processors is way more powerful than a -1761.   Typically, feedback-killing boxes measure frequency via Fast Fourier Transform (FFT).  Presently the only FFT-capable SigmaDSP is the ADAU1452 series, and we're still waiting for enough block-processing algorithms in SigmaStudio to make good use of this power.

         This being said, a fellow engineer on EZ did build a blind frequency measurement scheme using discrete filters -- see https://ez.analog.com/message/140809#140809

         Best regards,

         Bob

  • Hi Bob,

    thank you so much for your explanation!  I greatly value your help!

    Now that you pointed it out, the reason for the gain difference seems obvious...

    Thank you also for the pointers towards the other thread and what's inside a Behringer Ultra-Curve. There's a dedicated feedback destroyer as well, I wonder what they use in that. Given resources of my choice I would probably use Matlab/Simulink on a fast processor, but then that would be hard to carry around for police, firemen and other emergency helpers who our products are intended for   So I'll see how far I can go with just a 1761.

    Best regards, Roman