Category Archives: Hardware Projects

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 . You can see the first revision of the code here:

Main sketch:
LCD Header:
Rssi library header (rssi.h):
Rssi Library (rssi.cpp) :

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).,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.



Spectrum Analyzer – Part II

You can read part 1 of this project here. So, at the end of the last post we established that we can use the radio module to scan all channels on the 2.4ghz band and have a basic spectrum analyzer, but how does it all get put together? Well, the only real requirement of the project is that it be able to communicate with the radio module (over SPI) and a display, I could go with just about any microcontroller (read: the chip that is the brain of the project). So, I turned to my favorite chip that I use for the vast majority of my projects: the Atmega328 (in case you have no idea what that is, my intro to microcontrollers is coming soon) , and so that I could easily share my project with a large community and prototype the code really quickly, I went with the Arduino bootloader. So now that we have the micro and the radio chip, we just need a display. I went with the Nokia 5110 LCD, a very cheap graphic LCD that uses SPI, the same interface as the radio module.

Nokia LCD

Now that I have all the necessary parts, there’s just one catch: the LCD and the radio module both communicate with 3 volt logic levels, and the Atmega uses 5 volt signaling. Since I didn’t want to fry either of them, I grabbed a few mosfets to bring the 5 volts down to 3 volts and vice versa. So an hour or so of painstaking breadboarding later, I was left with this:

Isn't it beautiful?

Time to turn it on! I wired it up to power, and… then came the magic blue smoke . I had wired the backlight LEDs of the LCD to 5 volts instead of 3. Oops! I fixed the wire at fault and powered it up to see a functioning (albeit dimmer) display.

One annoying dilemma I had was that the radio module’s pins are spaced 2mm apart, instead of the universally standard .1 inches. I mean, clearly whoever was designing the module just wanted to be inconvenient. So I came up with the following elegant solution:

I call it, Chip on Wire

With that done, I shifted it all over to a permanent circuit board, and ta-da! My only additions were 5 volt and 3 volt regulators and a button to switch between modes, which I will discuss in the third post, on software.

That’s my thumb!

And there you have it. My final post of the series will be (finally) about the software that runs the contraption. If any of the hardware-speak scared you, I promise, help is on the way! I’m working on an intro to embedded electronics which I will post soon. Until then, enjoy the spectrum analyzer!

2.4ghz Spectrum Analyzer – Keep an Eye on Your WiFi

(If you want to get a shorter summary of this build explanation, my project was written about here and here , and you can find my original post on the subject here )

Over the summer, I got bored. To be precise, I got bored a lot. One of the times I got bored, I pulled out my magic parts bin, and found this:

Oooh a circuit board!

Hey! A radio module! That’s neat. I can use that to send data wirelessly. One problem: I only had one of them. That would be one lonely (or schizophrenic) radio module, talking to itself all day. So, I turned to my good friend, the datasheet (a lengthy document that exists for just about everything electronic, detailing everything about it), for ideas. You’d be surprised how many cool things you can learn from those hopelessly long, boring, behemoths of seemingly useless information (also, they are a remarkable cure for even the most persistent of insomnias). And after some painful sorting through confusing diagrams, lo and behold, I found an idea! Now, I know you’re jumping out of your chair because you can’t wait to hear this idea, but I want to harness that excitement to give a quick disclaimer: I said this blog was about programming, and it is, amongst other things. However, some of my favourite things to program are things I’ve built myself, and well, I have to build them first. So if you’re terrified of embedded electronics, if you don’t even know what embedded electronics are, or if you’re already completely lost, hang tight. I’ll try to make the rest of this post fairly accessible, and I hope to have my introduction to embedded electronics post available soon.

Now: back to the thrilling saga of the lonely wireless module. Well, I learned two big things from the datasheet. First, the module operates in the 2.4ghz range, which is neat. What this means is that this chip is used to send and receive data along some of the same frequencies (think of them like stations on a TV or radio) that WiFi routers, cordless house phones, bluetooth, RC cars, cameras, and many other things transmit on. Relating to this, I found the second cool thing, which is that this module has digital RSSI (Received Signal Strength Indicator). Acronym-free translation: I can tell it to go to any channel (station) on the airwaves (in the 2.4 range), and it will give me the total power of everything transmitting on that station in the area. Boom! I had my project. If I could make it scan through all of those channels really quickly, and then display it, I can make a poor man’s spectrum analyzer, a tool used to give the user a detailed picture of all the wireless things operating in the area. Commercial grade, fast versions of these sell for anywhere between $50 and $1000.

Stay tuned for part two (hardware), and part three (software)!