Cascata - an Arduino Waterfall by WA5ZNU

What is Cascata?

Cascata is an Arduino Waterfall display program built using the Arduino and the Sparkfun Color LCD Shield.

It has a selectable 0-4 kHz or 0-2 kHz audio range, and can display a waterfall, a spectrum graph, or both. It features variable attenuation and automatic DC centering.

Background

Ham radio operators use a signal visualization display called a "Waterfall" to plot signal strength and frequency against time on a scrolling display. This type of display is common in both digital mode radio programs and in software-defined radio displays.

Cascata is a simple project using an Arduino and a Nokia LCD color display to provide a pocket-sized display for field operations, or for computer-free operations.

Cascata requires a small amount of soldering and and can serve as an introduction to the Arduino for ham radio operators, or an introduction to ham radio for Arduino enthusiasts.

Video

Source Code

Here is the Arduino Sketch, including the updated LCD and FFT code:

The software is built using enhanced versions of the Mark Sproul LCD library and the FFT Code is the Roberts/Slaney/Bourras/DEIF FFT library with bug fixes in 8-bit conversion. All is included in the zip file, which you can unzip into your Arduino Sketches directory. It will create a new project called Cascata .

Operation

Top button switches modes: Display, Bandwidth, Attenuation

Buttons 2 and 3 are up/down. (The Sparkfun LCD Breakout Board doesn't have button 3, but the Arduino Shield does. Both buttons cycle through all the choices, so you can use this firmware with the 2-button version.)

Display: Waterfall+Spectrum, Waterfall, Spectrum

Bandwidth: 0-4 kHz, 0-2 kHz

Attenuation: -3, -2, -1, 0 1, 2, 3. Negative values are "gain".

The voltage reference is set to the internal 1.1v band-gap, and the bias network below sets the center point to about half of that value, when referenced to the 5v supply. The firmware automatically determines the DC reference point and the 0.1uF input capacitor AC couples the signal.

If your input signal voltage is too low, use the Attenuator adjustment to change to lower values.

LCD Construction

The SparkFun Color LCD Arduino Shield requires headers be soldered on.

A convenient option is the Sparkfun stackable header set. These headers allow easy access to the Arduino pins, but they stick up a bit above the LCD board and may make it hard to put in a case. If you have plans for build this project in a case, you may want to use a non-standard Arduino (such as the Ardweeny) and in that case you may want the SparkFun Color LCD Breakout Board, but you will sacrifice one button.

Interfacing

The Arduino 2009 and Uno have a choice among 5V ADC reference, internal 1.1V ADC reference, or external reference. 5V is too high for audio input, so we'll chose the simply 1.1V internal reference. A resistor divider produces approximately 0.55v using standard value resistors, and a 0.01uF capacitor tacked onto the bottom of the Arduino bypasses the VREF signal to ground to reduce noise.

I built my input network on a protoboard first, then "flying-lead" style, but you could put it on a small piece of perfboard and use header pins to attach to the LCD Shield. A 3.5mm audio jack completes the interface, which I plugged into the headphone jack of my radio.

Tack a 0.01uF capacitor on the bottom of the Arduino from VREF to ground. Install the Arduino LCD Shield with socketed headers. On the shield headers, put a 15 k Ohm resistor into the Arduino 5V pin to the ground pin below the LCD. Solder a 1.8 k Ohm resistor from the ground side of the above resistor. Put the other end into Analog input 1. Solder a 0.01 uF capacitor to the 1.8 k Ohm resistor at the Arduino analog input 1 pin. Input voltage should be +/- 0.5v max.

Drawbacks

Noise: The default value of the Attenuator is 1, which eliminates the LSB of ADC and cuts down on some of the noise. The 0.1uF capacitor added to the bottom of the Arduino board before VREF and ground helps with the noise some, but doing any better would require quiescing the CPU before the ADC measurement, further reducing the signal bandwidth and processing time available.

Sample time: Sampling at 8kHz takes 125μs, and it takes 100μs for each ADC operation. That leaves only 25μ per sample or 6.4ms for a 256 sample row. That's not enough time to do the FFT or Display, so we drop samples between lines.

Future Directions

Cascata is designed to be a project for you to undertake and extend. Here are some ideas for ways to move forward:

Put it in a box? The SparkFun LCD board doesn't fit nicely in the SparkFun Arduino Shield Case, however with the Sparkfun Color LCD Breakout Board and the SolarBotics Ardweeny and a 5V regulator, you could make a much smaller device in a nice case. Decode PSK31? Add a mode to disable display and decode PSK31. Is there enough time in 6.4ms/row to do the decimation, filtering, phase detection, bit decoding, and Varicode conversion? Make it faster? At 16 MHz, the Arduino is a wonder at getting this DSP done. Switch to a 72 MHz Maple Board and you could have enough cycles left over to do something really interesting. Expand the bandwidth? Can you use aliasing to sample a much wider bandwidth? Since the output display size is limited to about 128 pixels, you would need to do decimation anyway. Narrow the bandwidth? David (WB4ONA) asks if you could narrow the bandwidth to 200 Hz, for use as a display with QRSS or other ultra-low bandwidth modes. I think you need to integrate over time; perhaps the Joe Taylor (K1JT) WSTJ source code would be a good start for techniques. Oscilloscope Output? Instead of an LCD display, display on an attached oscilloscope using a single DAC (either an I2C DAC from SparkFun or an op-amp/integrator DAC). Use one of the digital out pins for trigger. You could use a green-screen CRT scope, or a portable digital scope that you already have. You won't get a waterfall, but instead a spectrum display.

Similar Projects

Arduino Realtime Audio Spectrum. This turned up in searches when I looked for Arduino FFT and I got a lot of ideas from here. It's good to be able to share ideas across ham and Arduino projects. I found a link to the FFT from reading this post, but had to fix a few bugs to make it work at 256 samples.

Gabotronics XProtolab GT-0010 This is a great board and I recently bought one. The framework source is available, including an ASM version of FFT, but the DSO source isn't open.

Mentions

Thanks for Hack-a-day for publishing a complimentary writeup: Waterfall signal visualizer from Arduino and cellphone LCD under their neat-o radio hacks tag.