Physical computing with the Raspberry Pi can be relatively cheap, but easily snowball into an expensive endeavor with an ambitious imagination. I would call this an ambitious project.
For this project, you will need the following parts. I provided links to a popular and trustworthy vendor’s website (Adafruit and Amazon) so you can easily buy each part without wasting too much time searching for them.
Essential:
Optional but recommended: - SmartPi case (protect your delicate Raspberry Pi and Pi camera, works with GoPro, and is LEGO compatible.)
I recommend a 64GB card because I ran into a lot of problems with not enough space on a 16GB card. There might be ways to fit everything you need onto a 16GB card (I tried one). In case you’re curious, I deleted my hidden trash cache. I’ve also read something about NOOBS taking up a lot of space and some way(s) of dealing with that to free up ~1GB. However, it’s satisfyingly more efficient to avoid troubleshooting tasks unrelated to your goal.
Let’s assume that you have a brand new Raspberry Pi 2.
Download NOOBS 1.5 from the RaspberryPi.org website onto your computer. “NOOBS is an easy operating system installer which contains Raspbian. It also provides a selection of alternative operating systems which are then downloaded from the internet and installed.” Raspbian (based on Debian Linux) is the OS recommended for beginners. It includes a desktop GUI, web browser and some cool software, e.g. Scratch, a graphical language to teach basic programming to children, and Sonic PI, a programming language to write your own music.
Check that your SD card is properly formatted as a FAT filesystem. “The Raspberry Pi’s bootloader (built into the GPU, so non-updateable) only has support for reading from FAT (both FAT16 and FAT32) filesystems though, and is unable to boot from an exFAT filesystem. So if you want to use NOOBS on a card that is 64GB or larger, you need to reformat it as FAT32 first, before copying the NOOBS files to it” (Reference: FORMATTING AN SDXC CARD FOR USE WITH NOOBS).
Note that Formatting the microSD card deletes all data from the card.
Steps to format your SD card on a Mac: 1. Insert the Micro SD card into the SD card adapter that came with card. Connect the SD card adapter to your computer by using an external card reader. * Also note – Mac OS 10.6.5 or earlier does not support exFAT format, which most 64 GB SD cards are formatted to. This means that you won’t be able to format or use exFAT card on your computer. In this case, we’d recommend either upgrading your OS to 10.6.6 or later, or using an SD card that’s already formatted to MS-DOS (FAT) or FAT32 to complete the below steps. Open Disk Utility. To do this, click on the magnifying glass in the top-right corner of your computer screen. Type “disk utility” in the search box that opens, then click on the “Disk Utility” Application that comes up. 2. The SD card will be listed as something like NO NAME or UNTITLED in the left side of a Finder window. 3. Open “Disk Utility,” click on the microSD card and click the “Erase” tab. 4. Click on the “Format” dropdown menu. Select “MS-DOS (FAT).” If the card is 64GB or larger, it will be “ExFAT” by default. If it is 32GB or smaller, we can skip this process since it will be FAT by default. You can rename your card it as well, to something like RASPI_64GB. 5. A message will appear asking, “Are you sure you want to erase the partition “[YOUR SD CARD NAME]?” Click “Erase”. Now the computer will delete the contents of your SD card and format it. You’re all done. (Reference: GoPro).
Copy all of the files from the NOOBS_v1_5_0 folder and paste them into your microSD card.
Insert your microSD card into the microSD port of the Raspberry Pi. Before powering your RPi, note that a rainbow screen on start-up is fine, as long as it lasts ~5 seconds. After this disappears, you will get a message about “resizing partitions” on your SD card (~5 seconds). Then a message stating “Please wait while NOOBS initializes” (~5 seconds). Let’s power-up. I also recommend hooking your Pi up directly to your router with an ethernet cable. This prevents some problems when trying to set-up over WiFi with the GUI (e.g. selecting your WiFi network and entering the password will let you connect to the network and ssh over LAN, but it won’t give the RasPi internet access, or at least it didn’t in my case).
You can power your Raspberry Pi using an Amazon Kindle USB charger since it supplies 1000mA @ 5V. 1000mA will be enough to support for the set up process, wireless keyboard & mouse, and WiFi “dongle.”
It will take ~15 minutes to install the Raspbian OS.
Wait until you see a window: “OS(es) Installed Successfully.” Click “OK.” You will see lines of code with [OK] in green running across your window, then a black screen for about 30 seconds before your GUI desktop loads.
[Optional]: Set-up WiFi (Reference: Set up WiFi on a Raspberry Pi) WiFi is necessary for mobile Pi projects. You can save this step for later and just use an ethernet cable connected directly from your router to your RasPi if you’d like.
Check to see if your WiFi USB dongle is detected by looking at the list of all attached USB devices:
lsusb
Look for Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter. If you see it, continue. Alternatively: you can try the following:
ifconfig
You’ll see eth0 for the built-in wired Ethernet port; lo for the loop back device; and wlan0 for the wireless adapter. If you see a local IP address has been assigned by your router, continue.
Command-line setup
cd /etc/netwrok/interfaces
sudo nano interfaces
Without sudo, you will get a permission denied error.
Add in auto wlan0 anywhere in the file. Press CTRL+X, “y” to save, press “Enter” to confirm overwriting the original file with your change.
Open up a terminal and start by updating and upgrading installed packages, followed by updating the Raspberry Pi firmware:
sudo apt-get update
sudo apt-get upgrade
sudo rpi-update
Install the required developer tools and packages:
sudo apt-get install build-essential
sudo apt-get install cmake
sudo apt-get install pkg-config
Alternatively, you can use install all three packages using one line of code:
sudo apt-get install build-essential cmake pkg-config
Both build-essential and pkg-config are likely already installed, but just in case they are not, be sure to include them in your apt-get command. build-essential is a package which contains references to numerous packages needed for building software in general.
The command sudo apt-get build-dep packagename means “As root, install all dependencies for ‘packagename’ so that I can build it”. So build-dep is an apt-get command just like install, remove, update, etc.
Timings: Raspberry Pi 2: < 40 seconds — ### Step 2: Install the necessary image I/O packages. These packages allow you to load various image file formats such as JPEG, PNG, TIFF, etc.
sudo apt-get install libjpeg8-dev
sudo apt-get install libtiff4-dev
sudo apt-get install libjasper-dev
sudo apt-get install libpng12-dev
http://192.168.0.1/ IP Address: 24.163.95.248 If you want to connect to the Pi via Terminal (Mac)/Putty (Windows) from outside the LAN, instead of connecting to the Pi’s IP, you have to connect to your router’s outside IP, also known as your Wide-Area-Network (WAN) IP address. You can find this by going to that router settings page we went to before, and looking under “Router Status” (Make sure you’re still connecting to port 22 in Terminal/putty, by the way)
First, let’s enable WiFi connectivity to your RasPi.
ssh pi@<IP>
ssh pi@24.163.95.248
where <IP> is your RasPi’s local IP address. Since this is your first time logging in, use the default password: raspberry. You can change your password later on.
Also note, every time you turn on and off the router, it will change it’s outside IP address, so you’ll have to and find it every time you plug it in again.
Say you have an old RasPi but new SD card. You will probably get this error:
Andrews-MacBook-Pro-2:~ andrewwong$ ssh pi@192.168.0.103
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
41:85:db:df:7d:ba:97:73:ee:b6:27:3d:4d:b5:17:20.
Please contact your system administrator.
Add correct host key in /Users/andrewwong/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/andrewwong/.ssh/known_hosts:8
RSA host key for 192.168.0.103 has changed and you have requested strict checking.
Host key verification failed.
The easiest fix:
ssh-keygen -R <host>
where
ssh-keygen -R 192.168.3.10
Then try again.