Today I will demonstrate you how to install the FM radio transmitter on Raspberry Pi. It is not just a transmitter! It supports RDS function with all its options (PS, RT, TA/TP). So do it!
The only thing we need to know is that the transmitter needs an antenna. Of course, you can broadcast from GPIO goldpin, but the range of such a solution is barely a few meters. Simply attach the short cables to the GPIO4 (4 pin inside) to extend the range up to a hundred meters.
On legality: this is not legal, but for such a do-it-yourself exercise, no one will prosecute us.
Installation of the required packages
This will start by transmitting a default message at 100.0MHz with default subtitles in RDS.
We can of course replace the transmitted sound. To do this we type:
./pi_fm_rds -audio sound.wav
This option only accepts WAV 16-bit (stereo or mono) files. MP3 files will cause an error.
A change of frequency would also be useful: change of frequency
./pi_fm_rds -audio sound.wav -freq 88.0
And also RDS subtitling:
./pi_fm_rds -audio sound.wav -ps 'PI-FM' -rt 'Breaking News: Obama became president Now Playing: Big Sean'
`ps` is the name of the station - max. 8 characters, while `rt` is the message - max. 64 characters.
Theoretically everything is ready, but it would also be useful to be able to change RDS parameters during playback. To do this, you must first allow the transmitter to operate in the background. To do this, add the & symbol at the end of the command. The whole thing looks like this:
./pi_fm_rds -audio sound.wav -ps 'PI-FM' -rt 'Breaking News: Obama became president Now Playing: Big Sean'&
From now on, the broadcast is running in the background. To allow you to change parameters during the process, you need to create a special file and add tracking options to the encoder.
Now we are writing:
Everything is surely clear…. except for TA. This function can switch the car sound system while listening from a disc to our station to listen to important traffic news.
I’ll give you one more nice command, allowing you to transmit the sound from the microphone:
arecord -fS16_LE -r 44100 -Dplughw:1,0 -c 2 - | ./pi_fm_rds -audio -
You can of course add other parameters before -audio.
Finally, I would like to make one final point - stopping the background radio station. To do this, please enter:
Then press Ctrl+C.