Thanks to a technical trick and a suitable script, you can also use the Raspberry Pi - without any additional hardware (apart from a piece of wire) - to send audio files and even entire texts via FM signal. This turns your RaspberryPi into a small radio station.
How to do that and what you have to consider is described in this article
Safety instructions
I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/
Affiliate links/advertising links
The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂
Requirements
Before you start with this article you should have prepared the RaspberryPi so that it is accessible via the network and controllable via SSH.
The following three articles describe what needs to be done to prepare the RaspberryPi:
RaspberryPi – setup for nerdiys!
RaspberryPi – The first configuration!
RaspberryPi – Control the RaspberryPi via SSH
Required tool:
-no-
Required material:
In the following list you will find all the parts you need to implement this article.
Important words first
Sending FM signals (and many others) via unauthorized radio transmitters is not legal in Germany. The method shown below allows you to do exactly that. Please use it responsibly. Above all, make sure that you do not disturb any regular radio stations. The method shown is comparatively powerful and also radiates into other frequency ranges. This means that you can very easily incur the displeasure of your neighbors and thus also the Federal Network Agency.
Connecting/Preparing the Antenna
In principle, you can use any wire you have available as an antenna. Only the length is important. The wire must be approx. 20cm long.
In the example below, I took a rigid wire (i.e. not a flexible strand) and then crimped a Dupont connector onto it. In principle, you can also use any other “simple” Dupont cable.
Log in to the RaspberryPi via SSH
To start, you must first log in to the Rasp Pi with Putty via SSH. How to do this is in the article RaspberryPi - Control the RaspberryPi via SSH described.
Update package management
The package management in Linux is a "central place" through which various software packages can be installed. In order for this to work reliably, the lists and sources of the package management should be updated before each installation of new packages.
sudo apt-get update && sudo apt-get upgrade
Install the required packages
So that you can now send FM signals via the RaspberryPi, you of course have to install some software. Since you have to compile the source code of the FM transmitter yourself, it is necessary to first install a suitable compiler. This can be done with the following command.
sudo apt-get install make gcc g++
Copy and compile software from the GIT repository
Once you have installed the compiler, it is now time to download the actual program code.
mkdir fmTransmitter
cd fm transmitter
git clone https://github.com/markondej/fm_transmitter.git
If the GitHub repository specified above is no longer available for any reason, you can also use the “backup” in the Nerdiy GitHub. You can find it here: https://github.com/Nerdiyde/fm_transmitter
cd fm_transmitter
make
Command to send the FM signal
The program for sending FM signals is now prepared.
With the following command you can now play a .wav file at the set frequency.
sudo ./fm_transmitter [-f frequency] [-r] filename
You still have to replace “frequency” with the frequency you want and filename with the file name of your .wav file.
For example, the following command sends the test.wav file at 102.0 MHz.
sudo ./fm_transmitter -f 102.0 -r test.wav
Send an endless loop of a music file
If you are in the folder of the copied GIT repository, you can use the following command to play the supplied melody and receive it over 102.0 MHz
sox acoustic_guitar_duet.wav -r 22050 -c 1 -b 16 -t wav - | sudo ./fm_transmitter -f 102.0 -
Send text input via FM signal
The following article also describes how you can send a given text into the airwaves via FM signal.
RaspberryPi – output voice output via FM signal
More information
https://github.com/markondej/fm_transmitter
https://github.com/Nerdiyde/fm_transmitter
Have fun with the project
I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂
PS Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂