Friday 22 November 2013

Finalizing the design of the Raspberry Pi Wobbulator PCB

I've been experimenting with the AD8307 logarithmic amplifier from Analog Devices as a potential replacement for the discrete buffer amplifier / detector stage I used in the Raspberry Pi Wobbulator prototype.

The following screenshot shows the frequency response of an RF crystal as measured by the AD8307 logarithmic amplifier. The horizontal line near the top of the screenshot is the plot obtained when the output from the DDS module was connected directly to the input of the AD8307 log amp.


Compare the above plot to the plot shown below which was obtained when the same frequency sweep was performed but the response was measured by the discrete buffer amplifier /detector stage.


The plot obtained when using the discrete buffer amplifier / detector stage has much more pronounced peaks, but it should also be noted that the frequency of the primary response peak is noticeably higher than when using the AD8307 logarithmic amplifier. I can only assume that the coupling capacitors used on the input to the AD8307 effectively "pulled" the resonant frequency of the RF crystal lower. The horizontal line in the above plot was obtained when the output from the DSS module was connected directly to the input to the discrete buffer amplifier / detector stage.

From the results above It is clear that the AD8307 and the discrete buffer amplifier / detector stage both have their own strengths and weaknesses, so I've decided to include both on the Raspberry Pi Wobbulator PCB! The proposed schematic for the Raspberry Pi Wobbulator PCB is shown below.


The proposed design has an output from the DDS module ("RF OUT"), and two inputs, one of which is connected to a discrete buffer amplifier / detector stage ("RF IN LIN") and the other of which is connected to a AD8307 logarithmic amplifier ("RF IN LOG"). All connections are in the form of PCB mounted SMA sockets, as well as PCB pins.

The outputs from the discrete buffer amplifier / detector stage and AD8307 log amp are connected to channels 1 and 2 on the MCP3424 ADC chip. The other two channels on the ADC chip are terminated in PCB pins so that these channels can be used with an external detector, or just used as general purpose analogue inputs.

I'd welcome any comments on (or corrections to) the above schematic because I'm currently putting the finishing touches to the PCB layout, and once this is completed I will be placing an order for a batch of PCB's to be manufactured.

Wednesday 20 November 2013

Bias Compensation option added to the RPi Wobbulator software

The Raspberry Pi Wobbulator software has been revised in line with the changes made to the hardware. As a consequence of using the onboard ADC chip instead of the ADC Pi module, the number of user selectable input channels has been reduced from 8 to 4.

I've also introduced a user selectable "Bias" feature which allows the user to choose whether or not to compensate for any bias on the signal going into the ADC. In the initial version of the Raspberry Pi Wobbulator software, bias compensation was performed by default, and could not be disabled. However from my experience using the RPi Wobbulator I realized that compensating for bias is not always desirable, so decided to make it a user selectable option.

When a frequency sweep is performed with the "Bias" compensation option enabled, the "bias" is measured first by measuring output from the detector stage with the DDS turned off .Then the sweep is performed, and the previously measured "bias" is subtracted from each measurement taken. When the "Bias" compensation option is not enabled, the sweep is performed and each measurement is plotted without performing any subtraction.

The following screenshot shows the revised GUI and demonstrates the use of the "Bias" compensation feature. The two red plots are the result of running a sweep with PGA gain set to 1 and then again with it set to 2, without bias compensation selected. The two blue plots are the result of running the same sweeps but this time with the bias compensation selected.


You can see that without bias compensation (red plots) when the PGA gain is increased from 1 to 2 the central peak doubles in height but the whole plot also moves up the screen. When the same sweeps are repeated with the bias compensation option enabled, the central peak doubles in height, but the bottom of the plot stays in (more or less) the same position.

However, if there is a significant bias on the signal going into the ADC chip, using the "Bias" compensation option can lead to "clipping" of the frequency response plot as demonstrated in the following screenshot.



This time the two blue plots are the result of running a sweep with PGA set to 4 and then again with it set to 8, without the bias compensation selected. The two red plots are the result of running the same sweeps but this time with bias compensation selected. You can see clearly that the uppermost red plot has been "clipped" quite severely - this is due to the ADC input becoming "saturated" because of the large bias on the signal.

The revised source code (version 1.1) for the Raspberry Pi Wobbulator software is available on GitHub.



Saturday 16 November 2013

Developing the Raspberry Pi Wobbulator design

I've been developing the design of the Raspberry Pi Wobbulator with a view to producing a self contained plugin module for the Raspberry Pi, either as a fully assembled unit or as a PCB and kit of components. This has raised a few fundamental design issues along the way, such as:

  • Use the off-the-shelf DDS module or design my own DDS using the AD9850 chip?
  • Use surface mount or through hole components?
  • Use an onboard ADC instead of the ADC Pi module?
  • Can the buffer amp / detector stage (currently a completely separate module) be incorporated into the Raspberry Pi Wobbulator PCB design?

I've been exploring various options and trying out different configurations in an attempt resolve these issues.

Use the "Off-the-shelf"  DDS module or design my own?

The type of DDS module I use is widely available on eBay and elsewhere, and has been used in various different amateur radio related projects. The module is cheap, small, and easy to use, and quite honestly I don't think I could design and build anything as good for the money! Therefore I've decided to use the off-the-shelf DDS module instead of designing and building one from scratch. The Raspberry Pi Wobbulator PCB will be designed so that the DDS module can either be soldered in place or simply "plugged in". The plugin option opens up the possibility of being able to easily replace the DDS module with a higher spec one (based on the AD9851 or AD9852 chip) should such a module become available.

Use "Surface Mount" or "Through Hole" components?

If the Raspberry Pi Wobbulator will be supplied as a PCB and kit of components, then this is an important issue. However using only "through hole" components seriously limits the choice of components available, and is also becoming an ever more expensive option. Having tried using surface mount components myself and also having conducted a (very unscientific) poll on the Raspberry Pi Wobbulator Yahoo group I've decided to use surface mount components where possible. Some surface mount components are so small that they really aren't suitable for manual assembly, so I'll have to choose the components with care.

Use an Onboard ADC instead of the ADC Pi module?

This one was a "no brainer" - using an onboard ADC is definitely the way to go! It will work out a lot less expensive and will mean that the PCB can connect direct to the GPIO pins on the Raspberry Pi rather than be "stacked" on top of another board. The ADC Pi module uses a pair of MCP3424 ADC chips, and I'm happy to stick with these, although one chip (which has 4 input channels) would suffice. These are only available in surface mount packages, but they are available as SOIC packages which are not too small for manual assembly.

The Adafruit prototype board I used in the construction of the Raspberry Pi Wobbulator has a SOIC surface mount chip breakout area, so I obtained a MCP3424 chip from Microchip and had a go at soldering it in place. The result wasn't too bad for a first attempt - the ADC chip is on the bottom right of the following photo.



I've since connected the MCP3424 up to the GPIO pins and tested it and I'm pleased to say it works perfectly with the original software. The only modification I need to make is to give the user a choice of 4 input channels instead of the 8 that were available on the ADC Pi module.

Can the buffer amp / detector stage be incorporated into the Raspberry Pi Wobbulator PCB design?

The original Raspberry Pi Wobbulator prototype was constructed with the Buffer Amplifier / Detector stage completely separate from the rest of the circuit, with it's own power source (PP3 battery). It was constructed in a die-cast Aluminium box to provide good shielding (see my previous post for full details). I really needed to find a way of incorporating the buffer amp / detector stage into the Raspberry Pi Wobbulator PCB.

In the meantime however I came across the AD8307 chip from Analogue Devices. This chip is a Logarithmic Amplifier and it produces a DC voltage at it's output which is proportional to the level of the RF signal on its input, expressed in Decibels (dB). In other words the output from this chip is proportional to the log of the RF signal strength on its input. However this is a sensitive device and needs to be well shielded.

The AD8307 chip is available in through hole DIP as well as surface mount SOIC packages, so I obtained a through hole DIP device and mounted it on the Adafruit prototype board in an IC socket. I hardwired the output from the AD8307 chip to the input of Channel 1 on the MCP3424 ADC chip and tried it out by repeating the test of the RF crystal (see this previous post for details). The results are shown below:


The blue plot shows the response of the crystal on its own and shows the resonant frequency to be 14070000 Hz. The red plot is the response of the crystal with a 10pF capacitor connected in parallel across the crystal, and shows the resonant frequency to be about 14067500 Hz. I was very pleasantly surprised to see that even though the AD8307 was not shielded, noise did not seem to be a major problem. Certainly based on the results of this test, using the AD8307 warrants further investigation

The following photo shows the modified Raspberry Pi Wobbulator prototype with onboard ADC chip (bottom left) and onboard logarithmic amplifier chip AD8307 (bottom right).


So there you have it! I believe I've developed the design of the Raspberry Pi Wobbulator to the point where it is perfectly faesible to design a PCB as a simple plugin module for the Raspberry Pi, and this is what I will be concentrating my efforts on over then next few days and weeks