Things I Do With My Raspberry Pi


2013-06-30

Check out more posts about the Raspberry Pi here: Raspberry Pi Posts

The Raspberry Pi, an inexpensive and tiny Linux machine, has garnered much popularity. At $35, it's one of the cheapest full-blown computers that you can buy and easily use out of the box. There a a ton of uses for a Raspberry Pi, but I often see people buy one on impulse and then find themselves at a loss for what they should do with it - the Pi just ends up sitting on a shelf. Here I will keep track of how I am using my Raspberry Pi and what I have used it for in the past.

1. Backing up my email

One of the most important uses I have for my Raspberry Pi is backing up my email. I use a program called getmail that can be used to check an email account using POP or IMAP. I have it checking my gmail and other email accounts at regular intervals with cron job. The email is saved to a mbox file that can be copied to another computer at any time for long-term email archiving. I wrote a small guide about how I do this here: How to Back Up Email with Getmail.

2. Security camera

For a while I had a webcam connected to my Raspberry Pi and was using a program called motion to detect and capture images of movement in front of my house. motion is a powerful program that can be heavily customized/extended to do all kinds of image and video capture. I had a site set up to view the images taken by the Raspberry Pi and motion, and each image was a link to a video of the event.

3. Host my personal RSS reader

I recently discovered a self-hosted, web-based RSS client called miniflux that can be installed on a Raspberry Pi. I, as many have, migrated off of Google Reader when it was announced that it would be shut down on July 1, 2013. I was using a program called rss2email for a while to send RSS feed items to my email inbox. However, I wasn't as happy with that method and I found miniflux after looking around for an alternative to Google Reader and rss2email. miniflux is very simple to set up on a Raspberry Pi. All you need is PHP and a web server program like nginx or Apache.

4. Host websites

One of the most obvious uses for my Raspberry Pi was to host a website or three. For a while, this site was hosted on my Pi (and might be again, soon). The Pi has plenty of horsepower to handle static sites and also some using web frameworks. I've hosted Flask sites on mine and I have read about some people even installing a Wordpress instance on a Raspberry Pi. Here are a couple of tutorials to get you started:

5. Household NAS

With the very low power usage of a Raspberry Pi, it's a perfect candidate for being a NAS, or network attached storage device. I previously had a 500 GB laptop hard drive connected to the Pi (and was even running the Pi's OS on it). I would store many of the files on it that I needed to transfer between my computers. I would then connect to it via SFTP and have access to all of my media from any machine in my house (or outside of it, with the right routing). You can also set up Samba on a Raspberry Pi to make it easy for Macs and PCs to access the storage. Update: I've started using BitTorrent Sync on my Pi to replace Dropbox. It's working great and I have much more space than what I had on Dropbox (2 + 19 GB bonus). You can read about setting it up here: Installing BitTorrent Sync on a Raspberry Pi.

6. Pingdom replacement

Another use I have put my Raspberry Pi to is checking web sites that are important to me. I have written a Python script and run it at regular times to make sure these sites return a 200 status (meaning they are up). The script will email me a summary of the incident if the site is deemed to be down or inaccessible. I use a Python module called Requests to check the site, and another called smtplib to email me.

7. Event Reminder

I use my Raspberry Pi to email me about important events that I need to remember. I previously used Google Calendar, but I only needed it for simple reminders. So I substitute the functionality with my Raspberry Pi, a Python script and cron jobs. I set a cron job for the date and time I need to remember, which executes the python script and passes in a message argument. This message is sent to my email and reminds me of the event on the date that I choose.

8. Host a family photo album

My Raspberry Pi also hosts a private website that displays all of my family photos. I have set up authentication for the site so that only people I wish to see it can access it. This is a good replacement for placing all of your photos on Facebook, where you account can be deleted or photos viewed by strangers on accident. It's a simple PHP site that loads images from a directory on the Pi that I choose.

9. Jukebox

Since my Pi acts as a NAS, I have all of my music stored on it. I also have a set of stereo speakers connected to the audio jack on the Pi and I use mpg123 to play music from the Raspberry Pi's command line. Although there are other mp3 players out there, including graphical ones, I went with mpg123 for it's simplicity and ease of set up.

10. Calendar and Contact Syncing

Since I don't really trust Google to sync my contacts and calendar to my phone anymore, I set up a CalDav and CardDav server on my Raspberry Pi. I use Radicale as the server (http://radicale.org/) and DavDroid on my phone as the client. Radicale is easy to set up, and you can get DavDroid for free if you use F-Droid, the alternative Android market. Now that all my contacts and events are synced to my Pi, I'm the only one that sees them, I can back them up at the filesystem, and I don't have to worry about a company deciding they would rather my use a new Calendar or Contact storage paradigm on a whim.

11. Git Repo Server

If you're a developer or like versioned files, you can set up your Pi to serve your git repos. All you have to do is do a git clone --bare from your repo's current location. Then you can access the repo at ssh://yourpi.com/absolute/path/to/repo, replacing each part of the url with your info.

Side note:
I know a lot of people complain that any of these uses for the Raspberry Pi can also be applied to any other Linux machine. This is true, and I encourage you to use an old laptop to experiment with these activities. But the Pi is silent and won't show up on your electricity bill as heavily, so I think it is better suited for many of these projects.