Raspberry Pi + Arch Linux ARM + Pianobar + HDMI

Whoa-k, it’s been a while…

So, I’ve got a Raspberry Pi Model B (256 MB RAM), on which I’m running Arch Linux ARM. I’ve come to really dig Arch even since installing it on an old ThinkPad X31.

I’m writing this because I fell in to some trouble with getting pianobar cleanly installed on my current setup and I figured I’d document it.

Firstly, I’d like to mention this SparkFun tutorial on getting Arch running on your Pi: DOOM on your Pi. It’s a very good tutorial!

So, to use the sound device, you need the device driver installed! Check if it’s installed by running the commands:

lsmod | grep snd_bcm2835

If you don’t see any output, you’ll need to install the driver:

sudo modprobe snd_bcm2835

To make sure it gets loaded on subsequent boots, let’s add a file to the /etc/modules-load.d/ folder:

sudo nano /etc/modules-load.d/snd_bcm2835.conf

This file really only needs one line, but we’ll add a simple comment:

#Load 'snd_bcm2835' at boot
snd_bcm2835

Here is some more info on loading kernel modules in Arch: Kernel Modules: Loading

With the sound driver installed, the next part was getting the sound out over the HDMI port. To do this you must edit the /boot/config.txt file:

sudo nano /boot/config.txt

Uncomment the line hdmi_drive=2. This tells the Pi that you’re not just using a DVI monitor, so you’d like sound as well. For a little more detail see this post and also this elinux.org wiki page.

Now, we want to tell the ALSA driver to explicitly send sound output over the HDMI port with the command:

sudo amixer cset numid=3 2

That last number, 2, is one of three options in this command. 0 is for auto-detect, 1 is the analog output, and 2 is for HDMI. More details here, under “Check if proper audio output is selected.”
NOTE: As of this writing, this command WILL NOT WORK AS EXPECTED on the latest Raspian image (2012-10-28-wheezy-raspbian) because the audio is set up differently in Raspian now. Raspian is using PulseAudio and cset=3 corresponds to ‘Master Playback Volume’, not ‘PCM Playback Route.’ This command will effectively turn your sound off because you’re setting the volume to 2.

Install git & libao, then download pianobar from the AUR into a new directory:

sudo pacman -S git libao
mkdir ~/builds
cd ~/builds
wget http://bit.ly/Q8YXfm

Unpack the tarball:

tar xzvf
cd ~/builds/pianobar-git

Modify the PKGBUILD file by changing the arch=('i686' 'x86_64') line to arch=('armv6h').

nano ~/builds/pianobar-git/PKGBUILD

Install the package:

sudo pacman -U XXX.pkg.tar.xz

Finally, you’ll want to create an /etc/libao.conf file:

nano /etc/libao.conf

Add these lines to the file:

default_driver=alsa
dev=default

Following this article, but substituing dev=hw:0,0 for dev=hw:1,3 didn’t do it, so I tried what I found here and it seemed to do the trick! (dev=default as stated above)

Posted in hardware, software | Tagged , , , | Leave a comment

Floppy Drive Music via MIDI Controller? Soon Enough.

I started working on this project about a week ago. The end goal of it is to be able to use a MIDI controller of any kind and have it send output to floppy disk drives to be “played.” The principle behind it is the idea of moving a stepper motor at a certain frequency to obtain an audible note. Using a MIDI keyboard to “play” stepper motors is not a new idea, but I’d like to try it out to learn some new things along the way.

I will be basing this project off of the work done by SammyIAm in his Moppy project. The first thing that I have done so far is to reproduce in hardware what he has done on his end. This part was made simple both by forking his code from GitHub and by following along in this instructional video that he has posted to his YouTube account. Next up, I started collecting drives from my house, the hackerspace that I am a member of, and from kind donations from individuals (thanks, jedijf!). I then got to work making some custom cables with 34 pin IDC connectors and cat5 cabling. That was nothing short of a pain in the ass to make 8 cables, but it sure looks pretty! I then had the idea of throwing all of these cables into a custom interface board, kind of Arduino sheild-ish, to make a really clean build. This is where things started to get hairy, but I didn’t know what I was setting myself up for.

So, being that I wanted to have a MIDI controller hooked up to this, I thought that I would bust out my trusty MIDI shield from SparkFun to connect from controller to Arduino. I could have used an Arduino Uno, but I thought a Mega would be better suited for more drives and a custom interface board. Well, I added some headers to my interface board and they fit in just fine at the end of the Mega in the even numbered row of pins 22-53.

Now, the way that the original Moppy software is written assumes that you’ll be using 8 drives connected to pins 2-17 and that the even numbered pins are connected to the step control pin on the drive, while the odd numbered ones control the direction the drive head will be moving. Not only am I just using the even numbered pins from 22-53 for both functions of the 8 drives, but I have my direction pins coming before the step control pins. This all adds up to a large re-write of code. I plan on re-vamping a lot of it by moving chunks off into their own library so that the user can decide any which way to wire up the Arduino board with any number of drives their mcu can accept.
At this point, I believe that I have my Arduino code up to date and ready to rock (ha ha), but I can’t test it yet because the Java side of things is supposed to be telling the Arduino which pins to be toggling for playback. Enter large problem number two: I do not yet know Java. This hasn’t proved too difficult though, because I have a pretty good grasp on general programming theory, so I can read it confidently and know how to look for answers via google if I run in to questions.

I can say that I am learning a good deal of information while taking on this project and I’m not even back at the point where I was about a week ago when I tested the software for the first time. Gotta get this custom/rearranged hardware up and running, then rewrite the code into a library, touch up the Java to work with new Arduino code, and then I can start messing with playing these drives live.

Think I can get it done in a month’s time??

Posted in Uncategorized | 2 Comments

Android ADK

On May 10th, 2011, Google announced that it would be releasing an Android Open Accessory Development Kit. Cool!!!

Wait… what the hell does that mean?

Well, for starters, Google has decided to base this dev kit on the popular, and open source, Arduino platform. Apart from the fact that I am quite fond of the-little-microcontroller-that-could, this is great news because it has potential to open the floodgates of innovation in regards to how we use our mobile devices. Here is another view on why Google’s decision to use the Arduino matters.

Although the “official” dev kit costs ~$400US, you can get away with spending much less using standard Arduino hardware and a USB host shield (examples: [1] [2] [3]). Essentially, you are making a USB host (your gadget) that can communicate to a USB device (your phone). You can now think of your phone as an input/output device for your gadget…

“Now that I’ve got all this fancy hardware built, I’m going to have to spend some time developing an app for my device!” Well, not necessarily… A reader over at Make magazine submitted a project that allows you to program the user interface from within the Arduino sketch. Pretty neat!

Needless to say, I have ordered myself an Arduino Mega and a USB host shield. I’ve already received my Mega, and, with any luck, I will be receiving the USB host shield tomorrow. Can’t wait to get going!

Update: Got the shield today! Time to solder!

Posted in hardware | Tagged , , | 1 Comment

Project Build: Arduino + MIDI shield Update

Well, after some tinkering around with this project, I was finally able to get it to perform the way that I wanted it to!

The initial code was set up so that when you stepped on a button, the PowerPad’s shift registers were polled repeatedly, therefore resulting in a “rapid fire” sound in the MIDI note. If you watch the video linked to in the previous post, you can hear this effect happening. It only took a bit of bit math ;) , and some neighborly advice, to get it firing correctly, and with the ability to play chords!

In regards to the MIDI shield, it was only a matter of changing some of the pin numbers in the beginning of the Arduino sketch. All in all, it wasn’t too bad of a project to take on, though I got it done just in the nick of time for Philly Tech Week!

Check back for some video once it is posted. At my blogging rate, it should only be about two months from now…

Posted in hardware, music | Tagged , , | Leave a comment

Project Build: Arduino + MIDI shield

[singlepic id=9 w=320 h=240 float=left] Today I received my new Arduino Uno, and a Sparkfun MIDI shield in the mail today. I’m hoping to use them in an interactive project for the Hive76 booth at this year’s Philly Tech Week and the Philadelphia Science Festival. The idea is to build an intuitive musical interface that kids can play with and make music.

Being that I have a Nintendo PowerPad laying around, my first run at this will probably be a take on this project: Arduino Nes to MIDI. Perhaps after that I can try my hand at an Arduino step sequencer! [singlepic id=10 w=320 h=240 float=right]

Posted in hardware, music | Tagged , , | Leave a comment

Hello World

This is the first time that I have had a website in a long time. I plan on using this as a site to write about what I am working on, post pictures, and possibly rant a bit. Give me about a week or so to get this thing up and running.

In the meantime, be sure to check out the latest headlines from Hive76!

Posted in Uncategorized | 1 Comment