Thursday, 28 August 2014

The Softrock + Arduino SDR

So here is the final SDR hardware and the software code

Photo 09 03 2014 09 50 32
The white-yellow-red wires at the top are the audio output which I am feeding to a FCA202 ADC.

On the right you can see a 6 pin connector. This is a plagiarism of M0XPD's "RF bus", but carrying different signals as you can see below.

Schematic

Screen Shot 2014 08 29 at 14 47 55
The Softrock Lite ll SDR is driven with the output "TUNE" (0 output of the SI5351 module). The frequency can be set from 7000kHz to 7200kHz in 20kHz steps, but pushing the button on the left side. This sets the centre frequency of the display in DSP Radio running on the iMac.

DSP Radio listening to GB100ZZ the special event station, on 40m, celebrating Marconi transmissions from Devon UK.

Screen Shot 2014 08 29 at 14 42 51 Code

// SI5351 dds with LCD display, output is x4 display frequency to drive /4 IQ generator
// ------
// DDS I2C SI5351 
// SCL = A5
// SDA = A4
// address 0x60
// ------
// display I2C LCD 16 * 2
// o A5 SCL
// o A4 SDA
// o GND
// o +5
// address 0x27
// ------
// RF bus
// o GND
// o from DSB
// o TUNE out 0
// o SDR out 1
// o to DSB out 2
// o to TX out 2 CW/QRSS or DSB/WSPR

#include "Wire.h"
#include "Adafruit_SI5351.h"
#include "LiquidCrystal_I2C.h"

// PLL frequency, IQ multiplier
#define XTAL 25
#define MULT 28
#define IQ 4

// outputs
#define TUNE 0
#define SDR 1
#define CWDSB 2

// button pin 8
#define BUTTON 8

// dds object
Adafruit_SI5351 dds = Adafruit_SI5351();

// LCD object
LiquidCrystal_I2C lcd(0x27, 16, 2); 

float freq = 7000; // start TUNE freq kHz
float prevfreq;


void setup()
{ 
  pinMode(BUTTON, INPUT_PULLUP); // button input

  lcd.init();
  lcd.backlight();

  dds.begin();
  dds.setupPLLInt(SI5351_PLL_A, 28); // PLLA = 25 * 28 = 700MHz

  ddsout(freq);
  prevfreq = freq;
  show(freq); // display current TUNE frequency
}

void loop()
{
  if(digitalRead(BUTTON) == LOW) // button pressed?
  {
    while(!digitalRead(BUTTON)); // wait button release

    if(freq == 7200) // if top of band
    {
      freq = 7000; // go to bottom
    }
    else
    {
      freq += 20; // increment by 20kHz
    }
  }

  if(freq != prevfreq) // if changed update
    ddsout(freq);
  show(freq);
  prevfreq = freq;
}

void ddsout(float f)
{
  float plla; // PLLA freq
  float frac;
  float synth;
  long n;
  long m;
  int div;

  m = 100000;

  plla = XTAL * MULT; // 700MHz
  synth = plla/(freq/1000 * IQ); // MHz, x4 for IQ gen
  div = (int)synth; // get integer part
  frac = (synth - div) * m; // get fractional part
  n = (long) frac;

  dds.setupMultisynth(TUNE, SI5351_PLL_A, div, n, m); // out TUNE = PLLA/(div+n/m)
  dds.enableOutputs(true);
}

// display freq in MHz
void show(float f)
{
  lcd.setCursor(0, 0);
  lcd.print("Centre Frequency");

  lcd.setCursor(4, 1);
  lcd.print(f, 0);
  lcd.setCursor(9, 1);
  lcd.print("kHz");
}






No comments: