Saturday 26 October 2013

Developing the Raspberry Pi Wobbulator Software

The Raspberry Pi Wobbulator software was all written in Python 3, which seems to be the programming language of choice as far as the Raspberry Pi community is concerned, perhaps because it comes ready to use with the Raspbian "Wheezy" operating system. The software was written using IDLE 3 (the Python 3 Integrated Development Environment supplied with  the Raspbian "Wheezy" operating system). To launch IDLE 3, double click on the IDLE 3 on the LXDE desktop. This will open the "Python Shell" window as shown below.


From here you can enter commands directly for immediate execution, or you can open a Python file to work on, or create a new file by clicking on the "File" menu and choosing the appropriate action.


The Graphical User Interface (GUI) for the Raspberry Pi Wobbulator was designed and programmed using Tkinter - the GUI programming toolkit supplied with Python. Although it is not a WYSIWYG GUI design tool, Tkinter is the most commonly used GUI toolkit, and can be used to create simple GUI’s fairly easily. For details of the Tkinter package and links to Tkinter documentation, please visit the Python website. There's also an excellent online Tkinter reference written by John W. Shipman if you're interested in learning how to use Tkinter. A screenshot of the Raspberry Pi Wobbulator GUI is shown below.


The user can enter parameters for the frequency sweep along the bottom of the screen. The various buttons down the right hand side of the main window allow the user to select the input channel (Ch) on the ADC Pi module, the gain for the PGA, and the line colour used to plot the response curve. The “RUN” button initiates the frequency sweep, and the response curve of the circuit under test is plotted in the “results area” (the large cyan coloured area taking up most of the main window). The X-axis on the results area represents frequency from the “start frequency” on the left to the “stop frequency” on the right and the Y-axis represents the magnitude of the signal passing through the circuit under test, as measured by the ADC Pi module.
The user can choose whether or not to display a grid over the results area, and the “CLS” button clears the results area of any previous plots.

Event handlers were written for the various GUI “widgets” and the test code for the DDS module and ADC module was modified and incorporated into the program to implement the low level communication between the hardware modules and the Raspberry Pi’s GPIO header.

The source code for the Raspberry Pi Wobbulator can be downloaded from Github, or you can use the "git clone" command to download a copy of the repository on to your Raspberry Pi. To do this, type the following at the command line prompt and press Enter:

pi@raspberrypi ~ $ git clone https://github.com/mi0iou/RPi_Wobbulator.git_

When you execute this command, a new folder called "RPi_Wobbulator" will be created under "/home/pi" and the source code (and other files) will be downloaded and saved in this folder. You will see the following messages in the terminal window (or at the command line prompt) as this takes place.



Now if you launch IDLE 3 you can open the file "rpi_wobbulator.py" and run it by selecting "Run->RunModule" or by pressing "F5".




In my next posts I'll discuss some of the results obtained when the Raspberry Pi Wobbulator was used to examine the frequency response characteristics of an RF crystal, an IF transformer, and a multiband bandpass filter.

2 comments:

  1. Hi Tom

    Are you familiar with PHSNA@yahoogroups.com ? This is a yahoo group developing a similar system to yours, but using an Arduino to run the DDS and digitise the RF power monitor output (an AD8307). I have just received the PCBs which allows me to build a 'shield' onto the Arduino. The serial o/p from the Arduino is then sent to a PC or similar. Unlike the US group, though I intend to use a Chipkit Pi pic32 dev board which directly interfaces with the Pi, and has the Arduino pinout on its topside. I will be looking at your Python code to see how useful this will be for my purposes. I think the Pi makes a great low cost "wobbulator" since the display side is so good. Seems we are all thinking along the same lines. Have you also seen the Spectrum Analyser use of an RTLSDR cheap stick with Linux - I have got this working on the Pi (see http://eartoearoak.com/software/rtlsdr-scanner )
    best regards
    Tony

    ReplyDelete
  2. Hi Tony, thanks for the information. No, I had not come across the PHSNA group, but I agree, it is a similar concept. The AD8307 looks very interesting - I'll have to look into whether it would be suitable for the "wobbulator". I have experimented a little with the RTLSDR dongle, but had trouble getting it to work under Linux. Ultimately I had wanted to use it with the Raspberry Pi, but it looks like you've already cracked that one - I'll have to see if I can get mine working on the Pi. Thanks again, Tom

    ReplyDelete