Close
0%
0%

r0ck candy Pirate Radio

r0ck candy is a social, portable pirate radio station stuffed in a candy container

Similar projects worth following
Camping with dear friends? Riding the train with complete strangers? Bored at the mall? Always wishing you could run your own tragically out-of-sync silent disco? If any of these describes you, then r0ck candy pirate radio is for you.

Inspired by PirateBox, r0ck candy is a software stack for your Raspberry Pi that turns it into an open hotspot streaming your music collection to nearby devices. When those devices connect and attempt to browse to any website, they will be redirected to the r0ck candy homepage where they can launch the stream and chat and vote on the next song. Due to its compact size, the r0ck candy can be concealed in a bag or pocket or attached to nearby structures.

At the heart of the project is a Raspberry Pi Zero running Raspbian, mpd, icecast2, hostapd, dnsmasq, nginx and a yet-to-be-determined CGI language. (edit: currently working with Node.js in lieu of webserver+CGI)

r0ck: rock n roll on a Raspberry Pi Zero

candy: in a candy container

pirate radio: streams music over a local network

Goal: create a pocketable streaming music server over local wifi network with an interactive web interface, and provide detailed and easy instructions for others

Materials and method: A Raspberry Pi Zero running from batteries with a wifi adapter runs Raspbian, MPD, Icecast2 and Node.js to serve music and a web interface, and hostapd and dnsmasq to provide local wireless access. I'm still looking for the right project enclosure. As a last resort, it should fit comfortably in an Altoids tin.

Development: The Zeros are hard to come by right now, so a Raspberry Pi B is standing in for its little brother. The web software is being developed on a VM now that the model B has been shown to run Node.js, MPD and Icecast2 acceptably. No database is needed.

View all 10 components

  • Performance testing with a Model B

    mark gunderson02/06/2016 at 00:55 0 comments

    My coworker handles all things telecom at work and had a little drawer full of old 2GB microSD cards. While not big enough for the final version, 2GB is enough for the full software stack plus a couple albums to start with on the RPi Model B. In fact, it's the ideal size for testing since writing and backing up images happens a lot faster.

    This is the first time I've worked with my Raspberry Pi B in a while and, oh man, did I forget how long it takes to install things versus the 2. This Model B is an early one, too so I'm working with just 256 MB RAM. The good new is it looks like mpd/icecast2 doesn't peg the CPU as hard as I feared. It shows just ~60% utilization on the Model B vs 40% on the 2. In the shot of top running below, you can see that even when I spam messages, a simple Node chat program barely shows up as a blip.

    So that's encouraging. Oh, speaking of Node, make sure you don't try to follow the standard Debian install instructions on Joyent's github. That will work for the Pi 2, I believe, but not the A, B, or Zero, as they use the older processor. The basic steps I took were:

    1. Start with a fresh copy of Raspbian Jessie Lite
    2. apt-get update && apt-get upgrade
    3. apt-get install screen
    4. install and configure mpd and icecast2 per this handy blog post
    5. upload some music using psftp.exe
    6. Follow the steps from this thread on the official RPi forums to install a compatible version of Node
      1. wget http://node-arm.herokuapp.com/node_0.10.36_armhf.deb
      2. sudo dpkg -i node_0.10.36_armhf.deb
      3. sudo apt-get install build-essential python-dev python-rpi.gpio (I skipped this for time and space reasons; I don't believe I'll need b-e)
    7. Then I followed this tutorial to get a simple chat running with socket.io

    From what I've seen it's relatively simple to have Node interact with the command line. I'm hoping I can whip up a program that occasionally polls mpc to get the current song and position, then starts a chat vote for the next song, artist, or genre. We'll see.

  • A different direction for the web interface?

    mark gunderson02/04/2016 at 21:59 0 comments

    The three main functions the web interface needs to provide are:

    • Now playing
    • Chat
    • Voting or similar two-way interaction with mpd

    Originally HTML and some form of CGI seemed like the way to go. This is an offline hack and not a hardened, web-scale app, right? Well, in the last few days of research and noodling in VMs, I'm increasingly leaning toward a Node.js stack. The speed at which I went from...

    npm init

    ...to a live chat app was a revelation. No lengthy server config files, no permissions jungle to navigate, just a few lines of javascript. Seems to do chat really easily, too.

  • The junk drawer at home

    mark gunderson02/02/2016 at 06:06 0 comments

    got home, dug out my dusty old Pi B, and realized that I don't have an extra SD card lying around. The one in my Pi 2 has approximately 20 GB of music on it, which means backing up the current image before wiping it will take forever. So, while I figure out what to do about that, I'll be forced to focus on developing the web interface.

    Enter Virtualbox. For the web development, one Debian Jessie environment is as good as the next, so I might as well also have easy snapshots and rollbacks that working on a VM affords.

    I remembered I have an old 5V boost regulator I bought from Pololu that never got used. The product page lists output current between 200 and 500ma. For the OG Pi B, with a wifi adapter, that won't cut it. For the Zero... it looks like it might be passable. This thread suggests a draw with wifi of 200-300ma. Since the boost regulator output current is dependent on input voltage, I can try using three AAA nimhs instead of the two AA nimhs I had in mind.

    Anyway, I have my next steps worked out while I look/wait for additional components

    1. Scrounge an SD card
    2. Build out my dev VM and start experimenting
    3. Try a few different battery combos with my boost regulator and measure current
    4. Finish the rest of the mints

  • Background and challenges

    mark gunderson02/01/2016 at 22:13 0 comments

    In anticipation of a large desert camping trip that was eventually canceled, I set up my Raspberry Pi 2 to function as an open hotspot that streams my music collection. I have grander plans for that project for next year's trip, but in the mean time, the RPI Zero competition has inspired me to miniaturize the setup for more convenient everyday use.

    I would have saved myself a lot of trouble if I had just built a PirateBox with icecast added, but I did learn a lot in the process that will help accelerate development of this smaller version.

    I have a few concerns about the Raspberry Pi Zero's performance. On my RPI2, the CPU hovers around 30-40% while streaming. Nearly all of this is due to the transcoding that mpd and icecast2 do on the fly. Whatever format my music is in, it transcodes it to 128 kbps stereo mp3. This includes files that seem to already be in that format.

    I have an original Raspberry Pi B (not pictured) I'll be developing on, complete with crappily bridged polyfuse. I don't know the exact form factor the final project will take since I don't have a Zero handy. I'm banking on the zero and a couple AA/18650 cells fitting in an Altoids or Icebreakers box.

    The biggest challenge though is that the "social" aspect will require development I'm just not that experienced with yet. I can kludge together basic HTML, but even JS is new to me. A few friends are proficient in Python, so maybe I can leverage them.

View all 4 project logs

Enjoy this project?

Share

Discussions

dearuserhron wrote 05/18/2021 at 09:09 point

I thought it can transmit FM. If I run more then one stream player, it will be hard to synchronize them.

  Are you sure? yes | no

anonymoosebhokal wrote 05/20/2018 at 02:41 point

Would I really need a wifi adapter If I am using a pi zero w?

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates