logo

Home


Cluster Activity

Spots per uW band today:
UK spotter or spotted only.

Solar data:
SFI
179
A-Index
9
K-Index
2
Exp.K
0
Sunspots
170
Activity
act
GMF
act
Aurora?
no

My Weather

ArrayDate:23/11/24 Time:09:38
Temp:2.5C
Wind Speed:17.5mph
Wind Dir:90deg
Pressure:992.64mB
Humidity:118%
Dew Point:6.1C

//This is an IQ Mixer made with my knowledge of sdr so far... don't laugh ;-)
//Reads samples from standard input at 1.204Ms/s and writes mixed samples to standard output
//
// to compile: gcc mixer.c -o mixer -lm
//
//rob@m0dts.co.uk
//
//September 2015

#include <stdlib.h>
#include <stdio.h>
#include <math.h>



void main(void){


int n,i;
unsigned char inbuf[2];
int sample_rate;
float m1,m2,m3,m4,*vfoi,*vfoq,osc,outbuf[2];

osc = 15000;
sample_rate = 1024000;

//allocate memory for IQ oscillator lookup table, probably a better way to do it? complex values maybe?
vfoi= malloc(sample_rate * sizeof(float));
vfoq= malloc(sample_rate * sizeof(float));

//Create lookup samples for one cycle of oscillator - could use 1/4 cycle... better way?
for(n=0;n<(sample_rate/(int)osc);n++){
vfoi[n]=sin((2*M_PI)*osc/sample_rate*n);
vfoq[n]=cos((2*M_PI)*osc/sample_rate*n);
}

//IQ mixer - based on 'understanding dsp' book example
n=0;
while(1){
//Read pair of samples
fread(&inbuf,sizeof(char),2,stdin);
//I_sample*Q_osc
m1 = ((float)inbuf[0]-127.0) *vfoq[n];
//Q_sample*Q_osc
m2 = ((float)inbuf[1]-127.0) *vfoq[n];
//Q_sample*I_osc
m3 = ((float)inbuf[1]-127.0) *-vfoi[n]; // remove '-' for up conversion
//I_sample*I_osc
m4 = ((float)inbuf[0]-127.0) *-vfoi[n]; // remove '-' for up conversion
//sum
outbuf[0] = m1 - m3;
outbuf[1] = m2 + m4;

n++;
if(n==(sample_rate/(int)osc)){n=0;}

//Write pair of samples
fwrite(&outbuf,sizeof(float),2,stdout);

}

}













Last page added:25/03/00 18:32
M0DTS.co.uk