Raspberry Pi
A Quick-Start Guide
by Maik Schmidt
Version: P1.0 (August 8, 2012)
Copyright 2012 The Pragmatic Programmers, LLC. This book is licensed tothe individual who purchased it. We don't copy-protect itbecause that would limit your ability to use it for yourown purposes. Please don't break this trustyou can use this across all of your devices but please do not share this copywith other members of your team, with friends, or via file sharing services. Thanks.
Dave & Andy.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and The Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g device are trademarks of The Pragmatic Programmers, LLC.
Every precaution was taken in the preparation of this book. However, the publisher assumes no responsibility for errors or omissions, or for damages that may result from the use of information (including program listings) contained herein.
Our Pragmatic courses, workshops, and other products can help you and your team create better software and have more fun. For more information, as well as the latest Pragmatic titles, please visit us at http://pragprog.com.
Table of Contents
Copyright 2012, The Pragmatic Bookshelf.
Early Praise for Raspberry Pi
The Raspberry Pi is bringing back the golden days of experimenting with home computers and Maiks book is an ideal starting point. The included projects are perfect for Raspberry Pi users of any age or level of experience.
Tony Williamitis, Senior Embedded Systems Engineer |
Schmidt takes a quick dip into many of the things you can do with a Raspberry Pi straight out of the box. I found it very useful for understanding exactly what I can use my Pi for, and its given me some ideas for what I can do next!
Stephen Orr, Technical Enthusiast and Web Developer |
This is the owners manual all Raspberry Pi buyers should get before they start diving in. Its clear, comprehensive and succinct. I couldnt ask for more.
Thomas Lockney, Professional Geek |
DorkbotPDX |
A wonderfully clear, concise, and useful introduction to the Raspberry Pi.
Acknowledgments
Whenever I tell people that I am an author, they look at me dreamily for a few seconds. Obviously, many people think that writing is about sitting at an old wooden desk, staring outside the window on a stormy day, and enjoying a good glass of red wine. For me this has rarely been the case, but still most of the time I have a lot of fun while writing books.
I had a lot of fun writing this book, toomainly because of the invaluable support of my editor, Jacquelyn Carter. She cheered me up on countless occasions, and her thoughtful advice made most of my problems disappear immediately. Thank you very much, Jackie!
As always, the whole team at the Pragmatic Bookshelf has been tremendously helpful and agile. Without you, this book would have been impossible!
This book deals with electronics, and I have created all the circuit diagrams with Fritzing. It makes working with the Raspberry Pis GPIO pins a piece of cake, and it saved me countless hours of debugging low-level code.
Simon Quernhorst kindly gave me permission to use screenshots of his great game A-VCS-tec Challenge in this book.
I cannot thank my reviewers enough: Daniel Bachfeld, Gordon Haggart, Michael Hunter, Thomas Lockney, Angus Neil, Stephen Orr, Mike Riley, Sam Rose, Mike Williamitis, and Tony Williamitis. Your comments and suggestions made this book so much better.
Finally, I have to thank Tanja and Mika for being so patient and understanding. I am so glad I have you!
Footnotes
http://fritzing.org/ |
https://projects.drogon.net/raspberry-pi/wiringpi/ |
Copyright 2012, The Pragmatic Bookshelf.
Preface
Over the past decades computers have gotten cheaper and cheaper, so today you can find them not only beneath your desk but in nearly every consumer electronics device such as smartphones or DVD players. Still, computers arent so cheap that you spontaneously buy one when shopping for your groceries. Usually, you carefully plan your next PC, because you have to use it for a couple of years.
Computers like the Raspberry Pi will change the situation completely in the near future. The Raspberry Pi, or Pi for short, is a full-blown desktop PC that costs only $35. You can directly connect it to the Internet, and it is able to display high-definition videos. Also, it runs Linux, so you do not have to pay for an operating system. This makes the Pi probably the first throwaway computer in history.
Originally, the Raspberry Foundation built the Pi to teach children how to program, so it comes as no surprise that the Pi is an excellent device for exactly this purpose. On top of that, you can use the Pi for many other exciting things. For example, you can turn it into a multimedia center, use it as a cheap but powerful web server, or play some classic games.
The Pi is also a great machine for experimenting with electronics. In contrast to many popular microcontroller boards like the Arduino, the Pi runs a full-blown operating system, and you can choose from a wide range of programming languages to implement your projects.
With cheap and small devices like the Raspberry Pi, a new era of ubiquitous computing has begun, and you can be part of it. This book helps you get up to speed quickly.
Who Should Read This Book?
This book is for everyone who wants to get started with the Raspberry Pi. Even if you have some experience with other computers, youll quickly see that the Pi is different in many regards, and this book helps you avoid the most common pitfalls.
You can choose from a variety of operating systems for the Pi, but this books focus is on Debian Linux (Raspbian), because it is the most convenient choice for beginners. If youve never worked with Linux before, you should start with Appendix 1, . Even if youve worked with Linux before, you still might learn a few things, because running Linux on the Pi is different in some ways.
Of course, youll get the most out of this book if you have a Raspberry Pi and follow all the books examples closely.
Whats in This Book?
The Raspberry Pi does not come with a user guide, but in this book youll learn step-by-step how to get the most out of your mini-computer quickly. Youll learn not only how the Pis hardware works in principle but also how to run different operating systems and use the Pi for special purposes such as turning it into a multimedia center.
Heres a list of all the things youre going to learn:
The book starts with an introduction to the Raspberry Pis hardware. Youll learn what the Pis connectors are for and which additional hardware you need to start the Pi for the first time.
After youve connected all necessary devices to your Pi, you need an operating system. Although the Pi is a fairly young project, you can already choose from several, and youll learn what their pros and cons are.