logo
Most Viewed Last 7 Days
436MHz DATV Up-Converter (196)
10GHz ATV dx 115km (98)
Chirp Sounders (98)
Archive2 - DATV Transmitter (98)
12:6 Audio Mixer - Testing (77)
23cm DG0VE Amplifier (77)

ALL



Cluster Activity

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

Solar data:
SFI
71
A-Index
6
K-Index
2
Exp.K
0
Sunspots
12
Activity
qui
GMF
qui
Aurora?
no

My Weather

Date:18/01/18 Time:13:25
Temp:6.5C
Wind Speed:5mph
Wind Dir:180deg
Pressure:995.92mB
Humidity:118%
Dew Point:10.1C
UKHASnet
DSP#1 IQ Mixer

//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:07/01/18 10:15
M0DTS.co.uk