Contents Chapter 1 What is Raspberry Pi? Chapter 2 Models of Raspberry Pi Chapter 3 What Do You Need to Get Raspberry Pi Up and Running? Chapter 4 Installing the OS on Raspberry Pi Chapter 5 Other OSes for Pi Chapter 6 Programming Your Pi Using Scratch Chapter 7 Arduino and Raspberry Pi Chapter 8 Awesome Pi Uses Chapter 9 Raspberry Pi as Standard Productivity Computer Chapter 10 Using Raspberry Pi to Drive a Multimedia Center Chapter 11 Using Raspberry Pi for Time-Lapse Photography Chapter 12 Using Raspberry Pi as FM Transmitter...
Chapter 1 What is Raspberry Pi? Raspberry Pi is an affordable, credit card–sized, single-board computer. Raspberry Pi was developed for computer science education. This flagship product has been developed by Raspberry Pi Foundation, a charitable organization based in United Kingdom. Features Raspberry Pi is a single-board computer that is about the size of a credit card. It uses a 32- bit capable ARM processor and Fedora from Linux as its default operating system (OS). It can be programmed with languages, such as Python, that will compile with ARM.
Page 7
Raspberry Pi is a system on a chip (SoC). It has connection ports. You can use a Raspberry Pi for basic functions like watching HD videos, working with spreadsheets, and editing documents. In other words, you can do everything that a normal desktop computer is capable of doing. In Chapter 2, we will learn about the different versions currently offered of the Raspberry...
Chapter 2 Models of Raspberry Pi Raspberry Pi has two models. Surprisingly, both models are available at a pocket-friendly price. Model-A costs $25 and Model-B costs $35, excluding local taxes and shipping and handling charges. Also, this does not include charges of power supply and SD card; you have to buy them separately. Difference between Model-A and Model-B Model-A Model-B Price Broadcom BCM2835 700 MHz ARM1176JF-S Core VideoCore IV, OpenGL ES 2,0, 1080p 30 Full HD HP H.264 Memory 256 MB 512 MB 2 (integrated) USB 2.0 ports Video outputs Composite RCA, HDMI Audio outputs 3.5 mm jack, HDMI Onboard storage SD/MMC/SDIO card slot GPIO pins, SPI, I C, UART Low-level peripherals Onboard network None...
Page 11
85.60 mm 53.98 mm Size Debian GNU/Linux, Fedora, Arch Linux Supported OSes Where to Buy? Raspberry Pi Foundation has made exclusive distribution arrangement with Farnell and RS; one can buy any model of Raspberry Pi from these distributors. Resellers do sell on Amazon and eBay. Resellers sell Raspberry Pi with different offers, so prices may vary. Raspberry Pi Model-A...
Page 15
Chapter 3 What Do You Need to Get Raspberry Pi Up and Running? Raspberry Pi is not preloaded even with important peripherals like SD card and power supply cable unless you purchase Pi from a reseller and pay extra for these essential peripherals. In this chapter, you will learn about the essential peripherals that are required to get Raspberry Pi up and running.
Page 16
Charger for Pi HDMI cable Raspberry Pi has one HDMI port for digital video and audio connection. You will need to purchase a separate HDMI capable to view the Pi on an HDMI monitor or television. HDMI cable Important note: Raspberry Pi does not support VGA analog output. You can use a converter but we don’t recommend using one because it may cause you issues later. Using a straight HDMI to HDMI connection is best to avoid compatibility problems.
Page 17
HDMI to VGA converter USB keyboard and mouse You need a USB keyboard and a mouse to establish user interface for your Raspberry Pi. Since Raspberry Pi comes with limited ports, you can purchase a USB extension in case you need more than one USB ports. Since your Pi supports Bluetooth-enabled wireless keyboard and mouse, you can purchase them as well. Wireless keyboard Internet connection Using your Pi, you can connect to Internet in many ways. You can enjoy wireless Internet via a USB–Wi-Fi dongle, and if you would like to connect with high-speed wired connection, then you can use Ethernet cable.
Page 18
USB modem Remember, Ethernet port is only available in Model-B. Ethernet cable Before you install an OS, make sure you have assembled necessary peripherals with your Pi. Operating system (OS) OS is the soul of your Raspberry Pi. So to get your Raspberry Pi up and running, you need to install Fedora which is the standard default Linux distribution used as the OS for Pi. Most of the distributors sell Pi with preinstalled OS. But, if in case you want to install the OS yourself, then read Chapter 4.
Chapter 4 Installing the OS on Raspberry Pi Installing the OS on the Pi can be challenging, so most people and newbies prefer buying a preprogrammed Raspberry Pi as a much easier solution. Installing OS on Raspberry Pi is not extremely difficult, but it does take some basic computer knowledge to accomplish on the first attempt. If you have worked on Windows or any other OS platform in your PC, you can do it yourself easily and can save a few bucks. So in this chapter, you will learn about installing the OS on Raspberry Pi. We are installing Fedora Remix distribution from Linux, but before we install Fedora, we need to download it from the Web.
Page 22
Preparing the SD card for use Raspberry Pi needs a storage and installation media to boot; we need a single SD card. You need to use at least a 4 GB SD card. The image of the file downloaded in the previous step will be stored on this card. Note: Before we begin, make sure that no important file is in you SD card, because it will be formatted at a later stage. If you are using Windows as your host OS, then download Win32 Disk Imager utility from http://www.softpedia.com/get/CD-DVD-Tools/Data-CD-DVD-Burning/Win32-Disk- Imager.shtml Now launch the Disk Imager and extract the image you have downloaded from the Web. You will get an .img file. Make sure you format SD card using FAT32 file system. Now run Win32 Disk Imager with administrator privileges and select the extracted image and the drive letter of the SD card. Always choose the correct drive or else data on the drive will be destroyed. Click on the ‘Write’ button and wait till it finishes extracting data. Depending on your host machine speed, your writing time will vary, but will not take a long time.
Page 23
gateway and wait while your Pi boots up. Setting up the Pi Fedora will resize your SD card automatically; hence, you do not need to make partitions manually. Connect your keyboard and mouse. Once your Pi boots up and black screen disappears, start the final system configuration: set passwords; create user accounts; and select your time zone, graphical user interface (GUI), and fonts. Fedora Remix booting up on the Pi You are ready to work on your Pi now. In Chapter 5, we will learn about the other OSes that can be installed on Pi (in similar way) and their overview.
Chapter 5 Other OSes for Pi There are many OSes that can be installed with Pi; we are covering a few of the important ones. Raspbian ‘wheezy’ Raspbian ‘wheezy’ is recommended for beginners. It’s a reference root file system developed by Alex and Dom. It is an optimized version of Debian, and it contains LXDE, Midori, development tools, and example source code for multimedia functions. Raspbian is referred to as graphical face of the Raspberry Pi. GUI is awesome. Playing a game on Raspbian Arch Linux ARM Arch Linux ARM is a distribution from Arch Linux, which aims for simplicity and full control to the end user. It is not recommended for beginners. Latest version of this image boots up in just ten seconds (command prompt).
Page 27
Android Though Raspberry Pi was not designed for Android devices, but in recent years, developers have developed ways to use Android on Raspberry Pi. At present, not much has been done toward implementing Android on Raspberry Pi, but it is possible that Android would become the most successful OS on Pi in the near future.
Chapter 6 Programming Your Pi Using Scratch In this chapter, we will learn about programming the Pi with Scratch. First, boot up your Raspberry Pi. You will find that Scratch is preinstalled in Fedora. Locate an icon of the Scratch in the desktop menu. Scratch icon You can download Scratch from http://scratch.mit.edu/ Getting started To get familiar with Scratch, it’s best to begin with easy preinstalled projects and resources that are part of the main application. In this chapter, we are going to discuss ‘Aquarium’, which as it’s named is actually a cool animated aquarium with fish and other water dwelling creatures.
Page 31
Select the ‘File’ > ‘Open …’ menu. Click ‘Examples’ on the left. Select ‘Animation’ at the top. Select ‘Aquarium’ from the list. Click the ‘OK’ button. The Aquarium project is now loaded and we are ready for some fun. Before we get started though, you need to know a few things about the Scratch Studio. The Scratch Studio The Scratch Studio can design many fun things like animations and games. Now that you have loaded the Aquarium Project, the Scratch Studio should appear similar to this screenshot below: There are three different blocks or panels in the Scratch Studio. On the left side, there is a ‘Blocks Panel’. The Blocks Panel contains the blocks used to program and build programs. The various blocks are grouped into several categories, such as sensing, control, motion, sound, etc.
Page 32
your program. You will see a complete aquarium here. Underneath is a collection of ‘sprites’. Running the program Above the ‘Staging Area’, note there is a green flag and a red circle. These buttons are used to start and stop the created program and in our case Aquarium. Press the green flag to watch your animation. Enjoy your sample animation coming to life. The stage animation So, how is stage animation done in Scratch? Stage animation is done in Scratch using backgrounds, set of blocks, and sprites. Adding sound Adding sound to animation enhances its quality and grabs attention from its viewer as well. You can add sound to your animations using ‘Sounds’ tab in ‘Builder Panel’. You can import sound or use preinstalled effects.
Chapter 7 Arduino and Raspberry Pi Makers of Adruino define it as: Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It’s intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments. The Arduino board itself is an open-source circuit board (open source means you can design it yourself using individual components available in market). It contains a microprocessor and of course input/output pins for communication and controlling of physical objects like LED, servos, buttons, lights, thermosensors, photoreceptors, etc. It is powered via a USB connection.
Chapter 8 Awesome Pi Uses Till now we were only dealing with theoretical aspects of our Pi. After reading our earlier chapters, you may be thinking, Okay, I have understood what Pi is, but how can I use it? What are its uses? You can design and develop numerous projects with Pi. For starters, we are explaining some interesting uses of Raspberry Pi.
Chapter 9 Raspberry Pi as Standard Productivity Computer Did you know that a $35 Raspberry Pi can be used as a standard productivity computer? Using a Raspberry Pi, you can set up a basic office computer for very little money. So, what you do with your standard computer that you have at home? Processing Word documents, spreadsheets, PowerPoint, etc. Browsing Internet, social networking sites, and checking e-mails. Programming and coding in various languages. Playing HD games. Watching videos and hearing songs. You can also do these things with Raspberry Pi! Next we will convert our Pi to a standard productivity computer. What do you need? Hardware Raspberry Pi Model-B Mini USB power 700 mA, 5 V 32 GB SDHC card (minimum 4 GB) Ethernet or USB modem (optional) ...
Page 36
Keyboard and mouse (wired or wireless) HDMI cable Monitor with HDMI input support (in case of VGA, purchase HDMI to VGA converter) USB extension (optional) Once you are ready with these parts, hook up your Pi as instructed in Chapter 3. Boot up your Pi as instructed using the OS of your choice and configure your Pi accordingly. Your Pi can now do everything that a standard computer can do. You can use it for many purposes. Let’s see what are the software products required to convert your Pi into a PC. In case it is preinstalled with these software products, you need not download them. Software Features LibreOffice 4.0 (free) LibreOffice is a comprehensive, professional-quality productivity suite Download link: (like Microsoft Office) from the http://www.libreoffice.org/download/ Document Foundation available for free download. It supports 30 languages and OS,...
Page 37
Scratch (visual animation software) To create awesome animation and games using Scratch, all you need is a Download link: http://scratch.mit.edu/ latest copy of Scratch. VLC Media Player To play most of the audio and video formats. Download link: http://www.videolan.org/vlc/download- fedora.html These are some of the most important and common tasks that a standard PC can handle. In case you need more tasks from your Pi, you can get additional software products from Internet for use on your Raspberry Pi. You can add CD or DVD or Blu-ray drives to Raspberry Pi using USB slots in case you want to watch a movie or play HD games.
Chapter 10 Using Raspberry Pi to Drive a Multimedia Center The Raspberry Pi is a great low cost solution to building your own mini media center. In this chapter, you will learn about setting up Xbox Media Center (XBMC) on your Pi with a universal remote control using FLIRC which is nothing more than a USB dongle that can be plugged into the Pi. What you’ll need? A Raspberry Pi (Model-B) Raspberry Pi power charger Mouse and keyboard (wireless or wired) Ethernet cable and working Internet connection FLIRC Universal remote (or spare one) A PC or laptop (only for the initial setup) Setting up XBMC Installer on the SD card for Pi First you need to load the XBMC (RaspBMC) media OS on the Raspberry Pi. In this section, we are going to use a Windows PC; steps are almost same for Linux and Mac PC.
Page 41
Now run the file named ‘installer’ (located on the top of the screenshot). This will then open the SD card writer. Raspbmc Installer Insert your SD card in your SDHC slot; make sure it does not contain any important data. Select it as your writable media (choose the correct path or else you will lose your data). Now tick the ‘I accept the license agreement’ checkbox and hit the ‘Install’ button. Wait while it is installed on your computer. This will initiate set up of your SD card with the RaspBMC installer. Now wait till it finishes installing; speed will vary depending on your host PC configuration. Once completed, following window will appear.
Page 42
Remove the SD card from your SDHC port, and we can now use the RaspBMC on our Raspberry Pi. Setting up RaspBMC on the Raspberry Pi Before you begin, ensure that your Raspberry Pi is connected via Ethernet to the Internet or else it will not work. Add a mouse, keyboard, and monitor; plug SD card in the SDHC port of your Raspberry Pi; and connect a power supply to your Raspberry Pi. There will be a splash screen that will appear for a few seconds on your monitor, and then the rest of the setup will start automatically. The entire process should not take more than 15 minutes to download and install (speed depends upon your LAN connection). It will restart a number of times before XMBC GUI is installed, so wait patiently. Spend some time in familiarizing yourself with XBMC.
Page 43
same way you do with any other Windows programs. Once completed, run the FLIRC software and you should see the following input screen:...
Page 44
This is currently disconnected Plug your FLIRC module (Raspberry Pi) into the PC using the USB connector. Wait for some time; it will install automatically on your computer. Now status will be updated to ‘connected’.
Page 45
This is currently disconnected XBMC has many commands, but in this section, we will start with some of the basics. This will include commands like ‘Navigation’, ‘Enter’, and ‘Back’. Next step is to set up the remote control. Get a remote control; this can be any IR remote —be it TV, CD, DVD, satellite, or universal remote, or anything. Once you are ready with your remote control, hit the ‘go!’ button.
Page 46
It’s time to sync your remote control with our newly installed FLIRC software. The virtual buttons will then flash individually. Hit the button on the remote to associate a keyboard stroke with corresponding key on the remote. As an example, when the ‘down’ navigation on the FLIRC software flashes on your screen and you hit the ‘down’ button on the remote, it will get associated with FLIRC. After setting up all of the keys, your basic XBMC will be ready for use. Once you have completed the setup, quit the program on your PC and remove the FLIRC module (Raspberry Pi) from your PC. Putting Everything together Get back on to the Raspberry Pi. Start by removing the mouse and keyboard and replacing it with the FLIRC USB module. Next, switch the FLIRC USB module on. After giving it a few moments to boot up, you can control your Raspberry Pi media center using your remote control!
Page 47
If you need more information,you can browse http://forums.flirc.tv/ More complex keyboard to remote Setups Learn about more of the XBMC built in commands. Standard XBMC keyboard navigation controls can be found below: http://wiki.xbmc.org/index.php?title=Keyboard Keymapping your entire keyboard to your remote control is possible. In the next section, please take a look at some of the various commands. Key Global Video playback Music visualization Audio delay Live TV: Schedule recording Live TV: Schedule recording timers timers Contextual menu Playlist Live TV EPG/TV guide Live TV EPG/TV guide Fast-forward Fast-forward Fast-forward Live TV channels window Live TV channels window Info Info Info Live TV: Radio channels Live TV: Radio channels window window...
Page 48
Live TV recordings window Live TV recordings window Next subtitle Lock preset Player controls (OSD) Player controls (OSD) Player controls (OSD) ‘Now playing’ playlist Displays CPU usage and video Codec/visualization info diagnostic info Play Play Visualization preset list Queue Rewind Rewind Rewind Shutdown menu Show preset Toggle subtitles on and off Move up Teletext Visualization settings Marked as watched/unwatched Stop Stop Stop Zoom/aspect ratio Pause/play Pause/play Pause/play Space Step back 30 s (videos) ← Left Previous Previous channel group (live TV) Step forward 30 s (videos) ...
Page 49
Channel down (live TV) Page up PageUp Page down PageDown Select Player controls (OSD) Player controls (OSD) ↵ Ente r return Back ← Backspace Previous menu or home screen Exit full screen Skip forward Step forward 30 s Skip forward period Skip backward Step backward 30 s Skip backward comma Small step backwards 7 s ‘ quote Tab ⇆ Full-screen mode Full-screen mode Full-screen mode Screenshot Screenshot Screenshot PrintSrc Volume down Volume down Volume down minus Volume up...
Page 50
Now once you have synced your remote control, you can use it to operate your media center. Connect your USB module with monitor and speakers using HDMI and add songs to your XBMC; use your remote control and FLIRC to control how audio and videos will play. Your media center is ready. In Chapter 11, we will learn about using Raspberry Pi for the purpose of time-lapse photography.
Chapter 11 Using Raspberry Pi for Time-Lapse Photography Raspberry Pi camera Raspberry Pi makes a great, cheap, and quick solution for time-lapse photography; in this chapter, you will learn about setting up your Raspberry Pi for time-lapse photography. What you’ll need? A Raspberry Pi (either model) Raspberry Pi power charger Raspberry Pi 5.0 MP camera Model-A Mouse and keyboard (wireless or wired) Battery (3,200 mAh) Universal remote (or spare one) A PC (desktop or laptop) to complete the initial setup Configuring Raspbian Install Raspbian on your SD card (see Chapter 4). In order to enable support for the camera on Raspberry Pi, we need to add two lines to /boot/config.txt: start_file=start_x.elf fixup_file=fixup_x.dat Since we are going to use battery pack as the source of the power, to keep the power...
Page 54
consumption down and to minimum, we need to ‘underclock’ the Pi by adding: arm_freq=300 Hardware setup Raspberry Pi camera The Raspberry Pi camera is a 5 MP device and is connected to the CSI port of the Raspberry Pi via a flexible flat cable. We will be using Model-A as it consumes less power and can be housed into a small enclosure. Once you have installed Raspbian on your SD card, insert it into the SD card slot of your Raspberry Pi. Now connect your Pi with camera using CSI, monitor with HDMI, keyboard and mouse with USB, and connect to power supply.
Page 55
be used to quickly determine which boot series it is from, and it will also show accurate time and date in the case of Model-B. Power consumption In idle condition, Pi draws 117 mA, and it rises to about 286 mA when camera becomes active. So a 3,200 mAh battery pack should easily give 12 hours operation. Next step is to assemble Pi and place it into a handy windowsill. First run Place the Raspberry Pi and the battery pack in a windowsill and properly attach the camera to the window with tape. Allow it to boot up. Wait for 12 hours, and after 12 hours, it will contain at least 5,518 JPEG files. Remove it from the Pi and connect it to your PC. You can now browse through the collected photographs. This will find good use in crime detection and home security.
Chapter 12 Using Raspberry Pi as FM Transmitter It is very easy to convert your Pi into a FM transmitter. We have already done so many projects; steps are same. Preparing the SD card First, download this file from the given link, and using WinDisk32 Manager or PoweISO, unzip the file and then transfer the image card: http://www.icrobotics.co.uk/wiki/images/c/c3/Pifm.tar.gz Booting up the Pi Boot up your Pi with SD card loaded with the image and compile pifm.c gcc -lm -std=c99 pifm.c Compiling and setting up transmission This will create a compiled program called ‘a.out’. Now, run the file. By default, WAV file is set to 16 bit, 22.5 kHz, and mono mode. Set WAV file to ‘-’ to use stdin. Suppose you want to broadcast a song ‘sound.wav’ at 100.1 MHz, then enter this command: sudo ./a.out sound.wav 100.1 This command will tell ‘a.out’ to play ‘sound.wav’ and transmit it at 100.1 MHz FM.
Need help?
Do you have a question about the Rasberry PI and is the answer not in the manual?
Questions and answers