Topic – Signal Processing?

One of my intentions with my ham radio hobby was to try and keep it “analog”. Tinkering with old radios, electric valves and stuff. I believe my antenna experiments also were a result of this no-digital endeavour. As my day job is very much about computers, morse code and antennas was a way to relax.

Apparently one should never say never. I recently put my toes into the digital signal processing domain. Or put my feet back into that to be more precise. But when I studied time-discrete systems back in the 1980’s the computers were so slow or unobtainable that it was more of a mathematical tour around the complex plane. So while I did FIR/IIR-filters and FFT:s back then, in my mind at least, it was for hardware implementations.

But as the hobby micro controllers have become so potent and cheap it is hard not to start thinking of what could be done with very minimalistic means and today’s hardware. While some hams actually do both SSB-decoding and ditto modulation for transmission my current interest concerns if any decent signal processing could be done with Arduino hardware.

The Arduino has a 16 MHz ATmega328p microcontroller. The 328 is an 8-bit machine so it is admittedly not really suited for this kind of number crunching. Still, it has a 10 bit A/D-converter so…

…here is a little test board with an input stage with a TL072 and  output stage with a MC4802 DA-converter (8-bits) followed by a Sallen-Key lowpass filter (circa 3 kHz bandwidth) and a TBA820M final amplifier. The setup is quite enough to make lots of noise and distorsion but also, so far, sample a kHz or thereabout sine wave at about 14 ksps and get a very decent tone in the speaker.sproc 2

The schematic is jotted down below and is not complex in any way. Specially the filter is “as it is” and “works”:)  The  A0 signal goes to channel 0 of the Arduino Uno A/D and the processor’s output drives the MCP4802 through SPI. The /LDAC-signal is grounded.sproc 1

As the Arduino software is slow and consumes at least one timer I have skipped that in favor of my old favourite Forth. The Arduino boot-flash is replaces with a FlashForth kernel. The FlashForth is a very clever devised environment that runs over a USB-to-serial line at 38400 baud. It makes prototyping live quite feasible and at least half of the joy of this signal processing excursion is to use Forth again. Where the forth’s inherent speed is not enough one can quite easily divert to plain assembler for that extra speed.

The actual sampling of the signal is administered with timer0 interrupt and currently some filtering (and I hope downsampling) is performed in the interrupt routine itself. So the micro controller’s hardware keeps up the speed in crucial places for now.

Forth as a language and kernel is somewhat geeky but actually works exceptionally well. Developing code is a bit like playing chess, tiling mosaic or making a soduko. Above all it is fun and efficient. What I have against it is the rather slow download, but as the the code has to be compiled and the flash memory programmed while downloading it perhaps is to be expected. If you are interested do not hesitate to try it out. Get your own copy of Mikael Nordman’s FlashForth at There is a hex-file and instructions at the site. Or you can get the code, compile it in Atmel studio and make your own version. It also runs on other ATmega-controllers as well as some in the PIC-series.

Perhaps I will publish code if I get anything decent up and running here. For now it is mainly a fun toy and an interesting refresh&relearn-curve.



This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s