-
Performance testing with a Model B
02/06/2016 at 00:55 • 0 commentsMy 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:
- Start with a fresh copy of Raspbian Jessie Lite
- apt-get update && apt-get upgrade
- apt-get install screen
- install and configure mpd and icecast2 per this handy blog post
- upload some music using psftp.exe
- Follow the steps from this thread on the official RPi forums to install a compatible version of Node
- wget http://node-arm.herokuapp.com/node_0.10.36_armhf.deb
- sudo dpkg -i node_0.10.36_armhf.deb
- 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)
- 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?
02/04/2016 at 21:59 • 0 commentsThe 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
02/02/2016 at 06:06 • 0 commentsgot 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
- Scrounge an SD card
- Build out my dev VM and start experimenting
- Try a few different battery combos with my boost regulator and measure current
- Finish the rest of the mints
-
Background and challenges
02/01/2016 at 22:13 • 0 commentsIn 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.