The RaspberryPi can also be used to send audio files and even entire texts via FM signal thanks to a technical trick and suitable script – without additional hardware (apart from a piece of wire). This will turn your RaspberryPi into a small radio station.
How to do that and what you have to keep in mind is described in this article
Hints for our lovely english readers: Basically, many of the articles on Nerdiy.de are translations from the original german articles. Therefore, it may happen here and there that some illustrations are not available in english and that some translations are weird/strange/full of mistakes or generally totaly wrong. So if you find some obvious (or also not obvious) mistakes don't hesitate to leave us a hint about that in the comment section.
Also please don't get confused, that instead of a "dot" often a "comma" is used as decimal separator. 🙂
Inhalte
- 1 Safety instructions
- 2 Affiliate links / advertising links
- 3 Requirements
- 4 Important words in advance
- 5 Connecting/Preparing the antenna
- 6 Log in via SSH on the RaspberryPi
- 7 Update package management
- 8 Install required packages
- 9 Copy and compile software from the GIT repository
- 10 Command to send the FM signal
- 11 Send endless loop of a music file
- 12 Send text inputs via FM signal
- 13 Additional Information
Safety instructions
I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance. https://www.nerdiy.de/en/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 shop via this link, Nerdiy.de receives a commission from the online shop or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support Nerdiy.de in being able to offer further useful projects in the future. 🙂
Requirements
Helpful Articles:
Before you start with this article, you should have prepared the RaspberryPi so far that it can be reached via the network and controlled by SSH.
The following three articles describe what to do to prepare the RaspberryPi:
RaspberryPi – Setting up for Nerdiys!
RaspberryPi – The first configuration
RaspberryPi – Controlling the RaspberryPi via SSH
Required tools:
-none-
Required material:
In the following list you will find all the parts you need to implement this article.
Important words in advance
Sending FM signals (and many others) over unauthorized radio transmitters is not legal in Germany and in many other countries. The method shown below allows you to do just that. Please use it responsibly. Above all, make sure that you do not disturb regular radio stations. The method shown is comparatively powerful and radiates to even in other frequency range. That means that you can easily attract the displeasure of your neighbors and thus of the Federal Network Agency/ies.
Connecting/Preparing the antenna
As an antenna you can basically use any wire you have available. Important is only the length. The wire must be about 20cm long.
In the example below I have taken a rigid wire (so no flexible wire) and then crimped it on a Dupont connector. In principle, you can also use any other “simple” dupont cable.





Log in via SSH on the RaspberryPi
To get started, you first need to log in to RasPi with SSH on Putty. How to do it is described in the article

Update package management
The package management in Linux is a "central point" over which various software packages can be installed. For this to work reliably, the lists and sources of package management should be updated before installing any new packages.

sudo apt-get update && sudo apt-get upgrade



Install required packages
To be able to send FM signals via the RaspberryPi, you also need 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 is done with the following command.
sudo apt-get install make gcc g++
Copy and compile software from the GIT repository
Once you’ve installed the compiler, it’s time to download the actual program code.

mkdir fmTransmitter

cd fmTransmitter

git clone https://github.com/markondej/fm_transmitter.git
If for some reason the GitHub repository mentioned above is no longer available 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 thus ready.
With the following command you can now play over the set frequency a .wav file.
sudo ./fm_transmitter [-f frequency] [-r] filename
You have to replace “frequency” with the desired frequency and filename with the filename of your .wav file.
For example, the following command sends the file “test.wav” to 102.0 Mhz.
sudo ./fm_transmitter -f 102.0 -r test.wav
Send endless loop of a music file
If you are in the folder of the copied GIT repository, you can play the supplied melody with the following command 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 inputs via FM signal
The following article also describes how you can send a given text via FM signal in the ether.
RaspberryPi – output voice output via FM signal
Additional Information
https://github.com/markondej/fm_transmitter
https://github.com/Nerdiyde/fm_transmitter
I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂
Fab
P.S. 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 appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂
