Wednesday 8 January 2014

Setting up and Testing the Raspberry Pi Wobbulator - Part 2

Before downloading and running the RPi Wobbulator software, there are a couple of small adjustments that need to be made to the Raspberry Pi hardware, and the following adjustment procedure will also serve as a check that the hardware is working as it should.

I've written a small program called RPi Volt Meter to help you make the necessary adjustments. The source code for the program can be downloaded from Github, or you can  you can use the "git clone" command to download a copy of the program and associated files 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_VoltMeter.git_

When you execute this command, a new folder called "RPi_VoltMeter" will be created under "/home/pi" and the source code (and other files) will be downloaded and saved in this folder. Launch IDLE 3 and open the file "rpi_voltmeter.py". Run the program by selecting "Run->RunModule" or by pressing "F5".




The RPi Volt Meter window should now appear:


This simple program allows the user to measure the voltage on any one of the four input channels on the ADC chip on the RPi Wobbulator PCB. Channels 1 and 2 are the two input channels for the RPi Wobbulator. Channels 3 and 4 are not used but are terminated with PCB pins so that you can measure any external voltage connected to the pins. The maximum voltage the ADC chip can measure is just over 2 Volts DC.

Leave Channel 1 selected and measure the voltage by clicking on the "Measure" button. Since at this point there is no signal being fed into Channel 1 this will measure the quiescent bias voltage. When I did this, I found that the voltage was about 2 Volts. This is far too high and is causing the input to the ADC chip is totally saturated. Turn the adjustment screw on VR1 screw anti-clockwise, taking a measurement of the voltage after each adjustment is made, until the bias voltage comes down to about 0.1 Volt.


Now select Channel 2 and measure the quiescent voltage. I found that it was about 0.6 Volts. If the measured voltage is not around 0.6 Volts, turn the adjustment screw on VR2 until you get a value of 0.6 Volts (or just under)


VR2 provides very fine adjustment of the quiescent voltage from about 0.3 Volts to just over 0.6 Volts. This corresponds to a variation in the "Slope" of the output from the AD8307 Log Amp of between about 11 mV/dB and 22 mV/dB respectively, so setting the quiescent voltage to about 0.6 Volts corresponds to Slope of  about 20 mV/dB.

Enough tinkering! If all has gone well you can now close the RPi Volt Meter window, and then close the source code file "rpi_voltmeter.py".

Now its time to download and run the Raspberry Pi Wobbulator software. Once again, the source code for the Raspberry Pi Wobbulator software 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. If it isn't already running, launch IDLE 3 and open the file "rpi_wobbulator.py". Run the program by selecting "Run->RunModule" or by pressing "F5". The RPi Wobbulator window should appear:




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 chip, the gain for the PGA (on the ADC chip), and the line colour used to plot the response curve. The user can choose whether or not to display a grid over the results area using the "Grid" check box, and the "Bias" check box activates the bias compensation feature of the software. The “CLS” button clears the results area of any previous plots and the “RUN” button initiates the frequency sweep.

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  chip.

So that's it! The Raspberry Pi Wobbulator is now ready for action...

In my next post I'll explain how to use the Raspberry Pi Wobbulator to examine the frequency response characteristics of an RF crystal, and this also serves as a good way to check that the hardware is working as it should.

3 comments:

  1. Hi Tom

    I'm struggling to get the code working on my R Pi. I believe I have followed all your posts, and can get the rpi_voltmeter code running fine, so the i2c and its permissions are OK and the ADC is working OK after fixing a dry joint. However I am getting the dreaded "No access to /dev/mem Try running as root!" from line 40 - GPIO.setup(W_CLK, GPIO.OUT) in the wobbulator code.
    I have tried to set up a rule for the GPIO in udev, but not succeeded. Are you running python from sudo or have you got the correct permissions set up somewhere?
    frustratedly,
    Tony

    ReplyDelete
  2. Hi Tony,

    Yes, I'm running Python with sudo privileges.

    I run IDLE3 using sudo as detailed in this blog post:

    http://asliceofraspberrypi.blogspot.co.uk/2013/10/connecting-dds-module-to-raspberry-pi.html

    Kind Regards,

    Tom

    ReplyDelete
  3. Hi Tom,
    I finished up the Wobbulator kit yesterday, and I wanted to thank you for a great quality kit and the helpful posts here on this sight. The Wobbulator fired up just great, and made easy measurements of some crystals that I had sitting around on the bench.
    Next up is some long awaited filter tuning.
    By the way, for anyone reading these comments while building - run some electrical tape along the ethernet port on the RPi because the leads on the trimmer pots can short out on the ethernet case when you are performing the bias adjustments. Luckily, there is no damage done, and simply causes the RPi to reset.
    Tom VA3AKB

    ReplyDelete