Sunday, June 8, 2014

Setting up a Raspberry Pi to Control Physical Objects, Pt. 1

There are a slew of relatively simple systems to control physical objects w/ software. The most popular options are Arduino, the Raspberry Pi, and BeagleBoard. I'm an avid Raspberry Pi advocate, so let's start with that! 

The RPi is a simple & inexpensive computer that has general purpose input and output (GPIO) pins that interface w/ the real world. 

((This tutorial assumes you are a beginner, but some technical jargon is included. Please feel free to comment if a term or phrase is not clear.)) 

 

What is a Raspberry Pi?
The Raspberry Pi is a credit-cared sized computer created by the Raspberry Pi Foundation, an educational charity based in the UK. It is designed to promote programming, computing, and interfacing with the physical world. It can control pretty much anything you are capable of conceiving.

There are two versions of the Pi:
-- Model A is cheaper w/ fewer features; 256 MB of RAM, one USB port and no Ethernet port.
-- Model B is more expensive, but has 512 MB of RAM, two USB ports, and a 100mb Ethernet port.

Where to purchase:
You can buy a Raspberry Pi from a variety of distributors. Model B from Adafruit is $40 (+ shipping & handling). 


Other supplies:
The Pi is literally just a computer. You'll need a few additional supplies to set it up and use it (unless you're a wizard). Think of it like a puzzle: collect the remaining pieces to customize an inexpensive interactive computer! To make the process easier, here's a list of parts w/ explanations (you probably already have some):


1. Power Cord
The Pi runs on a micro-USB power supply, similar to many phone chargers. More specifically, the Pi needs 5 VDC and at least 700 mA. The Pi Foundation recommends a power supply that can provide 1200 mA. You can get one for less than $10, best values ~ $5, if you're crafty you can find cheaper (or free). Here's a google search for some that meet the best specs. Take note of where the power cord plugs into: wall socket, USB, etc.

2. SD Card
The Pi needs an SD card for physical memory storage (it doesn't have a built-in harddrive or solid state drive). For ~ $6, you can buy an SD card with a pre-installed operating system and necessary software from the Pi Foundation's Swag store here
With slightly more effort, you can buy any generic SD card and download the software here. This is fairly easy with a Mac system; if you chose to go down this route, here's a great tutorial.

3. Monitor & Display cable: HDMI/DVI cable or RCA composite video lead.
Most modern monitors and TVs have HDMI ports for video (you can connect your RPi to your TV, woo!!). If you don't already have one lying around, HDMI cables are found at RadioShack, Best Buy, Amazon, Ebay, etc. You can also get a HDMI converter cable for monitors or TVs w/ different ports. Older monitors are easy to find for free; many places of business, colleges/universities, and friends are happy to part with old monitors, or you can check out e-waste recycling bins.

4.USB Keyboard & mouse (easiest way to set up).
Any keyboard and mouse w/ a USB connection will work w/ the Pi.

Optional Supplies: 
5. Ethernet Cable  (easiest way to connect to the Internet for Model B). 
Usually blue and lying around in some pile of cords you know are important. You can also buy them at places like Radio Shack, Best Buy, Amazon, etc.
Source: http://www.bitrebels.com

6. USB WiFi chip.
Getting a USB WiFi "dongle" (yes, that is actually what it is called..) will allow you to connect to the Internet w/out an Ethernet cable. This requires some fairly involved setup, but it is completely doable for a RPi user of any experience level. Here are two methods: 
--Using wicd-curses,
--Using GUI application

7. Audio Lead (if not using HDMI)
To get sound w/out an HDMI cable, you'll need a standard 3.5mm jack to connect to speakers or headphones.

8. Case
The Raspberry Pi is designed to be a bare-bones computer to reduce cost as much as possible. However, cases are helpful protection from inevitable accidents and improve the mechanical connection of cables. There are TONS of awesome cases made specifically for the Raspberry Pi, although feel free to get creative and make your own!


Basic Setup:
Source: http://rayhightower.com
1. Insert SD card. Plug the RPi into a monitor & connect the keyboard and mouse via USB. An Ethernet cord is also recommended as it makes installing software on the RPi much easier .

2. Plug the power cord into the RPi. Make sure you see a light turn on. (Yes, I honestly needed to include this step because this is an all too frequent problem for me.) 
Always do this after everything else is plugged in.

3. If everything has been connected properly, you will see a start-up window. Every operating system (OS) will be different, but initial setup is simple and manageable. 
If you have a pre-loaded RPi-specific OS, or you have Raspbian or Adafruit's OS, here's a super straightforward tutorial on how to fully configure the RPi. 
Changing a few basic settings will definitely make life easier. From personal experience, if you have an SD card larger than 2 MB it's useful to initially expand root partition to use the full SD capacity. If you want to avoid a command line window, you can specify Desktop launch whenever you power up the RPi.
The default username is "pi" and the password is "raspberry". 
Note: Since every OS is different, if your Pi doesn't launch into the startup window, if you are still on the terminal window type "startx" into the command line. If that doesn't work, leave a comment and we can troubleshoot together!  

4. Essentially that's it! Once you're at the desktop, you can use the Pi much like any other computer! Some basic programs: Midori is a simple Internet browser, Leafpad is a word processing program, Idle is a Python programming environment, and Scratch is kid-friendly programming language.

I will add more on how to set up the wireless, or other topics as requested. 

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete

Creative Commons License
This work by Jennifer Fox is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License