Transmitting FM Signals from ARM CPUs

Loay Mohamed
2 min readJan 9, 2024

--

(pic. 1) the Raspberry Pi connected to our broadcast antenna

the Research demonstrates on Raspberry Pi Computer

Just get an FM receiver, connect a 20–40 cm plain wire to the Raspberry Pi’s GPIO4 (PIN 7 on GPIO header) to act as an antenna, and you are ready for broadcasting. (Just like pic №1)

Installation and usage

First, install the repo:

git clone https://github.com/zoroxide/Pi-Fm_transmitter.git

Second, Install all required files by running this bash file, if your board is from Raspberry Pi 1 to 3, use install_rpi1-3.sh, or if your board is Raspberry Pi 4 useinstall_rpi4.sh

sudo sh install_rpi1-3.sh

or you have Raspberry Pi 4 use :

sudo sh install_rpi4.sh

then adding our program to executables:

sudo chmod +x fm_transmitter

after a successful installing and connecting a wire to GPIO 4 to the GPIO, run a test with:

sudo ./fm_transmitter -f 100.6 acoustic_guitar_duet.wav

Notice:

  • -f frequency — Specifies the frequency in MHz, 100.0 by default if not passed
  • acoustic_guitar_duet.wav — Sample WAV file, you can use your own

Other options:

  • -d dma_channel — Specifies the DMA channel to be used (0 by default), type 255 to disable DMA transfer, CPU will be used instead
  • -b bandwidth — Specifies the bandwidth in kHz, 100 by default
  • -r — Loops the playback

After transmission has begun, tune an FM receiver to the chosen frequency, and you should hear the playback.

Supported audio formats

note: only a WAV file with these specifications is supported:

  • Sample rate: 96000.0 Hz
  • Bit depth: 24-bit
  • Channels: Stereo

You can transmit uncompressed WAV (.wav) files directly or read audio data from stdin, eg. using an MP3 file:

sudo apt-get install sox libsox-fmt-mp3
sox example.mp3 -r 22050 -c 1 -b 16 -t wav - | sudo ./fm_transmitter -f 100.6 -

Please note only uncompressed WAV files are supported. If you receive the “corrupted data” error try converting the file, eg. by using SoX:

sudo apt-get install sox libsox-fmt-mp3
sox example.mp3 -r 22050 -c 1 -b 16 -t wav converted-example.wav
sudo ./fm_transmitter -f 100.6 converted-example.wav

Or you could also use FFMPEG:

ffmpeg -i example.webm -f wav -bitexact -acodec pcm_s16le -ar 22050 -ac 1 converted-example.wav
sudo ./fm_transmitter -f 100.6 converted-example.wav

Legal note

Please remember that transmitting on certain frequencies without special permission may be illegal in your country.

TO DO:

  • adding install bash files [done]
  • making a dashboard webpage (soon)
  • Adding Raspberry Pi 5 support (in advance)

--

--

Loay Mohamed

Embedded Systems | PCB | Robotics | Linux | Cybersecurity | C/C++ | Python