Rich Rarey and His Stupid Pi Tricks

I just built either the best or the worst $5 FM-RDS transmitter.

Last year, the really smart folks at the Raspberry Pi Foundation released their really stripped-down but fully functional Linux computer, the Raspberry Pi Zero. It costs 5 bucks, uses the Broadcom BCM2835 system on a chip running at 1 GHz with an ARM11 core, HDMI, and everything else one would expect on a Raspberry Pi computer except an Ethernet jack, and the Zero has only one USB port.

Fig. 1: The author’s new Raspberry Pi Zero.
Fig. 1 shows the Zero’s size — I attached nylon 2.5 mm nylon standoffs just to keep the board from floating away. Not surprisingly, the adapter cables for the mini HDMI and micro USB cost more and weigh a lot more than the RasPi Zero — heck, the 16 GB MicroSD card cost twice as much as the computer itself. Somehow that seems wrong. Or perhaps that’s how technology should be — inexpensive motherboard and more costly peripherals. Nonetheless, I am deeply drawn to the Raspberry Pi products because some of my clients love having development prototypes based on this versatile, cost-effective platform, and I can hobby-away at all kinds of computer-based projects because the hardware is cheap and the programming tools are free.

There has been a backlog of orders for the model Zero, and the Wales factory has been building the computers at a steady clip, so when my local electronics store allowed me to buy one (limit one per family!) I jumped at the chance and also loaded up on the necessary peripherals (USB hub, mini-HDMI to HDMI adapter, AC power supply and a micoSD card).

Then I wondered what the great multitude of Raspberry Pi users had created with their model Zero. A quick Google search and I was astonished to find that one of the popular things people first do with this technology is to turn it into an FM transmitter.

This is a testament to the worldwide influence of broadcasting: Tech people don’t build a nice, safe, WiFi-based streaming server and leave it running for a passerby to discover. No, they want to broadcast. Everyone wants to be a broadcaster.

And it’s ridiculously easy on these platforms: Type a few commands to install the open-source FM-RDS transmitter software onto the Zero, build a portable 5 volt DC supply for it, stuff the Micro SD card with music files, solder a 6-inch wire onto GPIO 4 (Pin 7) for the antenna, throw everything into a sturdy black plastic case that has four strong magnets glued to the bottom and you’re in business — you’ve created an FM-RDS “Throwie” that when tossed at a metal structure, will magnetically stick and transmit your music files on the FM frequency you’ve selected. Passersby are not likely to be charmed by a funny looking black case attached to the side of a bridge with an antenna wire sticking out, and are more likely to call the authorities. This is clearly not the free-wheeling “Pi-Rate” radio the Raspberry Pi users imagined.

I would like to imagine the FM transmitter software authors Oliver Mattos, Oskar Weigl, Direct Memory Access (DMA) software author Richard Hirst and FM-RDS software author Christophe Jacquet have performed a fine educational service by translating Edwin Armstrong’s invention from the equation

(see reference [1] at the end of this story)  into a remarkable piece of software that runs on the most humble of platforms. It’s a fine tool to learn about FM transmission without soldering a single tuning capacitor or spending $2.94 for a Silicon Labs Si4713 FM-RDS transmitter chip.

Fig. 2: A console screenshot of the compiling and execution of the FM-RDS application.
Click to Enlarge
Fig. 3: The RDS as transmitted by the Raspberry Pi application, received on a Sony XDR-F1HD.
Fig. 4: Oh! It’s a spread-spectrum FM transmitter!
All Raspberry Pi computers have a pulse width modulation (PWM) output originating from the Broadcom chip, but typically the PWM output is used as a variable speed drive for direct current motors, or for making a variable width pulse that controls the blinking of a string of LEDs.

Does the RasPi Zero transmit? Yes. I downloaded and compiled the software on the RasPi Zero, pushed a wire into the Pin 7 hole and started the PiFmRds application with command line parameters that customized the Radio Text and specified a WAV file in the same directory as the application. The console output for the compile and execution is shown in Fig. 2. I set my Sony XDR-F1HD tuner to 87.9 and was surprised to see the RDS text appear and hear noisy audio — apparently the default FM deviation is 25 kHz, which in the source code is called “wideband.” Fig. 3 shows the RBDS text as received on the Sony tuner. Setting the FM deviation to 75 kHz and recompiling the code makes a cleaner FM signal at the expense of transmitting the RBDS data.

The source code comments and README files are very specific in that this application can cause interference and the application is for experimentation only — not for broadcasting your sound system around town. One must appreciate these warnings because when I connected Pin 7 to a spectrum analyzer and re-ran the application, this time transmitting at 85.5 MHz, I was shocked to see spurious emissions all the way to 1 GHz. Enjoy those spurs in Fig. 4. An industry colleague glanced at the waveforms and cracked “Looks like you have a fine spread-spectrum FM transmitter!”

While I enjoy learning and experimenting with Raspberry Pi computers for fun and profit, one organization is very serious about its Raspberry Pi-based FM transmitters. The German non-governmental organization, Media in Cooperation and Transition (MiCT), has designed, built and smuggled pocket-sized, Raspberry Pi-based FM transmitters with a 6 km range into Syria for the purpose of providing a way for independent journalists to be heard in that war-ravaged land. Called Pocket FM, the transmitters are the size of a shoebox and are equipped for receiving a satellite feed from MiCT in Berlin, thence retransmitting the audio on a free FM channel. If the FM channel is jammed or occupied, the Pocket FM hunts for a new FM channel to use, identifying itself to listeners through an RDS signature. Power for the rig is supplied by a car battery and solar cells. Once set up and powered, typically in an abandoned building, the whole rig becomes autonomous and unattended. Presumably the government can find the transmitter, but cannot determine who put it there. According to the German news site The Local, placing one Pocket FM transmitter in Damascus could cover a quarter of the city with music and news.

MiCT has wisely kept the design details private and the project is not “open source” so we cannot exactly determine tell the role the Raspberry Pi plays within the device.

So, like every tool, the Raspberry Pi can be used for gainful … or inappropriate … purposes. It’s my intent to periodically present in this space other broadcast-oriented uses for these powerful little computers.

Rich Rarey is RWEE technical editor and principal of Rareworks LLC consulting.

REFERENCES

[1] Dr. Lawrence Der of Silicon Laboratories Inc. wrote a wonderful FM tutorial that describes this formula in detail; read it at http://tinyurl.com/rwee-fm-tutorial.



Receive regular news and technology updates. Sign up for our free newsletter here.

Share This Post