Having spent much of 2013
keeping it simple with the
Arduino, I thought it would be nice to start 2014 by waking up the little grey cells and doing something a little less
facile...
I treated myself to an
Arduino DUE and decided to investigate what could be done in the way of Digital Signal Processing on that platform...
Unlike the simpler Arduinos, with their ATmega microcontrollers, the DUE features an
Atmel SAM3X8E ARM Cortex-M3 CPU, which is an entirely different kettle of fish.
Whilst the DUE's 32-bit processor can blow the simpler 8-bit AVR micros away, the good folks at Arduino have retained all the attractive and familiar features of the simpler platforms in the DUE, including, amazingly, the cheapskate-compatible price tag. In fact, the DUE is actually cheaper than the Arduino MEGA - making it my kind of toy!
I took inspiration from my old adjustable analog CW Filter
(SPRAT 146, Spring 2011, p20) and decided to try to make something similar using DSP. Yesterday I got it working...
My system uses only a couple of passives to couple the analog signals, a 10k potentiometer to control the bandwidth and the Arduino DUE...
Adjusting the pot allows you to set up an audio filter which can be varied from a tight CW filter all the way to a quite wide SSB filter - and all points in between. Here are a series of measured frequency responses captured this morning, demonstrating the range of the system...
[Having nothing else to hand, I downloaded a freeware audio analyser to make the measurements above. The analyser is called "Visual Analyser" and can be downloaded from here .I haven't had chance to evaluate it fully as yet - but initial impressions are positive. Certainly the price was right! having said that, the greater part of the "noise" in the measurements above is a mis-representation of the new DSP filter, which sounds "clean".]
As you see, advancing the control makes a wider filter - the lower corner frequency falls from around 500 Hz to 300Hz whilst the upper increases from around 700Hz to beyond 4kHz. All the filter design work is done in the Arduino in close-to-real time (
there is presently an audible "glitch" as you change the filter bandwidth - but it isn't a show-stopper).
Although the system needs no visual interface, it does pump out a statement of the current filter design targets after any adjustment of the control. These can be viewed on the "Serial Monitor" in the Arduino development environment (
or any "Hyperterminal" equivalent)...
Here's a schematic, explaining how simple the hardware hookup is...
and here's the unit in test, taming down some wideband signals on 40m from my FT817...
For those that know anything about this sort of thing, I'm designing the filters using the "Fourier Transform" method and implementing them using "Fast Convolution". The system is running at a sample rate of 44.1 kHz (CD sample rate) and can run at up to 48 kHz (the next "standard" digital audio sample rate).
I'm not going to be publishing the code as yet (this is the start of a bigger project - watch this space), but I will give some pointers to anybody wishing to learn about audio applications on the DUE...
Analog-to-Digital Conversion
I started off by figuring out how to get the speed of analog throughput from the DUE's 12 bit ADC straight through to the integral twin-channel 12 bit DAC up to a reasonable rate for audio.
Out-of-the-box, the speed isn't there - but if you look
at this page you'll learn how to speed things up considerably (
to a very respectable 330kHz sample rate, in fact). Search a bit harder and you'll find
this page, which explains how to run the ADCs in 'free-run' mode, which will take you up to over 600kHz sample rate (
albeit with some inevitable loss of resolution).
Timing Framework
Next, I found
this helpful application which, as well as giving a useful audio tool (
an audio-frequency DDS generator on the Arduino), provides a nice introduction to the establishment of an interrupt-driven timing framework to get a standard sample rate.
Hardware for Basic Analog Throughput
A shield has been produced for the DUE, which equips it as a skeleton digital guitar effect pedal, as described
here. This provided the outline for my hardware layout and also gives some inspiration for the analog throughput - but the signal processing in the pedal is trivial. I wanted to implement something more ambitious, so I needed a DSP library...
DSP Library for the ARM
Whilst there is a great FFT application library for Arduino UNO etc,
here (
I've used it and can vouch for its quality), it isn't suitable for the DUE. It is too limited in scope and - more importantly - doesn't take advantage of the extra resources on the DUE's ARM processor. Fortunately, ARM themselves produce a library which includes DSP functions - the CMSIS-DSP library, which you can find documented at the websites of the major software providers for ARM development
such as Keil.
Unfortunately, the Arduino software isn't set up to use the CMSIS-DSP library - so you need to do a little digging to set it up. Fortunately, that task is well-described in
this discussion on the Arduino forum.
With the information in the links above, you'll be able to play with audio on the Arduino DUE - which is a really exciting platform.
Now that I've got the basic framework of some controllable DSP running on the DUE I've got some ideas about what I'm going to be trying next...
...-.- de m0xpd