Arduino Radio Spectrum Analyzer prototype on a breadboard: Difference between revisions

From NURDspace
mNo edit summary
No edit summary
Line 9: Line 9:


The full schematic and pcb design can be found [http://nurdspace.tk/~smokeyd/2.4GHz_radio_analyzer.zip in the zipfile]
The full schematic and pcb design can be found [http://nurdspace.tk/~smokeyd/2.4GHz_radio_analyzer.zip in the zipfile]
Code is available on https://github.com/dolfandringa/arsa


I want to set it up in several steps:
I want to set it up in several steps:

Revision as of 19:15, 5 March 2013

NURDspace Project
link=File:{{{Name}}}.jpg
Participants
Skills
Status
Niche
Purpose
Tool
Location
Cost
Tool category

{{{Name}}}Property "Tool Name" (as page type) with input value "{{{Name}}}" contains invalid characters or is incomplete and therefore can cause unexpected results during a query or annotation process. Property "Tool Image" (as page type) with input value "File:{{{Picture}}}" contains invalid characters or is incomplete and therefore can cause unexpected results during a query or annotation process. {{{Picture}}} {{#if:{{{Tool}}} | [[Tool Owner::SmokeyD | }} {{#if:{{{Tool}}} | [[Tool Cost::{{{Cost}}} | }}

I am building a Radio Spectrum Analyzer which measures signal strenght in the 2.4GHz band, using a CYWM6935 module and Atmega 328 MCU.

The full schematic and pcb design can be found in the zipfile

Code is available on https://github.com/dolfandringa/arsa

I want to set it up in several steps:

Setting up an Arduino on a breadboard

I first setup an arduino on a breadboard

Connecting the CYWM6935

Before you do anything with the Radio board, you need it's datasheet. The datasheet not only tells you what each pin means, but also its operating voltage, current usage, exact method of communication, etc. The more you understand of this stuff, the more you will appreciate the datasheet.

In this case you actually need two datasheets. One is the one for the module. But this module is powered by a CYWMUSB6935 chip, so the [datasheet for the CYWMUSB6935 chip will tell you more, especially on page 25 about DC characteristics (power usage, voltage, etc).

In those datasheets you can find that the MCU can communicate to the radio board using the Serial Peripheral Interface (SPI) Bus. This is a smart way for controlling peripheral modules/circuitry/etc from an MCU. You can read more of how it works on http://en.wikipedia.org/wiki/Serial_Peripheral_Interface. There is one snag here though. The breadboard and MCU run at 5V. The CYWM6935 runs at 3.3V though. So if you were to wire things up directly, you will blow up your radio module. This is the case both for the direct power supply to the radio module, but also for the SPI bus. So all voltages to the radio module need to be changed to 3.3V.

For the SPI you can use a simple voltage divider. I had to read up on what this was after someone told me to use one. I can very much recommend (e)book Practical Electronics for Inventors by Paul Scherz. It is a good book that explains electronics theory well, and gives you enoug examples to see if you really understand what is explained. For the impatient though: a voltage divider divides the input voltage over two resistors, where part of the voltage goes to ground, and the other part is used as a (lower) output voltage, to a next part of the circuit. The ratio between the two resistors determines the output voltage. For the SPI Bus, I used a 2.2kOhm resistor, followed by a 1kOhm resistor. Between these two, there is a wire which provides the intermediate voltage of 3.4V to the radio module. This is where those resistors were for that you may have seen on the previous pictures. In the picture below you also see them. We'll hook them up later.

5.jpg

In the picture above and the pictures below you see the connector that I used to hook up the breadboard to the CYWM6935 module. See [#cable_hack] for the exact way I hooked it up. For now it is important to notice the pin numbers on the connector. These are the pin numbers of the radio module, as specified in the datasheet. The order of the pins on the connector is a bit odd. The [#cable hack] part explains why, but they are the correct pin numbers from the datasheet.

First we'll hook up the ground (pins 1 and 9), and a PULLUP resistor to pin 10 (poweroff) to prevent the board from powering off unexpectedly.

7.jpg
8.jpg
9.jpg
10.jpg
11.jpg
12.jpg
13.jpg

Cable hack

To connect the CYWM6935 module to the breadboard, I created my own cable. I found a 2.5" Harddisk adaptor plug, which fortunately has pins on one side with the spacing for flat cables like floppydisk cables, and on the other side has holes with a smaller spacing, exactly the size of the CYWM6935. Using this plug, a (cut-up floppy disk) flatcable, some simple PCB and a few jumpers, I soldered something together that allowed me to connect the radio module to the breadboard.

I split a floppy cable that was lying around, so it had 10 wires left. On one side I left the connector in place. On the other side I cut off the connector and stripped the wires. I soldered each of these free wires to a PCB. On each of the lanes for these wires, a jumper pin was soldered, so I ended up with a 10-pin connector which fits the breadboard. There is one thing you should know about this connection (and could be done better). If you connect the wires this way, the order of the pins on the breadboard correspond to the CYWM6935 pins in a weird order. Their order is: 2,1,4,3,6,5,8,7,10,9. If you want the pins on the breadboard side, to correspond to the CYWMUSB6935 module in the correct order, you should twist around each pair of wires. This is how the cable looks now.

Cywm6935 connector cable.jpg

Connecting this plug to it, you can plug in the CYWM6935 module.

Connector cable with cywm6935.jpg

Programming the Atmega328

Creating desktop software for visualization

I chose to create a Java GUI using JFreeChart to read the data from the Arduino using an FTDI cable on a serial port (or actually USB) and visualize that in the GUI. The program can be found on Github.

This is a screenshot from the app. It allows you to reset the maxima by clicking the button.

Arsa screenshot.png

Assemble everything on a custom PCB