Advertisement

# Build Your Own Digital FM Radio Transmitter with Arduino

I recently searched for a digital FM transmitter kit, but most of the ones that I found online were either too expensive or did not have enough flexibility for my future applications. So I decided to make my own digital FM transmitter with the help of some popular and inexpensive components. At the heart of my design is an NS73M FM Transmitter Breakout Board. It is digitally tunable from 87 MHz to 108 MHz, and Right and Left channels are available for stereo broadcast as well. According to some tutorials, with 2-mW maximum broadcast power, we’ve been able to transmit up to 60 feet with a mere 31-inch piece of wire. I tested my prototype to about 10 feet of distance with a simple 6-inch piece of 22SWG hookup wire as the antenna.

The project is, in fact, a matter of putting together two highly integrated modules with a tested code snatched from the web (I still need to bundle it with my own code). Both of the freestanding modules (NS73MFM transmitter, Arduino UNO) can be mounted to a breadboard and interconnected. Refer to the hardware setup and proceed. The simple code generates digital tones with the Arduino and broadcasts on Left channel (L) to prove connectivity and transmission frequency. The hardware shown below is able to take in stereo audio inputs by performing L+R channel modulation; i.e., it can work with the typical 3.5-mm stereo audio jacks of your laptops or smartphones. However, note that the maximum audio input levels are at only 200 mV (by raising the volume too high, the audio may get clipped and you’ll get piteous music at the receiver side). To transmit audio, just connect the audio source to LIN, RIN, and GND. Use the same code to set the broadcast frequency, but omit the tone generation in the loop function of the given code.

Learn the code:

```#include "pitches.h"
int CK = 13; // Clock
int DA = 11; // Data
int LA = 10; // Latch

int AudioPin = 9; // Tone Output

int notes[] = {
NOTE_A4, NOTE_B4, NOTE_C3
};

int numNotes = 3;

void setup() {
Serial.begin(9600);
pinMode(CK, OUTPUT);
pinMode(DA, OUTPUT);
pinMode(LA, OUTPUT);
digitalWrite(LA, LOW); //Unlatch transmitter
delay(100);            //Wait
spi_send(0x0E, B00000101); //Software reset
spi_send(0x01, B10110100); //Register 1: forced subcarrier, pilot tone on
spi_send(0x02, B00000011); //Register 2: Unlock detect off, 2mW Tx Power
spi_send(0x03, B10001010); //Register 3: Set broadcast freq to 97.3, lower byte
spi_send(0x04, B00101110); //Register 4: Set broadcast freq to 97.3, upper byte
spi_send(0x08, B00011010); //Register 8: set Osc on band 2
spi_send(0x00, B10100001); //Register 0: 200mV audio input, 75us pre-emphasis on, crystal off, power on
spi_send(0x0E, B00000101); //Software reset
spi_send(0x06, B00011110); //Register 6: charge pumps at 320uA and 80 uA
Serial.print("Transmitting");  //for debugging

}

void loop() {
// square wave tones
//tone(9, notes[random(numNotes)], 500);
// random frequency
tone(9, random(50, 5000), 20);
delay(10);
}

void spi_send(byte reg, byte data)  //Routine to send Register Address and Data as LSB-first SPI
{
int x;
int n;
digitalWrite(LA, LOW);

for (x = 0 ; x < 4 ; x++)          //Send four-bit register address
{
digitalWrite(CK, LOW);         //Toggle the SPI clock
n = (reg >> x) & 1;            //n is the xth bit of the register byte
if (n == 1) {
digitalWrite(DA, HIGH);    //Put high bit on SPI data bus
}
else {
digitalWrite(DA, LOW);     //Put low bit on SPI data bus
}
Serial.print(n);
digitalWrite(CK, HIGH);        //Toggle the SPI clock
}

for (x = 0 ; x < 8 ; x++)          //Send eight-bit register data
{
digitalWrite(CK, LOW);         //Toggle the SPI clock
n = (data >> x) & 1;
if (n == 1) {
digitalWrite(DA, HIGH);    //Put high bit on SPI data bus
}
else {
digitalWrite(DA, LOW);    //Put low bit on SPI data bus
}
Serial.print(n);
digitalWrite(CK, HIGH);       //Toggle the SPI clock
}
delayMicroseconds(1);           //Wait
digitalWrite(LA, HIGH);           //Latch this transfer
delayMicroseconds(4);
digitalWrite(LA, LOW);
digitalWrite(CK, LOW);            //Keep CK pin at 0V at end of data transfer
Serial.print("\n");               // Send new-line to serial for debugging

}
```

download the code

As presently configured, the NS73M transmits at 2-mW power output with a 75-μs pre-emphasis and 100% modulation to occur at 200 mV of audio input. During initial power-up, it will start at 97.3 MHz. Fortunately, everything is reconfigurable, including the FM broadcast band edges and the channel spacing. You can use this formula to determine the register values for a new transmitting frequency (f): (f + 0.304)/0.008192. Remember to use only the whole number and convert the result to 16‐bit binary, in which the lower byte goes in register 3 and the upper byte goes in register 4.

For example:

• If 97.3 MHz:
• (97.3 + 0.304)/0.008192 = 11,914.55
• 11,914 = B0010111010001010
• Then:
• Reg 3 = B10001010
• Reg 4 = B00101110

## 9 Comments

• belloshehu1gmail-com
Your comment is awaiting moderation.

Thanks for your quick response. Can’t a microphone be connected to the FM transmitter module for audio signal transmission and how could it be achieved. Thanks once again

• T.K.Hareendran
Your comment is awaiting moderation.

It seems possible with a ‘microphone+preamplifier’ hardware. See the LIN & RIN connections of NS73M module (here we’re feeding a tone signal from Arduino to LIN). I regret, I didn’t test the mentioned setup yet. Thank you for your keen interest, and inspiring feedback!

• belloshehu1gmail-com
Your comment is awaiting moderation.

Good job! How could this transmitter be modified to transmit up to 1 kilometer? Can frequency of transmission Be altered by using some buttons connected to the arduino?thanks

• T.K.Hareendran
Your comment is awaiting moderation.

I think you can increase the transmission range within certain limits by using an RF Power amplifier. For example, just see this DIY Kit’s documentation from QKits Electronics – https://store.qkits.com/assets/pdf/qk171.pdf

(Beware, unauthorized radio transmission with a high powered device is usually considered as a violation of law in most countries)

• porrick

Hi – I bought an FM transmitter from SparkFun (product URL at bottom). In fact, I bought ~8 of these so far. Ive been unable to affix leads to each of the contacts. Any help is appreciated before I buy 80x more!

https://www.sparkfun.com/products/8452

• T.K.Hareendran

Recently I found another FM Tx module (from China) in some online stores, described as “KT0803L FM Transmitter module v2.0”. Search “Aliexpress” for this cheap yet compact module!

• kiranshashi

Is it legal to transmit FM for personal use ? I’m in Bangalore .

• kiranshashi

Nice article, I am interested in one such transmitter. I don’t think it is available in online web sites.
The NS73FM is available in the US.
Is there someway we can get them in Bangalore ? what is it’s equivalent substitute chip ?

• T.K.Hareendran

As you rightly said, now it’s a difficult to get module (in India). I bought 2 modules from Sparkfun through a friend abroad while preparing this tutorial (actually it was in yesteryear). Regarding the equivalent part, will update you asap!

Looking for the latest from TI?