 # can i implement linear frequency modulation in arduino?

Can I create a linear frequency modulation signal in arduino? and arduino what is suitable to perform the process LFM?

GHz? MHz? kHz? sinusoidal? square? S/N ratio?

40 KHZ
the signal is sinusoidal

Can you help me?

40KHz

Say you want a smooth signal with about 200 points per wave.

= 200*40E3 voltage values per second.

= 8 MILLION points a second.

Arduino clock speed = maybe 20Mhz max.

So you'd need to update a pins voltage every 2 clock cycles...which is a bit much maybe?

I am having a go now software wise and seeing if I can get anywhere near 40KHZ using a pre-determined byte array of values. I will adjust the 'smoothness' of the curve to try and get any kind of useful speed.

With SPI you can output nearly a byte/uS, nearly 1MHz, so 40KHz shouldn't be too hard for a 16 MHz processor. I know for a fact that one can output 16-bit, 44,100 Hz, mono audio thru a DAC with values from an SD card.

Do some reading & code examining here: http://forum.arduino.cc/index.php?topic=180769.0

this is my program
is the program correct?

``````void setup() {
const int outPin = 8;
int i=0;      // used as an index into the array
int fs=200;
int fc=10*pow(10,6); // frequency carrier
int BW=5*pow(10,6); //bandwidth
int T=pow((51.2*10),(-6)); //pulse width
int n=2*BW*T+1; // sampling points
int alpha=(BW)/(T); //chirp rate
int t=T/2; //time interval
int ichannel[n];

Serial.begin(9600);

// display each number from the array in the serial monitor window
for (t = T/2; t <=T; i++) {
ichannel[i]=cos(2*3.14*((fc)*t+alpha*pow(t,2))); // equation of real part (LFM)
i=i+1;
t=t+1/fs;
Serial.println(ichannel[i]);
}
}

void loop() {
}
``````

sketch_nov03b.ino (620 Bytes)

Have you tried to run it? Does it give any output? Do you have an Arduino?

Pete

I’ve tried it
should the output is a signal LFM
when i run the program successfully but when checked using osiloscope the signal does not come out

can you fixed my program?

Well firstly:

an int can store 16bits. This gives a max value of about 64,000 as an unsigned int (all positive values).

``````int fc=10*pow(10,6);
``````

10,000,000 is far too large for an int.

Check your other variables as well.

when checked using osiloscope the signal does not come out

That's hardly surprising. Your code only outputs the value of ichannel to the Serial monitor. Which pin were you looking at with the oscilloscope and why?

can you fixed my program?

No. - There are so many errors in it - I don't know what it is supposed to do - you still haven't said which Arduino you are using

Pete