logo

ALL


Cluster Activity

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

Solar data:
SFI
163
A-Index
4
K-Index
2
Exp.K
1
Sunspots
113
Activity
act
GMF
qui
Aurora?
no

My Weather

ArrayDate:21/11/24 Time:12:02
Temp:6.5C
Wind Speed:15mph
Wind Dir:225deg
Pressure:995.62mB
Humidity:76%
Dew Point:1.7C

//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