Wednesday, May 8, 2013

Direct SSB generation by frequency modulating a PLL

The following code can generate SSB modulation just by controlling a PLL carrier. I have applied this method on the RapsberryPi PLL, and made several contacts on 40m and 20m band with my RaspberryPi.

I will explain the principle in more detail, later. The original idea is depicted here:

The original idea (as seen above) was to implement a complete SSB modulator and demodulator with software in a ATTINY45 micro-controller chip and a AD9834 as DDS. The software samples microphone signal with ADC and then derives the amplitude and phase of the audio signal. The amplitude and phase extraction is derived from the in-phase microphone signal and its 90 degree phase shifted quadrature signal (created by a Hilbert transform on the in-phase signal). The resulting phase is replicated on the oscillator signal of the DDS, and the amplitude information is used to change the drive-strength (current) of the DDS. The output of the DDS is representing a clean single side-band output SSB near the configured frequency.

To proof this idea is working, I implemented the algorithm on a RaspberryPi. In the RaspberryPi setup there is no DDS, but there is a digital-PLL on the micro-processor SoC which we can use for RF generation. By manipulating the Integer and Fractional dividers, a frequency can be generated from 0 to 250 MHz on GPIO4 pin with a resolution of about 20 Hz at 7 MHz. By alternating the Fractional divider between two nearby values, the resolution can be further increased to micro-Hz level; for this a 32 bit clock at 32 MHz is used to generate a PWM alike switching pattern between the two Fractional divider values.

The PLL oscillator can be phase modulated by short manipulations of the configured frequency. Increasing the frequency temporarily and then restoring to its original frequency, will shift the phase upwards, while decreasing the frequency temporarily will decrease the phase of the signal.
In this way the phase information for generating a SSB signal can be applied to the RaspberryPi PLL by means of frequency modulation. To do so, first phase differences are calculated for every sample. For each phase deviation (difference) the corresponding frequency change is calculated. This is dependent on the rate that the PLL is changed from frequency; the exact formula is: dev_freq_hz = dev_phase_rad * samp_rate_hz / (2 * pi)

The amplitude signal can be applied by changing the drive-strength of the GPIO4 port, which has 8 levels with a dynamic range of about 13 dB. After some experimenting, amplitude information can be completely rejected, instead the frequency must be placed outside the single side band (e.g. placed to center freq). In this case single side band is generated wihout suppressed carrier, i.e. a constant amplitude envelope is applied (good to prevent RF interference). In this case the audio quality does not seem to suffer from this constant amplitude, and the audio quality becomes even better by applying a little-bit of noise to the microphone input. My impression is that using SSB with constant amplitude increases the readability when the signal is just above the noise.

The RaspberryPi receives the Microphone input via an external USB sound device. To improve the SSB quality, the signal is companded by a A-law compression technique. Three parallel BS170 MOSFETs where directly driven by RaspberryPi GPIO4 output to create about 1Watt of RF. On 40m I could made several SSB contacts through Europe using this setup, receiving stations back by using a nearby online WebSDR receiver. From my location in south-Netherlands following contacts where made:

Fascinating work!! The logic seems to be the same used by standard SSB compressors where the voice is handled like a FM signal of medium frequencies AM modulated with a small index with a much lower frequency. Compressors just flattens the AM modulation increasing the average power. The quality of the voice can not be worse than the one of a compressed HF SSB signal. I see no reason why the same principle can not be used to implement a receiver, basically using the same signal (non modulated) as the LO of another RF source and mixing "in software". Very interested to reproduce your system in my bench, any way to access the entire setup? TU Pedro LU7HZ

SSB generation with constant amplitude sounds particularly nice, as you can make VERY efficient PA stages which do not need to be linear.. just what you need for QRP/SOTA I too would be VERY interested if you have working code posted :-) Hugh G6AIG

I think there is such a silence because this technique does not work.. sorry. Had a go at coding it myself, then realized you cannot get fundamentally AM sidebands by just FMing a constant carrier, no matter how cleverly.. anyone else had a go?Hugh G6AIG

Hello, I think that should be a joke. The code snippet I do not understand why only one cutout? No matter, as there are other projects in which one progresses. the small pc can be used as output device. keyword lima sdr from DARC. Note the effort which is operated to build a receiver and a transmitter. There's no PC case with. Just the filter board is a science in itself. Never managed that no one PI.

"some interesting conversation here"but almost all completely rubbish.I and Q stand for In-phase and Quadrature phase of already AM'ed signals.. not some kind of 'intellegence'. Please read up about Modulation Index, Bessel functions and FM sidebands.. you will quickly realize that AM and FM are worlds apart. If you try the constant-carrier scheme for SSB, you will get wide FM sidebands whatever you do! (just right to put into a 1.5kW amp on 40m) ! Hugh G6AIG

It certainly has some potential, there is a strong link between PM and FM, via instantaneous frequency. Frequency is the derivative of phase: http://www.ni.com/white-paper/3361/en/. Have yet to try the code though! What sort of filter have you implemented?

I'm very interested to find this code fragment and will certainly go away and have a go at making it work.

I have a contribution of my own, though a much simpler situation. An SSTV proof-of-concept for the Pi. In this case since SSTV is already a sequence of single tones I am just adding (or subtracting for LSB) each successive tone to the carrier frequency. It's SSB, but a very specific instance of it and not half as clever as the code here.

Thanks Guido! I have been coding SSB-transmitter with Teensy and AD9850 board, and code you published was very helpful.Also I tried your original idea with Teensy/AD9850, phase modulation with frequency altering, yes, it works.AD9850 have also "native phase modulation" so I use it now after all.

The method described here not necessarily applies the restoration part of ERR resulting in a constant amplitude SSB signal. Another difference is that the phase information is applied to the carrier by mean of frequency modulation; this is done via small frequency changes. This is done in such way that only one sideband is generated (in contrast to normal FM where there are lobes on both sides of the carrier). Because the there are no frequency changes for intervals when there is no modulation, a carrier becomes visible at the tuned frequency; temporarily disabling the carrier then will suppress the carrier.Another interesting discussion about constant amplitude modulation here: http://forums.qrz.com/index.php?threads/constant-amplitude-ssb-might-become-standard.405552/