Page 1 of 2
Raspberry Pi has been a huge success and I'm not talking about something to eat. It's a small fully functioning computer that costs next to nothing. But why would you want one when you have PC, a tablet and a smart phone? In this first chapter of our new ebook we explore the Pi in the real world - not just tutorial examples but it doing real things.
Real Raspberry Pi
- Real Raspberry Pi - Why Pi?
- Getting Started And Custom NOOBS
- OS Images And Custom Images
This first chapter looks at what makes the Pi special and why it opens up different approaches to familiar, and sometimes not so familiar, problems.
Why the Pi changes things
The Raspberry Pi is a fairly unexceptional ARM-based, single-board computer. It isn't particularly powerful but it is amazingly cheap. It is so cheap this is almost disposable computing. OK, not quite as disposable as some things, but the very low cost of the computing power makes it possible to think of implementing your ideas in ways that until just recently would have seemed crazy. Even now when I think about some of the ways you can use the Pi I think that throwing so much technology at a problem that could be solved using, say, a transistor and a few chips or by adding another service to an existing server really is crazy. But then I sit down and do the math of the pros and cons of the approach and think that it would be me that was crazy to do the job any other way.
So the premise is that a $25 credit-card sized computer changes everything. Let's find out what we get for our $25 and how it stacks up against the alternatives.
Until the Pi came along I was addicted to the Arduino. Its another easy to use small cheap computer that can be used in everything from embedded control systems to distributed sensors. If you are an Arduino user then you will have an additional question in your mind concerning the Pi which is why use it in place of an Arduino or similar microcontroller?
If you aren't into microcontrollers there is still a lot of pure software applications that a Pi can be used for and the most important distinction between the Pi and a microcontroller is that the Pi is a complete general purpose computer.
In one cheap $25 package you get a Linux-based machine that is the equivalent in computing power of a desktop machine of a few years ago. You can use it for physical computing because it has digital I/O pins that can be used to control other hardware, but you can also use it as a desktop personal machine, a server and, perhaps more importantly, a dedicated device running in kiosk mode.
You need a small information display device? Hook a Pi up to a monitor and use it to flip though pages of live informational displays. A complete kiosk machine can be had for around $150 and this means you don't have to think hard about installing one. Who needs a digital photo frame, weather station, wall clock, etc, when a single Pi kiosk can do the lot.
The Pi is cheap enough that you can use one to do a single job when a more expensive machine might have to be multi-purpose. For example, if you need to monitor a number of different temperatures then you might in the past have hooked up a single machine to multiple temperature sensors and run cables to each measuring location. As a Pi costs just $25 or $30 with WiFi a better approach might be to use one Pi per location and gather the data at a central server - another Pi of course.
The low cost of the Pi changes the optimal architecture for many projects.
Comparative Pi Studies
At the moment the Pi comes in three configurations - the small even lower cost model A, the model B and the upgraded B+.
The Raspberry Pi is based on the Broadcom BCM2835 system on a chip but what really matters is that it is an ARM CPU together with a VideoCore IV GPU. The ARM processor is based on the version 6 ARM architecture and is no longer supported by many of the main stream Linux distributions - Ubuntu for example. It is roughly the power of a 300MHz Pentium II that you might have used in 1999 but with the GPU it is better than you might expect.
The situation with RAM is complicated because it has to be shared with the GPU. The model A has 256Mbytes and the model B/B+ has 512Mbytes. If you are used to a Gbyte using desktop machine you might be worried about the amount of memory available - don't be too worried as Linux and Linux application software generally isn't as memory hungry as Windows. In most cases memory isn't a big issue in using the Pi but this is as much to do with what tasks the Pi is used for as anything else.
Ok so what you have is a fairly capable Linux system but there are some things to keep in mind. The first is that the Pi doesn't have any disk drives and no disk interfaces. It does have an SD card interface (the B+ has a microSD interface) that can be used to supply file system storage of typically 8 to 32 Gbytes. Again this is more than enough but you cannot connect the latest Tbyte SATA drive and this makes some projects difficult if not impossible - forget for example a high speed NAS drive system based on a Pi.
The model A has just one standard interface a USB port. The Model B has a 100MHz network port and two USB ports and the newish Model B+ has a 100Mhz network port and four USB ports.
The model B allows you to connect a USB keyboard and mouse and the model B+ does the same but still has two ports left over. Both model Bs also connect to the network and autoconfigure as long as there is a DHCP server available. This makes working with the B a lot easier than the A. You can't even connect a keyboard and mouse to the model A unless you have a USB expansion hub to provide more ports or have a combined mouse/keyboard.
All models of the Pi connect to a TV or monitor via an HDMI connector which also carries audio. A separate audio and composite video signal is also available. Notice you can't use a Pi with an old VGA monitor unless you have a fairly expensive VGA to HDMI convertor and this generally isn't worth it.
Pi v Arduino
At this point you might be still asking the question of why would you use a Pi in place of an Arduino or any microcontroller?
At first sight the Pi really doesn't hack it as an embedded controller.
The reason is that it only has digital I/O. If you want to do analog I/O then the Arduino for example does it out of the box.
You can add analog ports to the Pi but you will have to buy an expansion board that more or less doubles the total cost.
However the Arduino isn't a complete computer system and it doesn't come with an network interface of any sort. You can add one but this also increases its cost.
So to summarise:
If you want to create anything that is network connected then the Pi is a good choice. Even if you want to use WiFi the Pi is easier and cheaper because you can simply add a USB WiFi adaptor.
There are now low cost microcontrollers that have WiFi as standard and for some applications these may be a better choice than the Pi - see Spark Core.
The rough idea is that if you need a network connected device then the Pi is a good choice. If you need a simple micro-controller without network connectivity or using say Zigbee connections then the Arduino is a good choice.
However if you need the device to act as a full computer i.e. as a standard server of some sort e.g. a web server, then the PI is overwhelmingly a better choice.
The Software Pi
One of the problems in selecting any hardware is that there is usually a complex world of software that is associated with it. If you are new to the device then just working out what might or might not be available can be a big task.
The first thing to say about the Pi is that runs Linux. There are a number of variations on the operating system you could use but the mainstream one is Raspian - which is derived from the well known Debian distro.
The simple answer is that Windows doesn't run on ARM machines with the memory the Pi has. Linux is a much more economical with hardware and can run, complete with graphical user interface in with the resources that the Pi offers.
Raspian is such a standard Debian distribution that it is difficult to remember sometimes that it is an ARM machine rather than the more familiar x86 architecture. In most cases it makes little difference that everything has to be recompiled to run on ARM.
If you are wondering if you can run Android, the answer is a qualified yes. There is work on a version of Android for the Pi but it isn't particularly usable and at the time of writing there isn't a working modern version of Android for the Pi. Even if there was it isn't a good choice for project development with the Pi. Linux has so many more packages just waiting to be put to work. The only attraction of Android on the Pi is being able to run off the shelf Android applications - something better done on a cheap tablet or phone.
What about Linux and the learning curve?
If you are new to Linux and have only used a OSX or Windows then you might be worried about how long it takes to get to grips with the OS. It is true that Linux does things differently. In many ways it is a less sophisticated operating system in the sense that it is closer to the metal than say Windows and it doesn't hide what goes on from the user. This is both good and bad.
Getting to grips with Linux basics is very easy. If you have used any GUI you will find the Pi's desktop GUI very familiar. If you have ever used any sort of command line you will also find the Linux command line easy.
You will find all of Linux easy - at first.
Where things tend to get a little more frustrating is as soon as you actually try to do something that isn't configured out to the box. Even something as simple as adding a WiFi adaptor can be very confusing with lots of different sets of instructions telling you to do slightly different things.
There is no real solution to this other than to be prepared to do lots of searches and don't assume that the first answer you encounter is the best way to do something. The Linux world is full of "Chinese whispers" of repeated advice. If at all possible return to the original documentation and this usually but not always means the "man" pages.
Once you start "getting into" Linux you will start to become enthusiastic. Once you find out how get over the initial irritations then you start to see how much you can get done with it. The advantages of open source are not just that you can get inside the software but that you are not hampered by licencing restrictions. If you want 20 different configured versions of Linux ready to boot the Pi - no problem but with Windows - big problem.
Looking beyond Linux the software that you are likely to find useful is Python for programming and a range of servers such as Apache and so on to help you set up infrastructure.