Teensy Convolution SDR (Software Defined Radio)

From my experience, if you want to look behind the theory in the Teensy Convolution SDR, I would recommend reading three sources at the beginning (Wolfgang: you probably already know most of these):

https://github.com/DD4WH/Teensy-ConvolutionSDR/wiki/Links-&-Resources

First: Youngblood (2002) part 2

Second: Whiteley (2011)

Third: Borgerding (2006)

With these three, you are already quite well prepared for further challenges.

73 Frank DD4WH
 
Last edited:
I uploaded a new version of the Teensy Convolution SDR code into the github:

* EEPROM_LOAD message copied into header of the file
* no more hanging when there is no SD card inserted
* added many nice optimizations by Bob Larkin --> thank you, Bob !!!

All the best,

Frank DD4WH
 
Good news:
Now the next step (living display, control of the SI5351) is done!
Thank you very much, Frank, for your hints. (Inside the 10300 lines I wasn't able to find the comment after line 1734.)
Now it's time to mount and solder the 5 remaining buttons, and the I / Q input. (Before I do so, I will test my QSD with a PC program, HDSDR.)
Thanks a lot, also for the literature notes!
73, Wolfgang
 
More good news:
Now the receiver is running. In the moment I cannot hear anything, but the spectrum seems to be correct, and the right audio output connection I hope to find soon.
Very glad about this nice receiver!
Because of using a touch screen my next goal is to make it work.
73, Wolfgang P1050430.jpg
 
Now my receiver works, very well!
Connected to my 80m dipole, I can hear ham radio stations in good audio quality, better as with my IC706.
A mistake from me: false LSB/USB assignment .Changed I / Q connectors -> all ok.

The lack of attenuator and LPF was no problem until now.

Thank you, Frank, for the new informations (Wiki "Menu")!
Wolfgang

P1050440.jpg
 
When testing the device, I noticed a few things that needed improvement:

- There are two menus through which you can move with two up / down buttons.
- Menu 1 contains 19 points, Menu 2 even 34 points.

So sometimes you have to press the keys quite often,
but above all, without a list you can not keep track of the whole thing.
The device has a graphics screen!

Here I will start to improve the usability.
 
Hello Frank,
I have the following problem with FM reception :
my strongest transmitter sends at 99.7 Mc.
I tune to 33,233 Mc, but the audio is very distorted, only in AM mode to understand.
What do I wrong?

Thanks, Wolfgang
 
Hi Wolfgang,

for wideband FM reception, the SDR is in 3x undersampling mode, so your math is approximately right, if you divide the real receive frequency by 3 :)

However, in all demodulation modes -except for WFM- the SDR uses a digital IF of 1/4 * sample rate.

Lets say you chose a sample rate of 234k, which in reality is exactly a sample rate of 234375Hz

That is why the display would show ( 99700000 - 3/4 * 234375 ) / 3 = 33174739.6Hz, which is exactly what is displayed when you do the following:

* adjust sample rate to 234ksps
* Set demodulation mode to WFM
* tune to 99.70MHz
--> the frequency display automatically does the math for you, it shows the real receive frequency :).
* listen to fine audio
* set demodulation mode to something else: the display shows 33.174.739Hz (and you know why it shows this ackward figure)
* set demodulation mode to WFM (the display shows: 99.700.000Hz) and continue to listen :)

For wideband FM reception, you need a very large sample rate, because an FM signal has +-75kHz frequency deviation. According to Wikipedia, this corresponds to a modulation index of 5, which leads to a needed bandwidth of 180kHz for MONO FM reception. So for nice MONO audio, you need at least 192ksps sample rate.
For STEREO you would better have a bit wider bandwidth, so I choose 234ksps. According to Wikipedia, you would need 270kHz of bandwidth (Carson formula: Bandwidth = 2 * frequency deviation * base band bandwidth [60kHz]) for all components of the FM signal: the L+R signal, the 19kHz pilot carrier, the L-R signal centred at 38kHz and the RDS data signal centred at 57kHz (RDS decoding is not -yet- implemented). Dont try WFM with the standard sample rate of 96ksps, it will sound extremely distorted, because the frequency deviation is +-75kHz and the signal will be aliased with such a small sample rate and unwanted signals will fold into your FM audio baseband.

All the best 73s

Frank DD4WH
 
Last edited:
Sorry, I made a mistake: the Carson formula for the approximate bandwidth of an FM-modulated signal is the following:

Bandwidth = 2 * (frequency deviation + baseband bandwidth of the audio signal)

For an FM radio signal you have 15kHz of MONO audio (L+R), the pilot tone carrier at 19kHz, the L-R DSB signal centred at 38kHz and the RDS signal at 57kHz, that corresponds to a baseband bandwidth of approximately 60kHz. The frequency deviation of an FM radio signal is 75kHz. This holds for Europe, in other parts of the world there are additional digital data services and other frequency deviations, so the band width could be even higher.

Europe -->
Bandwidth = 2 * (75kHz + 60kHz) = 270kHz

So we should use the sample rate of 281ksps for optimum wideband FM reception. However, the Teensy 3.6. comes to its limits at this high speed. The FM demodulation has to be done at this high sample rate and it uses the processor intense atan2f function and a complex multiply. [maybe the T4 will help here and allow for high speed stereo demodulation and simultaneous RDS decoding ;-)]

All the best,

Frank
 
Greetings from a newbie very attracted to this project. Hope it is still alive and well... and the knowledgeable people who brought it to its current state.
My particular interest would be gaining first-hand experience of binaural listening under a variety of conditions in LF/MF/HF broadcasting.
For me to do this, it is particularly important to be able to try a range of different settings using a recorded IQ stream.
It seems IQ recording/playback was an intended feature but, as far as I can tell, this has not yet been released.
Any update would be gratefully received.
Kind regards
Paul
 
Hi Paul!
You probably already know this WIKI site on binaural listening with the Teensy Convolution SDR:

https://github.com/DD4WH/Teensy-ConvolutionSDR/wiki/Binaural-audio-=-pseudo-Stereo-demodulation

At the moment, I have implemented three "Stereo" demodulation modes:

  • IQ: listen directly to I and Q without any demodulation
  • Stereo SSB: listen to demodulated LSB on the right ear and demodulated USB on the left ear
  • Stereo SAM: this is a Stereo version of sideband selected synchronous AM demodulation, i.e. a PLL which locks to the carrier of a station and sends the lower sideband (SAM-L) to the left ear and the upper sideband (SAM-U) to the right ear
To my knowledge, these are more binaural options than any commercial transceiver on the market at the moment can deliver ;-). Feel free to try these options on LW, MW or HF.

However, recording audio or I & Q is not implemented at the moment (well: audio recording is implemented, but does not work properly because of a lack of free memory). To be honest, I do not believe it is possible with the Teensy 3.6., because nearly 85% of the memory is being consumed for the main filtering and other real time audio stuff, so there is no more memory headroom for recording, especially not for stereo recording of I & Q. But hardcore programmers surely will be able to squeeze more out of the code ;-).

But I also am convinced that you do not need to record in order to experiment with binaural listening, just use one of the three implemented options in real time and enjoy.

All the best,

Frank DD4WH
 
Hi Paul!
You probably already know
Really good of you to come back, Frank, and so quickly.
Yes, I came across this thread and the github stuff - quite by accident when I was searching for anything new on binaural. It's a big puzzle to me why you hadn't come up before during extensive searches.
Anyway... binaural has been something of an obsession for me since the late 1960s - when the principle and working technology were already 20 years old!
Have been SWL intermittently ever since, and always on the lookout for receivers or adapters with this feature. No soldering skills or much programming experience meant something off-the-shelf was needed.
Fast-forward to retirement and I'm saddened that (as you say) there is no kit out there offering (true) binaural. Pseudo implementations are just that :). Seems to me, demonstration/education is lacking and it crossed my mind that one or two well-crafted YouTube videos might help to convince a (certain) busy SDR program author to make time for a proper implementation.
So, with extremely limited funds I'm toying with the idea of gradually replicating something like your full receiver (giving up only when I've fried too many components).
The question about IQ recording was prompted because a "scientific" investigation needs many experiments on repeatable scenarios, ending up with a video example of each situation/technique of interest.
I do sympathize with your predicament (after more reading/education last night) and am coming round to the idea of using a second Teensy fed by DMA to handle recording, probably to SSD over USB 3.0.
Paul Stoffregen's inspirational TDM project is very thought-provoking, though I wouldn't know if it can be adapted for Teensy-Teensy transfers. One notable "hit" for me was its potential to be extended to another obsession of mine: a multi-source audio controller for switching and routing (with a little bit of processing) the output from several SDR sources (preferably coherent as in RSPduo) for parallel channel comparison or diversity reception.
Enough rambling, and thanks for your time. Will probably have a bash making the QSD/LO first and see where I get.
Kind regards
Paul
 
After studying the program, I have a suggestion to give it a more readable structure:

DD4WH Convolution SDR

1_Settings
1_1_Buttons_encoders
1_2_Zoom_factors
1_3_Sample_rates
1_4_Modulation
1_5_Frequency_bands
1_6_Constants
1_7_Display_constants
1_8_Menu_settings
1_9_Menu_text
1_10_Windowing
1_11_Filter_constants

2_Global_variables
2_1_FFT_structures
2_2_Arbitrary_variables

3_Receive_functions
3_1_General_functions
3_1_1_Digital_convolution
3_1_2_Filters
3_1_3_AGC
3_1_4_Noise_blanker
3_1_5_Noise_reduction
3_1_6_WFM_demodulation
3_1_7_AM_demodulation
3_1_8_SSB_autoTune
3_1_9_SSB_demodulation

4_User_interface
4_1_User_input
4_2_Screen_output
4_2_1_Menu
4_2_2_Spectrum
4_2_3_Time_date

I would prefer to dismantle the more than 11000 lines into smaller portions, e.g. into these .ino files.

What do you think about this proposal?

Wolfgang
 
Last edited:
Other users made proposals, now my suggestion is:
DD4WH Convolution SDR

1_Settings
1_1_Buttons_encoders
1_2_Zoom_factors
1_3_Sample_rates
1_4_Modulation
1_5_Frequency_bands
1_6_Constants
1_7_Display_constants
1_8_Menu_settings
1_9_Menu_text
1_10_Windowing
1_11_Filter_constants

2_Global_variables
2_1_FFT_structures
2_2_Arbitrary_variables

3_Receive_functions
3_1_General_functions
3_1_1_DC_rejection_and_mixer
3_1_2_Digital_convolution
3_1_3_Filter_design
3_1_3_Filters
3_1_4_WFM_demodulation
3_1_5_AM_demodulation
3_1_6_SSB_demodulation
3_2_Utilities
3_2_1_AGC
3_2_2_Noise_blanker
3_2_3_Noise_reduction
3_2_4_SSB_autoTune

4_User_interface
4_1_User_input
4_2_Screen_output
4_2_1_Menu
4_2_2_Spectrum
4_2_3_Time_date
 
Hello!

Have spent some time reading about this SDR project with the plan to build a shortwave radio.
As an RF engineer, all is fine up to the iq feed into the ADC. I would use the AD9850 series DDS for the main LO, much faster and cleaner than the type suggested.
When considering the SDR demod, it would be great to see the minimal script for just SSB, iq to audio out, rather than the whole system. This way, I would have some chance in appreciating the code and then build onto.

Cheers, Rob
 
Hi Rob,

thanks for your comments!

As a biologist, I may not be up to the latest developments in the RF engineering field.

Why would you think the DDS AD9850 is "much faster" ? It goes up to only 125MHz -as far as I know- and the LO I use (the Si5351) can be used up to 270MHz.

--> thus with the AD9850 it would not be possible to receive FM radio in 3x undersampling mode (108 / 3 is 36MHz receive frequency and requires 4 times higher LO --> 144MHz which is not possible with the DDS)

Could you explain why you think the DDS AD9850 is "much cleaner"? According to the datasheet the spurs are about 50dB below the produced signal in the AD9850, which is not so great, I think.

Also, I am not sure whether it would make sense to drive a Tayloe frontend = quadrature sampling detector directly with a sine wave (like the one produced by the AD9850). I think it needs a square wave LO, which is directly output by the Si5351.

Have a look at the Wiki, there you can find information on the signal path. It is then easy to find the SSB demodulation (in fact the Teensy Convolution SDR has no "demodulation" at all in SSB mode: basically the IQ signal is transformed into the frequency domain by a 512-point FFT and then complex-multiplied with the FFT result of a FIR bandpass (Kaiser window) which simply filters away the unwanted sideband and after the inverse FFT & overlap-save you have single sideband audio :)).

https://github.com/DD4WH/Teensy-ConvolutionSDR/wiki

Have fun, all the best,

Frank DD4WH
 
Hi Frank

I am assuming the Si5351 behaves similar to softrock Rx (Si570) which i have played with and found tune stepping to be somewhat clunky, time to settle. These are dual PLL's with up to 10ms settling.
DDS will have very fast settling, good phase noise but yes there's some spurious but could be filtered out. For shortwave, freq range is fine.

I read your description on math computation, thank you :). Would be nice to strip the code down to stages, for instance, performing FFT on iq signal.

Cheers, Rob
 
Ah, thanks for the link. A lot of comments there.
General opinion is that the device is good for SW receivers. It's true that the PLL's are slow to lock, so this should reflect when tuning, but I'm not reading evidence of this. Best way would be to buy one and try for myself.

Cheers
 
10ms for tuning are not a problem, I think.
I see more issues with the SGTL-5000 on the Audioshield -Ok, it seems to work pretty well, but..the datasheet says, its good for only 96kHz. So, we're overclocking it.. what's the max. samplingrate in this SDR? > 200KHz?
Does it make sense to look for a better ADC?

Edit: Is this baby overkill?
 
Thanks Frank for the Si5351 link. Yes, confirmed, I have never experienced problems with phase noise in the Si5351 and also never had problems with slow lock of the Si5351 or Si570 which I have both been running in several radios (tuning behaviour is much more dependent on the library you are using for the Si chip).

Best would be for you to make your own experiences and report them back here. At the moment this discussion is a bit on the theoretical side :).

And the Teensy Convolution SDR also uses sample rates up to 252kHz (my standard sample rate I use for FM radio, and I rarely also use 281 kHz with the SGTL5000). My radio has been running for two years now with the same (overclocked) SGTL5000 audio shield and its running almost daily . . . So does not seem to harm too much ;-).

And why change the ADC in a nicely running system? Also all higher speed ADCs will have a much higher power consumption (>100mA in the AK5397).
 
Thanks Frank for the Si5351 link. Yes, confirmed, I have never experienced problems with phase noise in the Si5351 and also never had problems with slow lock of the Si5351 or Si570 which I have both been running in several radios (tuning behaviour is much more dependent on the library you are using for the Si chip).

Best would be for you to make your own experiences and report them back here. At the moment this discussion is a bit on the theoretical side :).

And the Teensy Convolution SDR also uses sample rates up to 252kHz (my standard sample rate I use for FM radio, and I rarely also use 281 kHz with the SGTL5000). My radio has been running for two years now with the same (overclocked) SGTL5000 audio shield and its running almost daily . . . So does not seem to harm too much ;-).

And why change the ADC in a nicely running system? Also all higher speed ADCs will have a much higher power consumption (>100mA in the AK5397).

No, a misunderstanding :) I mean, isn't there a performance degration with such a high overclocking? Is the SNR still OK? How much usable bits do you get?

I have all parts, and about to build it soon .. But not original, I want to use the comming Teeny 4.. (glad to have a early beta) - have to think a bit about it, since it has less pins.
 
Last edited:
Ah, OK, now I understood!

For AM & SSB reception up to 30MHz I use sample rates of 96k or 100k, that seems quite clean of spurs in the range that the SDR uses (as we use an intermediate frequency of sample rate / 4, the range that has to be clean is thus 25 to about 35kHz depending on your audio bandwidth).

Bob Larkin has made some measurements and he has nicely shown that the audio board used with these sample rates produces less than -80dB of ADC noise in this range (relative to FS). However, when he used large dividers, he could even lower the noise to -100dB!

https://forum.pjrc.com/threads/3875...he-sample-rate?p=131216&viewfull=1#post131216

Whoops, I now realize that I use {1,7} = 100466Hz sample rate as dividers in my code and Bob used {224, 1575} = 100000. Maybe I should change that in my code in order to get even better noise performance? Hmm. Will implement both and compare . . .

Higher sample rates are only used for FM wideband radio reception. However, that is still in a preliminary stage, because the T3.6 is at its limit at that sample rate speed. We need to demodulate the FM signal at the high sample rate without decimation and we need the extremely processor-intense arctanf for that purpose. With the T4 beta there would be more options to play with, of course :). And hopefully the FPU working with double is a major step forward . . .
 
Back
Top