Saturday, 5 October 2013

Software defined FM radio transmitter (Arduino + AD9850)

This video shows it all, take it away!


The frequency is generated by the AD9850 and the modulation is done by the arduino

The full code is here:
http://pastebin.com/YMErwwK3

The FM band channels are centered at certain frequency, in our case 90Mhz, any slight deviation of that freq (by a max of +/- 75Khz) will move the membrane of the speaker backward or forward, here is the bit of code that implements that. And this is the (unoptimized) modulation routine.
void playTone(unsigned int note, unsigned int duration ) 
{
  const double freq = 90 * 1e6; // transmitting at 90Mhz

  // play silence 
  if ( note == 0)
  {
    ad.setfreq(freq);
    delay(duration);  
    return;
  }
  
  unsigned long currentMillis = millis() + duration;
  while( millis()< currentMillis)
  { 
      ad.setfreq(freq + 75e3/2); // speaker's membrane backward
      delayMicroseconds(note);
      ad.setfreq(freq - 75e3/2); // speaker's membrane forward
      delayMicroseconds(note);
  }

  ad.setfreq(freq );
}

Credits go to:
Brett Hagman for the RTTTL tune player
Poul-Henning Kamp for the AD9850 lib

4 comments:

  1. Have I misread a data sheet of AD9850:
    " The AD9850’s innovative high speed DDS core provides a 32-bit frequency tuning word, which results in an output
    tuning resolution of 0.0291 Hz for a 125 MHz reference clock input. The AD9850’s circuit architecture allows the generation
    of output frequencies of up to one-half the reference clock frequency
    >>> (or 62.5 MHz) <<<

    ReplyDelete
  2. You are right then... No idea how can come it comes can I get higher frequencies then... I am computing the FFT on its output (with a 1Ms/s) and I see a nice peak moving covering all the range... Maybe an harmonic is kicking in, if I had better equipment I could tell you. Thanks for pointing this!

    ReplyDelete
  3. nice job can u give the schematic to do the connection with arduino and how modulate thank u

    ReplyDelete
  4. nice job can u give the schematic to do the connection with arduino and how modulate thank u

    ReplyDelete