Raspberry Pi User Guide. Eben Upton. Читать онлайн. Newlib. NEWLIB.NET

Автор: Eben Upton
Издательство: John Wiley & Sons Limited
Серия:
Жанр произведения: Зарубежная образовательная литература
Год издания: 0
isbn: 9781119264378
Скачать книгу
at once – we’d envisaged making them in batches of 2,000 every couple of weeks, which, with this level of interest, was going to take so long that the thing would be obsolete before we managed to fulfil all the orders. Clearly, manufacturing and distribution were something we were going to have to give up on and hand over to somebody else who already had the infrastructure and capital to do that, so we got in touch with element14 and RS Components, both UK microelectronics suppliers with worldwide businesses, and contracted with them to do the actual manufacture and distribution side of things worldwide so we could concentrate on development and the Raspberry Pi Foundation’s charitable goals.

      Demand on the first day was still so large that RS and element14’s websites both crashed for most of the day – at one point in the day, element14 were getting seven orders a second, and for a couple of hours on February 29, Google showed more searches were made worldwide for “Raspberry Pi” than were made for “Lady Gaga”. We made and sold more than a million Raspberry Pis in the first year of business, making Raspberry Pi the fastest-growing computer company in the world, ever. Things aren’t slowing down: we make more than 300,000 Pis every month and have sold more than ten million in a little over four, with no hint of a slowdown. If we’d stuck with our original plans, we’d have made 100 or so of these devices for University open days, and that would have been it.

      NOTE

      The first production Pis were made in Chinese factories, but in 2012 we managed to repatriate all of the production to the UK. Your Raspberry Pi is now made in South Wales, in an area of the country with a proud manufacturing heritage, but few remaining factories. Amazingly, it costs us less to manufacture in Wales as it did in China, and we’re able to do that manufacture without a language or cultural barrier, and with the ability to jump in the car and be on the factory floor in a few hours if necessary.

      There is nothing that affects the blood pressure quite like accidentally ending up running a large computer company!

      So What Can You Do with the Raspberry Pi?

      This book explores a number of things you can do with your Raspberry Pi, from controlling hardware with Python, to using it as a media centre, setting up camera projects, or building games in Scratch. The beauty of the Raspberry Pi is that it’s just a very tiny general-purpose computer (which may be a little slower than you’re used to for some desktop applications, but much better at some other stuff than a regular PC), so you can do anything you could do on a regular computer with it. In addition, the Raspberry Pi has powerful multimedia and 3D graphics capabilities, so it has the potential to be used as a games platform, and we very much hope to see more people starting to write games for it.

      We think physical computing – building systems using sensors, motors, lights, and microcontrollers – is something that gets overlooked in favour of pure software projects in a lot of instances, and it’s a shame, because physical computing is massive fun. To the extent that there was any children’s computing movement when we began this project, it was a physical computing movement. The LOGO turtles that represented physical computing when we were kids are now fighting robots, quadcopters, or parent-sensing bedroom doors, and we love it. However, the lack of General Purpose Input/Output (GPIO) on home PCs is a real handicap for many people getting started with robotics projects. The Raspberry Pi exposes GPIO so you can get to work straight away.

      I keep being surprised by ideas the community comes up with which wouldn’t have crossed my mind in a thousand years: the Australian school meteor-tracking project; the Boreatton Scouts in the UK and their robot, which is controlled via an electroencephalography headset (the world’s first robot controlled by Scouting brain waves); the family who are building a robot vacuum cleaner; Manuel, the talking Christmas moose. And I’m a real space cadet, so reading about the people sending Raspberry Pis into near-earth orbit on rockets and balloons gives me goosebumps.

      In the first edition of this book, I said that success for us would be another 1,000 people every year taking up Computer Science at the university level in the UK. That would not only be beneficial for the country, the software and hardware industries, and the economy; but it would be even more beneficial for every one of those 1,000 people, who, I hope, discover that there’s a whole world of possibilities and a great deal of fun to be had out there. In the second edition and third editions, I was a little more ambitious, saying that we’d like to see that replicated throughout the developed world. As Raspberry Pi has grown, however, I’ve become even more ambitious: I want every child, everywhere, to have access to an open, programmable, general-purpose computer, and to have the opportunity to learn to program in the same way that I did on my BBC Microcomputer back in the 1980s. It’s a lofty goal, but we’ve already seen Raspberry Pi labs spring up in the most unlikely places, like a village lab in a part of Cameroon with no electricity network where the Pis run off solar power, generators, and batteries, or a school high in the mountains in Bhutan.

      Building a robot when you’re a kid can take you to places you never imagined – I know because it happened to me!

– Eben Upton

      Part I

      The Board

      Chapter 1

      Meet the Raspberry Pi

      YOUR RASPBERRY PI board is a miniature marvel, packing considerable computing power into a footprint no larger than a credit card. It’s capable of some amazing feats, but you need to know a few things before you plunge head first into the bramble patch.

      TIP

      If you’re eager to get started, skip to the next chapter to find out how to connect your Raspberry Pi to a display, keyboard, and mouse; install an operating system; and jump straight into using the Pi.

      A Trip Around the Board

Since its launch as a mere two models, the Raspberry Pi family has expanded considerably. The current range consists of five mainstream models: the Raspberry Pi Model A+, Raspberry Pi Model B+, Raspberry Pi 2, Raspberry Pi 3 (see Figure 1-1), and Raspberry Pi Zero. Aside from the Zero, which is a cut-down model designed specifically for the lowest-possible cost and minimum board footprint, all models share a roughly similar design differing only in features such as the number of USB ports, presence or absence of network ports, and the power of their processor. The range also has a sixth, less-common, member: the Raspberry Pi Compute Module; designed for industrial use in customised carrier boards, the Compute Module runs the same software as its mainstream stable mates, but is otherwise beyond the scope of this book.

      If you are the owner of an original-model Raspberry Pi, either the Model B or cut-down Model A, congratulations: you have a collector's item on your hands. The majority of the material in this book is entirely applicable to your boards, though there are some differences, including an inability to use add-ons adhering to the Hardware Attached on Top (HAT) standard, as described in Chapter 16, “Add-On Hardware”. If you find yourself needing features missing from your early board, consider retiring it and picking up a Model A+, Model B+, or faster Raspberry Pi 2 or 3; if you're on a budget, look at the cheaper Raspberry Pi Zero.

       FIGURE 1-1: The Raspberry Pi 3

      In the rough centre of all Raspberry Pi boards is a square semiconductor, more commonly known as an integrated circuit or chip. This is the system-on-chip (SoC) module, which provides the Pi with its general-purpose processing, graphics rendering, and input/output capabilities. Depending on the model, this may be the original Broadcom BCM2835, the faster quad-core BCM2836, or the more powerful still 64-bit BCM2837. In the case of the Model A+, B+, and Zero, stacked on top of that chip is another semiconductor which provides the Pi with memory for temporary storage of data while it's running programs; on the Raspberry Pi 2 and 3, this chip is instead located on the underside of the board. This type of memory is known as random access memory (RAM), because the computer can read from or write to any part of the memory at any time. RAM is volatile,