PROJECTS

image

Jeffrey Braverman

Raspberry Pirate Radio

Broadcast your own go-anywhere FM station with this amazingly simple Pi hack.

Written by Sam Freeman and Wynter Woods

THIS SIMPLE HACK TURNS YOUR RASPBERRY PI INTO A POWERFUL FM TRANSMITTER with enough range to cover your home or dorm, a DIY drive-in movie, a high school ball game, or even a bike parade (depending on the stragglers). It’s the coolest Pi device we’ve ever seen with so few materials.

You’ll start with the absolute minimum you need to run a Raspberry Pi — an SD card, a power source, and the board itself — and add a single piece of wire. The PiFM software cleverly uses hardware that’s meant to generate spread-spectrum clock signals on the GPIO pins to output FM radio energy instead.

PiFM was originally created by Oliver Mattos and Oskar Weigl, and revised by Ryan Grassel. MAKE’s contribution, the PirateRadio.py Python script, now enables automatic playback without using the command line and handles all the most common music file formats. It was written here in the MAKE Labs by engineering intern Wynter Woods.

1. Make the antenna

Stick a wire into GPIO pin 4 of your Raspberry Pi. That’s it! We used 40cm of fat 12 AWG solid copper wire, soldered to a female jumper. We covered the connection with heat-shrink tubing and reinforced it with a gob of hot glue.

image

SAM FREEMAN Raised in the galactic capital of Earth, Sam was destined to work as the MAKE Labs manager — testing, designing, and breaking projects for MAKE.

image

WYNTER WOODS is a MAKE engineering intern and a programmer with one too many interests, ranging from hardware hacks to audio processing to 3D visualization of chemical sample data.

image

2. Flash the SD card and add music

MAKE Labs created a disk image that runs the PirateRadio.py script on startup, so your music starts broadcasting immediately. It handles MP3, WAV, FLAC, AAC, M4A, and WMA files automatically. Download it from the online project page and flash it to the SD card. It’s easy; check the project page for more advice.

Then just drag any music files, or artist or album folders, to the root of the Pirate Radio partition. Your music files can be nested within these folders, so there’s no need to dump all your music into one mess on the root directory.

3. Edit the config file

Set frequency to the station you want to broadcast on. Useable FM frequencies are typically from 87.5MHz to 108.0MHz.

Set shuffle to True to shuffle files, or False to play them alphabetically. Set repeat_all to True if you want to loop forever through your playlist.

4. Start it up!

Tune an FM radio to your frequency and plug in the Raspberry Pi. In about 15 seconds you’ll hear your music loud and clear!

How It Works

The PiFM software manipulates the frequency of the Raspberry Pi’s internal PLLD clock (500MHz) using a fractional divider. For a target broadcast frequency of 100MHz, for example, the frequency is modulated between 100.025Mhz and 99.975Mhz. That’s how FM radio transmits an audio signal.

image
image
image

The Python code defaults to 87.9 FM with shuffle and repeat turned off. It scans the SD card for music files and builds a playlist based on the options in the config file. It then passes each file along to a decoder based on the file type. Each file is then re-encoded into a format the PiFM radio can handle.

NOTE:

The Pi’s broadcast frequency can range FROM 1Mhz to 250Mhz, which may interfere with government bands. Limit your transmissions to unoccupied portions of the FM band of 87.5MHz–108.0MHz.

Going Further

Tuck everything into the plastic case from the Raspberry Pi Starter Kit, or 3D-print this awesome radio tower enclosure, drawn up by MAKE Labs manager Sam Freeman. Download it at thingiverse.com/make.

Then add a USB battery pack so you can carry your station wherever you need to take over the airwaves. (It fits in the radio tower, too.)image

Time Required:

30 Minutes

Cost:

$30–$50

This is the coolest Pi device we've ever seen using so few materials.

MATERIALS:

» Raspberry Pi single- board computer Maker Shed #MKRPI2, or get the Raspberry Pi Starter Kit, #MSRPIK2, at makershed.com

» SD Card, 4GB or more An 8GB card is in the Starter Kit.

» USB wall charger, 2A, with USB cable also in the Starter Kit

» Hookup wire, solid- core, 12 AWG, 40cm length

» Female jumper wire

» Heat-shrink tubing

» FM radio

» Battery pack with USB socket (optional) for portable operation, such as the Smart Power Base, a rechargeable 5V 1A lithium-ion power pack that works with many popular development boards.

Tools

» Computer

» Wire cutters / strippers

» Soldering iron

» Hot glue gun

Get complete step-by-step instructions and download the Pirate Radio code at makezine.com/projects/raspberry-pirate-radio Share it: #rasppirateradio

image
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset