Tuesday, April 24, 2012

Raspberry Pi - Day 2, 3 and 4

I spent Day 2 about 350 miles away from my RPi, having to go to a convention for my day job. Days 3 and 4 were wrapped around trying to get the Debian kernel to find the uvcvideo module. On a whim, I went ahead and tried the ArchLinux build and low and behold, uvcvideo was cooked in. I moved my scripts over from the Sheevaplug that I was prototyping on and got to work.

Things that I have installed that worked without issue:

* motion - gets 6 GPS with movement processing
* uvcvideo - Mounted my 4 USB cameras without an issue
* git
* opencv
* python2

Things that partially worked:
* audio - The mp3 player I was using, mplayer, is panicking the kernel due to issues with the kernel that are in process of being resolved. TBE worked much better, but has a weird problem that the process hangs for a few seconds after the stream ends.

Wednesday, April 18, 2012

Raspberry Pi - Day 1

After a long wait, a quick rush to order at 1 AM, and another slightly shorter but long wait, my first Raspberry Pi showed up on my doorstep. I have been prototyping a system to basically create a home sentry system (aka Turret from Portal 2).

Up until this point, I have been using a SheevaPlug with a USB soundcard, a USB camera, and an Arduio with a Motor control shield. I ran the ARM version of Debian, which the RPi has a release already created as well. On top of that, I use the OpenCV library in a Python script to handle the webcamera feed and detect movement. If no movement occurs after a long time, the bot starts talking to itself. When it detects movement, it  plays sounds from the "Detect Movement" bank and runs the motor to open the arm sockets. When it detects noise, it plays sounds from the "Detect Noise" bank. After a interval, if noise or movement stops, it goes back into a Caution state and plays caution sounds for a while and retracts the arms, then goes back into a sleep state. I did a quick prototype prior to digging into OpenCV using a great app called "motion".

A rather simple project, but one that involves computer vision, motor control, audio files, and is possible to do extremely inexpensively, especially due to the RPi being $40.

Code will be posted when I get to at least an Alpha state of the project.

Tonight, I was able to load my SD-card with the Debian install, expand it out to the full size using a GParted Live disk in a VirtualBox window on my Windows 7 PC, and accessed the RPi via SSH. I then loaded motion, opencv and python-opencv. Python is already installed. It looks like the uvcvideo module is not installed and I am having problems grabbing the kernel sources to import it myself.

So, I guess this puts an end of my first day of this.

Friday, April 6, 2012

Pogoplug+: From Out of the Box to Media Grabbing and Slinging Machine

This guide will walk you through modding a Pogoplug to handle grabbing media from Usenet to serve out to the rest of your home network.

We will be installing:

  • ArchLinux|ARM for the Operating System. (The current V3/Classic/Pro kernel is
  • Sickbeard and Couchpotato will be used to grab media through Sabnzbd.
  • Samba to serve files to your Windows PCs and Media Boxes

Other things you can install:
  • NGINX to wrangle all the ports into easy to remember urls and accessibility from the Internet
  • MiniDLNA or MediaTomb to transcode to devices like the PS3

I used a Pogo-B01 (aka Classic) on 4/4/2012, changes to the OS or Apps used may change after this date and require different instructions. The packages involved should be available for your Pogoplug. The only major difference being the initial loading of ArchLinux|ARM. Also, this fits a few of my personal tastes in setup

What you need:

Only have your OS drive plugged in until later. This way, you won't accidentally wipe out anything you give a care about.

1. Set up ArchLinux|Arm on the system per your particular Pogoplug’s revision http://archlinuxarm.org/platforms
  • For the V3/Classic/Pro: At the step 14, before running depmod, you may need to set up the modules.builtin file first:
    cd /lib/modules/ && find . | grep ko | cut -f 2,3 -d \. | cut -f 2- -d \/ > modules.builtin
  • For the V3/Classic/Pro: At the step 16, where the instructions say to update packages using pacman, it will ask to update pacman first, tell it NO! Also, if it asks you to remove udev-oxnas for udev, tell it NO! It will only ask if you try to update pacman first before updating everything else. Replacing udev-oxnas will udev will cause your plug to no longer boot. If you somehow have still went ahead and did that, see the “Help! It stopped working!” part at the bottom of the http://archlinuxarm.org/platforms page for your box to start recovery of the OS.

27% of diskspace on a 2 GB memory stick already eaten up

2. Create a swapfile:
dd if=/dev/zero of=/swapfile.img bs=1M count=512
mkswap /swapfile.img
swapon /swapfile.img
echo "/swapfile.img   none   swap   sw   0   0" >> /etc/fstab

We may be able to get away with 256, but I want to play it safe when this thing will be doing large unrar operations.

3. Install SABnzbd:
pacman -Sy sabnzbd

4. Configure SABnzbd to listen for remote machines and require a login:
nano /etc/conf.d/sabnzbd

Change the below line, replacing with your boxes IP address:

Change the below, adding in a login name and password with a colon separating the name and password and an @ after the password:

Press Control-
5. Start SABnzbd:
rc.d start sabnzbd

6. Log in to SABnzbd to make sure it works.

Don’t load any files just yet or you will run yourself out of diskspace quick.

7. Get yaourt to install other apps:
pacman -S yaourt

8. Install Sickbeard:
yaourt -AS sickbeard

Respond No to “Edit PKGBUILD?”
Respond No to “Edit Sickbeard.Install?”
Respond Yes to “Continue Install?”
Respond Yes to “Install Sickbeard?”
Respond Yes one more time for the “Proceed with Installation?”

9. Let’s fix a very out-of-date sickbeard:
cd /usr/lib
mv sickbeard sickbeard-bak
wget --no-check-certificate https://github.com/midgetspy/Sick-Beard/tarball/master
tar -zxvf master
mv midgetspy-Sick-Beard-xxxxxx my-sickbeard-install
chown -R sickbeard:sickbeard sickbeard
rm -rf sickbeard-bak

The xxxxxx will be something like acaf5ca, just look at the output from the “tar” command.

10. Start up SABnzbd.
rc.d start sickbeard

11. Log in to SABnzbd to make sure it works and click the “Update” button at the top.

Don’t load any shows just yet or you will run yourself out of diskspace quick.

12. Install CouchPotato:
pacman -S couchpotato-git

13. Start up CouchPotato.
rc.d start couchpotato

14. Log in to CouchPotato:

Don’t load any movies just yet or you will run yourself out of diskspace quick.

15. Install Samba using this guide: http://archlinuxarm.org/support/guides/applications/samba

16. Run “df”. You should now be setting at around 77% of a 2 GB drive used. This is why I wanted to make sure you weren’t using up drivespace with downloads. We need to set each tool to use a different drive than your USB stick for their storage needs.

17. Plug in your USB hard drive now. If you had done the udev-automount from the ArchLinux|ARM instructions in step one and your drive was already formatted in Windows using the FAT32 or NTFS file systems, it should have just mounted on your Pogoplug.  If you need to format it or want to format it in a Linux format like EXT3, do this now. I figure many of us have a drive already formatted in Windows and would like to be able to take it other places. If you do, format FAT32.

17. Run “df” again. You should now see /dev/sdb1 mounted on /media/hd-sdb1.

18. First, let’s make a good spot for SABnzbd to dump stuff and link it to the default location. This will protect you from a problem with your OS drive overfilling if your storage drive goes AWOL.

mkdir /media/hd-sdb1/sabnzbd
rm -rf /opt/sabnzbd/Downloads/
ln -s /media/hd-sdb1/sabnzbd /opt/sabnzbd/Downloads
rm -rf /opt/sabnzbd/logs
ln -s /media/hd-sdb1/sabnzbd /opt/sabnzbd/logs

19. Feel free to change the log location for sickbeard to the storage drive as well. You can do it at:

20. You are ready to rock and roll. Configuring your Apps is dependant on the services you use. There are wonderful guides for these tasks at: