Getting Started with Raspberry Pi, Matt Richardson & Shawn Wallace, 2013

Getting Started with Raspberry Pi


Author: O'Reilly Media, Inc

Publisher: Bukupedia


Category: Computers

Page: 177

View: 784

Preface It’s easy to understand why people were skeptical of the Raspberry Pi when it was first announced. A credit card-sized computer for $35 seemed like a pipe dream. Which is why, when it started shipping, the Raspberry Pi created a frenzy of excitement. Demand outstripped supply for months and the waitlists for these mini computers were very long. Besides the price, what is it about the Raspberry Pi that tests the patience of this hardware-hungry mass of people? Before we get into everything that makes the Raspberry Pi so great, let’s talk about its intended audience. Eben Upton and his colleagues at the University of Cambridge noticed that today’s students applying to study computer science don’t have the skills that they did in the 1990′s. They attribute this to—among other factors—the “rise of the home PC and games console to replace the Amigas, BBC Micros, Spectrum ZX and Commodore 64 machines that people of an earlier generation learned to program on.” Since the computer has become important for every member of the household, it may also discourage younger members from tinkering around and possibly putting such a critical tool out of commission for the family. But recently mobile phone and tablet processors have become less expensive while getting more powerful, clearing the path for the Raspberry Pi’s leap into the world of ultra-cheap-yet-serviceable computer boards. As the founder of Linux, Linus Torvalds, said in an interview with BBC News, Raspberry Pi makes it possible to “afford failure.” What Can You Do With It? One of the great things about the Raspberry Pi is that there’s no single way to use it. Whether you just want to watch videos and surf the web, or you want to hack, learn, and make with the board, the Raspberry Pi is a flexible platform for fun, utility, and experimentation. Here are just a few of the different ways you can use a Raspberry Pi: vii General purpose computing It’s important to remember that the Raspberry Pi is a computer and you can, in fact, use it as one. After you get it up and running in Chapter 1, you can choose to have it boot into a graphical desktop environment with a web browser, which is a lot of what we use computers for these days. Going beyond the web, you can install a wide variety of free software, such as the LibreOffice productivity suite for working with documents and spreadsheets when you don’t have an Internet connection. Learning to program Since the Raspberry Pi is meant as an educational tool to encourage kids to experiment with computers, it comes preloaded with interpreters and compilers for many different programming languages. For the beginner, there’s Scratch, a graphical programming language from MIT, which we cover in Chapter 5. If you’re eager to jump into writing code, the Python programming language is a great way to get started and we cover the basics of it in Chapter 3. And you’re not limited to only Scratch and Python. You can write programs for your Raspberry Pi in many different programming languages like C, Ruby, Java, and Perl. Project platform The Raspberry Pi differentiates itself from a regular computer not only in its price and size, but also because of its ability to integrate with electronics projects. Starting in Chapter 7, we’ll show you to how to use the Raspberry Pi to control LEDs and AC devices and you’ll learn how to read the state of buttons and switches. Raspberry Pi for Makers As makers, we have a lot of choices when it comes to platforms on which to build technology-based projects. Lately, microcontroller development boards like the Arduino have been a popular choice because they’ve become very easy to work with. But System on a Chip platforms like the Raspberry Pi are a lot different than traditional microcontrollers in many ways. In fact, the Raspberry Pi has more in common with your computer than it does with an Arduino. This is not to say that a Raspberry Pi is better than a traditional microcontroller; it’s just different. For instance, if you want to make a basic thermostat, you’re probably better off using an Arduino Uno or similar microcontroller for purposes of simplicity. But if you want to be able to remotely access the thermostat via the web to change its settings and download temperature log files, you should consider using the Raspberry Pi. Choosing between one or the other will depend on your project’s requirements and in fact, you don’t necessarily have to choose between the two. In Chapter 6, we’ll show you how to use the Raspberry Pi to program the Arduino and get them communicating with each other. viii Preface As you read this book, you’ll gain a better understanding of the strengths of the Raspberry Pi and how it can become another useful tool in the maker’s toolbox. But Wait… There’s More! There’s so much you can do with the Raspberry Pi, we couldn’t fit it all into one book. Here are a few other ways you can use it: Media center Since the Raspberry Pi has both HDMI and composite video outputs, it’s easy to connect to televisions. It also has enough processing power to play full screen video in high definition. To leverage these capabilities, contributors to the free and open source media player, XBMC, have ported their project to the Raspberry Pi. XBMC can play many different media formats and its interface is designed with large buttons and text so that it can be easily controlled from the couch. XBMC makes the Raspberry Pi a fully customizable home entertainment center component. “Bare metal” computer hacking Most people who write computer programs write code that runs within an operating system, such as Windows, Mac OS, or—in the case of Raspberry Pi—Linux. But what if you could write code that runs directly on the processor without the need for an operating system? You could even write your own operating system from scratch if you were so inclined. The University of Cambridge’s Computer Laboratory has published a free online course which walks you through the process of writing your own OS using assembly code. Linux and Raspberry Pi Your typical computer is running an operating system, such as Windows, OS X, or Linux. It’s what starts up when you turn your computer on and it provides your applications access to hardware functions of your computer. For instance, if you’re writing a application that accesses the Internet, you can use the operating system’s functions to do so. You don’t need to understand and write code for every single type of Ethernet or WiFi hardware out there. Like any other computer, the Raspberry Pi also uses an operating system and the “stock” OS is a flavor of Linux called Raspbian. Linux is a great match for Raspberry Pi because it’s free and open source. On one hand, it keeps the price of the platform low, and on the other, it makes it more hackable. And you’re not limited to just Raspbian, as there are many different flavors, or Preface ix distributions, of Linux that you can load onto the Raspberry Pi. There are even a few non-Linux OS options available out there. Throughout this book, we’ll be using the standard Raspbian distribution that’s available from Raspberry Pi’s download page. If you’re not familiar with Linux, don’t worry, Chapter 2 will equip you with the fundamentals you’ll need to know to get around. What Others Have Done With It When you have access to an exciting new technology, it can be tough deciding what to do with it. If you’re not sure, there’s no shortage of interesting and creative Raspberry Pi projects out there to get inspiration from. As editors for MAKE, we’ve seen a lot of fantastic uses of the Raspberry Pi come our way and we want to share some of our favorites. Arcade Game Coffee Table Instructables user grahamgelding uploaded a step-by-step tutorial on how to make a coffee table that doubles as a classic arcade game emulator using the Raspberry Pi. To get the games running on the Pi, he used MAME (Multiple Arcade Machine Emulator), a free, open source software project which lets you run classic arcade games on modern computers. Within the table itself, he mounted a 24-inch LCD screen connected to the Raspiberry Pi via HDMI, classic arcade buttons, and a joystick connected to the Pi’s GPIO pins to be used as inputs. RasPod Aneesh Dogra, a teenager in India, was one of the runners up in Raspberry Pi Foundation’s 2012 Summer Coding Contest. He created Raspod, a Raspberry Pi based web-controlled MP3 audio player. Built with Python and a web framework called Tornado, Raspod lets you remotely log into your Raspberry Pi to start and stop the music, change the volume, select songs, and make playlists. The music comes out of the Raspberry Pi’s audio jack, so you can use it with a pair of computer speakers or you can connect it to a stereo system to enjoy the tunes. Raspberry Pi Supercomputer Many supercomputers are made of clusters of standard computers linked together and computational jobs are divided up among all the different processors. A group of computational engineers at the University of Southampton in the United Kingdom linked up 64 Raspberry Pis to create an inexpensive supercomputer. While it’s nowhere near the computational power of the top performing supercomputers of today, it demonstrates the principles behind engineering such systems. Best of all, the rack system used to hold all these Raspberry Pis was built with Lego bricks by the team leader’s 6-year-old son. x Preface If you do something interesting with your Raspberry Pi, we’d love to hear about it. You can submit your projects to the MAKE editorial team through our contribute form on Conventions Used in This Book The following typographical conventions are used in this book: Italic Indicates new terms, URLs, email addresses, filenames, and file extensions. Constant width Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords. Constant width bold Shows commands or other text that should be typed literally by the user. Constant width italic Shows text that should be replaced with user-supplied values or by values determined by context. This icon signifies a tip, suggestion, or general note. This icon indicates a warning or caution. Using Code Examples This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission. Preface xi We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Getting Started With Raspberry Pi by Matt Richardson and Shawn Wallace (O’Reilly). Copyright 2013, 978-1-4493-4421-4.” If you feel your use of code examples falls outside fair use or the permission given here, feel free to contact us at [email protected] Safari® Books Online Safari Books Online is an on-demand digital library that lets you easily search over 7,500 technology and creative reference books and videos to find the answers you need quickly. With a subscription, you can read any page and watch any video from our library online. Read books on your cell phone and mobile devices. Access new titles before they are available for print, get exclusive access to manuscripts in development, and post feedback for the authors. Copy and paste code samples, organize your favorites, download chapters, bookmark key sections, create notes, print out pages, and benefit from tons of other timesaving features. O’Reilly Media has uploaded this book to the Safari Books Online service. To have full digital access to this book and others on similar topics from O’Reilly and other publishers, sign up for free at How to Contact Us Please address comments and questions concerning this book to the publisher: MAKE 1005 Gravenstein Highway North Sebastopol, CA 95472 800-998-9938 (in the United States or Canada) 707-829-0515 (international or local) 707-829-0104 (fax) MAKE unites, inspires, informs, and entertains a growing community of resourceful people who undertake amazing projects in their backyards, basements, and garages. MAKE celebrates your right to tweak, hack, and bend any technology to your will. The MAKE audience continues to be a growing culture and community that believes in bettering ourselves, our environment, our educational system—our entire world. This is much more than an audience, it’s a worldwide movement that Make is leading—we call it the Maker Movement. xii Preface

Getting Started With Raspberry Pi

An Introduction to the Fastest-Selling Computer in the World


Author: Shawn Wallace,Matt Richardson

Publisher: Maker Media, Inc.

ISBN: 1680452428

Category: Computers

Page: 206

View: 1183

The Raspberry Pi is a credit card-sized computer that plugs into your TV and a keyboard. It is a capable little computer which can be used in electronics projects, and for many of the things that your desktop PC does, like spreadsheets, word processing, browsing the internet, and playing games. It also plays high-definition video. This book takes you step-by-step through many fun and educational possibilities. Take advantage of several preloaded programming languages. Use the Raspberry Pi with Arduino. Create Internet-connected projects. Play with multimedia. With Raspberry Pi, you can do all of this and more.

Getting Started with Raspberry Pi


Author: Matt Richardson,Shawn Wallace

Publisher: "O'Reilly Media, Inc."

ISBN: 1449344240

Category: Computers

Page: 176

View: 9540

What can you do with the Raspberry Pi, a $35 computer the size of a credit card? All sorts of things! If you’re learning how to program, or looking to build new electronic projects, this hands-on guide will show you just how valuable this flexible little platform can be. This book takes you step-by-step through many fun and educational possibilities. Take advantage of several preloaded programming languages. Use the Raspberry Pi with Arduino. Create Internet-connected projects. Play with multimedia. With Raspberry Pi, you can do all of this and more. Get acquainted with hardware features on the Pi’s board Learn enough Linux to move around the operating system Pick up the basics of Python and Scratch—and start programming Draw graphics, play sounds, and handle mouse events with the Pygame framework Use the Pi’s input and output pins to do some hardware hacking Discover how Arduino and the Raspberry Pi complement each other Integrate USB webcams and other peripherals into your projects Create your own Pi-based web server with Python

Getting to Know the Raspberry Pi


Author: Nicki Peter Petrikowski

Publisher: The Rosen Publishing Group, Inc

ISBN: 1477777113

Category: Juvenile Nonfiction

Page: 64

View: 5943

A $35 minicomputer about the size of a credit card, the Raspberry Pi has taken the world of computing by storm. Originally intended for teaching programming in schools, the device's low price, small size, and low power consumption have given it wide appeal. This entertaining, informative title reveals the vision behind the Raspberry Pi and the history of its creation. It describes the computer's hardware and the options it offers in terms of operating systems, software, programming languages, and peripherals. Readers also get a look at the lively Raspberry Pi community of tinkerers and their creative projects making use of the minicomputer.