Monday 28 April 2014

AD9580 DDS for SDR

I think I have invented something new!!! What I am trying to do is to build an SDR on an Arduino shield, for this I thought of using a DDS frequency synthesiser and an FT3253 MOS switch - in a design similar to a lot found on the web.

The idea is to drive the AD9850 chip module from the Arduino and display the band and frequency on an LCD screen. (See previous posting). This all works fine.

The new idea was to take the square wave outputs from the AD9580 module and drive a couple of 7474 dividers, like this

2014 04 28 14 20 45

This is different from the usual circuit which drives the two clock inputs together, but which divides the input frequency by 4, here we divide by 2. This means that at the upper frequency of the AD9850 module of 40MHz we can tune our radio up to over 20MHz, so covering 160-20m bands.

I don't have an oscilloscope, but I have discovered and bought ($30) a small module called the Logic Pirate, and together with some software called LogicSniffer, I have had a look at the waveforms. They are like this:

Screen Shot 2014 04 28 at 13 26 20

Here you can see that the basic logic is OK, the input waveforms (CH 0) have rising edges which trigger the flip-flops twice per cycle, and produce quadrature outputs (CH 1 & 2) . But there is a BIG problem, the quad outputs are not equal lengths. In theory you can adjust the mark/space ratio of the AD9850 module square wave outputs with a small pot on the board, but I have found that this is very, very sensitive, and at no position can I get equal times.

So that puts this design out, as the quad signals MUST have equal times for the Tayloe detector to work correctly.

Si570??

Now to start to think of a solution using the Si570 synthesiser chip. But for this I need a PCB and will recreate it in Eagle software to generate a small module with 0.1" pinouts. This can then be used on an Arduino Shield together with the module I have of the FT3253 on a similar 0.1" pitch. I will need to provide 3.3V for the Si570, and level shift the input SDA & SCL lines from the 5V signals of the Arduino... more later as I get this done. Here's the circuit:

Screen Shot 2014 04 28 at 15 36 30

Monday 21 April 2014

LC circuits and ferrite cores

Ferrite cores

Cores suitable for amateur radio up to 30MHz in order of AL:

Type		Colour		AL		Size (mm)
FT37-67				20		9.5
T37-7		White		32		9.5
T37-2		Red		40		9.5
T50-2		Red		49		13

FT37-43				350		9.5
FT50-43				440		13
FT82-43				470		21
FT240-43			1075		61

BN43-1502	Shiny Black	1050		13
BN43-2402	Shiny Black	1440		7
BN43-202	Shiny Black	2200		13


The inductance of a coil on a toroid is

L(uH) = (AL * n^2)/1000

Baluns

Balanced to unbalanced transformers. Configuration:

Scan 21 Apr 2014 16 55

Example of use in a PA to drive two MOSFETs, inductance of FT50-43/10t is 44uH, which is suitable for a broadband transformer where the inductance wants to be at least x4-x6 of the impedance:

Screen Shot 2014 04 17 at 16 59 13 Transformers

A common arrangement is the auto transformer, like this

Scan 21 Apr 2014 17 04

tin / tout = vin/vout = sqrt(Zin/Zout),

tout is the sum of the turns of the two windings.

Example: if tout = 2*tin then the transformer will have a ratio of 1:4, so transforming a 50R input to a 200R output, or a 12R input (MOSFET load) to a LPF/Antenna of 50R.

In the full circuit above the turns ratio of the output transformer is 2:3 or 3/2. So the impedance is translated by (3/2)^2 or x2.2. This means the transistors will drive an impedance of 50/2.2 = 23R. The core chosen for this circuit is the BN43-3312 which has a AL = 7000. This gives impedances of 28uH:63uH.

Another example, a balanced mixer for a direct conversion receiver:

Scan 21 Apr 2014 17 22

Each coil is 10t on an FT37-43 core, or 35uH impedance. The impedance is high enough to provide a wide band transformer at an input and output of 50R.

Here's a nice amplifier:

Scan 21 Apr 2014 17 32

The 2N 5109 is driven directly from the 50R input, there is drop down transformer at its output to drive the gate of the IRF510. The output of the IRF510 has a step up transformer to match the 50R load.

Matching circuits

These come in two varieties CL or LC. CL match hi Z to Low Z, and LC Lo Z to Hi Z. Here's the configurations:

Scan 21 Apr 2014 17 39

Scan 21 Apr 2014 17 43

Common usage for these circuits is in ATUs, to match 50R to hi her or lower aerial impedances.

Friday 4 April 2014

Update to AD9850 DDS Arduino code

Thanks to M0XPD!!! He has published a DDS.h library to handle the programming of the AD9850 module with three simple methods:

#include "DDS.h"

// pin connections
#define RESET 0     // Pin  RST
#define DATA 1      // Pin  DATA
#define FQ_UD 2     // Pin  FQ
#define W_CLK 3     // Pin  CLK

#define XTALFREQ nnnnn // actual freq of AD9850 module xtal if not exactly 125MHz

// DDS object
DDS dds(W_CLK, FQ_UD, DATA, RESET);

double frequency = 7100000;

void setup()
{
  dds.init();
  dds.trim(XTALFREQ);
  dds.setFrequency(frequency); // set the frequency, use a double
}


Here is an example sketch using the DDS library

// DDS sketch using DDS library from M0XPD, uses soft SPI.

#include "DDS.h"
#include "LiquidCrystal.h"

// pin connections
#define RESET 0     // Pin  RST
#define DATA 1      // Pin  DATA
#define FQ_UD 2     // Pin  FQ
#define W_CLK 3     // Pin  CLK

#define D4 4        // LCD data pins
#define D5 5
#define D6 6
#define D7 7
#define RS 8        // LCD RS * EN pins
#define EN 9

#define BUTTONS A0   // buttons read , analog level

// names of bands
char bandName[][5] = {"160", "80", "60", "40", "30", "20", "17", "15", "12", "10"};

// array lookup of lower, current and upper band limits
#define LOWER 0
#define CURRENT 1
#define UPPER 2

// band limits
double freqRange[10][3] = {
    {1810000, 1900000, 2000000},
    {3500000, 3600000, 3800000},
    {5258000, 5100000,5406500},
    {7000000, 7100000, 7200000},
    {10100000, 10300000, 10150000},
    {14000000, 14200000, 14350000},
    {18068000, 18050000, 18168000},
    {21000000, 21250000, 21450000},
    {24890000, 24700000, 24990000},
    {28000000, 28500000, 29700000}
};

// DDS object
DDS dds(W_CLK, FQ_UD, DATA, RESET);
// LCD object
LiquidCrystal lcd(RS, EN, D4, D5, D6, D7);

// band number
int band;

// actual frequency
double frequency;

void setup()
{
  dds.init();
  dds.trim(124970000); // crystal is not exactly 125MHz

  lcd.begin(16, 2);
  
  band = 0; // 160m band
  frequency = freqRange[band][CURRENT]; // current freq, start or last on this band
}

void loop()
{
  int x;
  
  x = analogRead(BUTTONS);
  if (x < 100) // Right
  {
    while(analogRead(BUTTONS) < 100);
    if(frequency < freqRange[band][UPPER]) frequency += 1000;
  }
  else if (x < 200) 
  {
    while(analogRead(BUTTONS) < 200);
    if(frequency < freqRange[band][UPPER]) frequency += 50;
  }
  else if (x < 400)
  {
    while(analogRead(BUTTONS) < 400);
    if(frequency > freqRange[band][LOWER]) frequency -= 50;
  }
  else if (x < 600)
  {
    while(analogRead(BUTTONS) < 600);
    if(frequency > freqRange[band][LOWER]) frequency -= 1000;
  }
  else if (x < 800)
  {
    while(analogRead(BUTTONS) < 800);
    freqRange[band][CURRENT] = frequency; // save previous band freq
    if(band < 9) band++;
    else band = 0;
    frequency = freqRange[band][CURRENT]; // load current band last freq
  }
  
  lcdDisplay(bandName[band], frequency);
  dds.setFrequency(frequency); // output frequency
}

// display LCD band & freq
void lcdDisplay(char* b, double f)
{

  lcd.setCursor(0,0); // write band & freq
  lcd.print("Band = ");
  lcd.setCursor(0, 1);
  lcd.print("Freq = ");
  
  delay(100); // stop flicker
  lcd.setCursor(7,0); // clear band data
  lcd.print("   ");
  lcd.setCursor(7,0); // write band data
  lcd.print(b);

  lcd.setCursor(7, 1); // clear freq data
  lcd.print("        ");
  lcd.setCursor(7, 1); // write freq data
  lcd.print(f/1000);
}

Wednesday 2 April 2014

Britain is NOT Great

EUROPE

A few examples in Europe: University Education is largely free, there are lower levels of income equality, there is much higher use of renewable energy, there is much larger ownership of key portions of the economy...

UK

Most English are against privatisation, but the government is roaring ahead with it.

4th most unequal country in the developed world

Pay has fallen faster, in the last 3 yrs, than the EU

Work 3rd longest hours for 2nd lowest wages

3rd highest housing costs

Highest train fares

2nd worst in fuel poverty

Least happy children

Higher infant mortality rate

Worst child poverty

4th poorest pensioners

8th biggest pay gaps men/women

Cost of child care MUCH higher

Wealth gap 2x as wide as EU

16% below productivity of advanced economies

40% of all western privatisations are in UK

Most un-democratic government (first past post, unelected Lords). Giving lowest trust in politicians

Not investing in the future (except HS2 which no one wants!).

Just flogging off assets to suck wealth into un-productive London based black holes.

London is now the centre for money-men over making things. And they truly rule the political agenda, not us

Britain is NOT great, it is very, very sick.

Is it surprising the Scots want out?