Spectrum Analyzer – Part III: Finally, the Software!

You can read parts 1 and 2 of the series here and here.

When we left off, we had a working spectrum analyzer … except, it didn’t do anything. Which is why this is the fun part.

Basically, all the code had to do was poll the radio module for the signal strength on each channel. This was fairly simple, especially with the radio functions at ea4eoz.ure.es . You can see the first revision of the code here:

Main sketch: http://codetidy.com/910/
LCD Header: http://codetidy.com/911/
Rssi library header (rssi.h): http://codetidy.com/912/
Rssi Library (rssi.cpp) : http://codetidy.com/913/

So I uploaded the code, and with a little tinkering, it worked! I walked around the house and was able to see my router, cordless phone, bluetooth speakers and wireless mouse all transmitting! I even saw a huge blip for the radiation from my microwave oven when I cooked some popcorn. Here is a video of the early hardware:

Now that the basic functionality was working, I decided to add some extra features, because a battery powered, handheld microcontroller with an LCD is a pretty powerful platform to make a neat little device. I wrote a quick ADC routine to make it act as a simple oscilloscope, and a multimeter. I then played around with some different ways of reacting to the signal, and got the idea from the radio site above to draw the highest recorded value for each channel, only increasing, and never decreasing. I left this on for around half an hour, and it gives a interesting picture of long-term spectrum use in the area. Lastly, I added a push button connected to one of the hardware interrupts on the Atmega, to switch between modes.

One of the reasons why I love prototyping with Arduino is the community. I posted about this project there, and got a lot of very, very clever suggestions from forum members that made the code much, much faster. Thanks especially to Rob and Chris for their input. These fixes aren’t implemented in the code above, but you can read about them here (just keep scrolling – there’s a bunch). http://arduino.cc/forum/index.php/topic,67218.0.html One optimization of my own which I made was changing the LCD logic voltage from 5 to 3 volts. While it says it can work at up to five, I noticed a significant improvement in speed drawing to the LCD with the change in levels.

Well, that just about concludes my spectrum analyzer series! If you have a questions or comments, don’t forget to comment or write me at thinkfortytwo at gmail dot com.



Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: