By Dick Maybach, Member, Brookdale Computer Users’ Group, NJ
November 2013 issue, BUG Bytes
n2nd (@) att.net
Personal computers are vital appliances for most of us. We use them to balance our checkbooks, calculate our taxes, communicate with friends and family, store our memories, and keep us informed. This is much different than when they were first introduced, when we felt free to perform experiments using them that today are unthinkable because of the risk of losing valuable data. As a result, we have the ironic situation that as our PCs become more and more complex, we know less and less about them. A solution is to acquire a smaller and simpler computer just to play with. Ideally, it won’t take up much space on our crowded computer desk and will be cheap to replace if something goes horribly (or wonderfully, if you’re adventuresome) wrong.
There are dozens of these tiny computers, but here I’ll talk about just two, the Arduino and the Raspberry Pi. Both are supported by active on-line communities, both are described in several books, both are open source, which means you are free to make any changes you like to their software, and both are cheap – less than $50. (Although you will probably pay more for a complete starter or experimenter’s kit.) Both were developed by educators, the Arduino in Italy and the Raspberry Pi in the UK, for the purpose of helping people learn about computers and computing. However, the two are quite different. The Arduino is really a controller, about as smart are your washing machine, and its inputs and outputs are Voltages on its pins. It runs only one program at a time, and once started, runs it forever. As you use an Arduino, you’ll be learning programming and electronics. The Raspberry Pi is a real computer that runs Linux and comes with a full complement of PC software, including a Web browser. Its inputs and outputs are a keyboard, mouse, graphical display, and Ethernet and USB ports. As you use the Raspberry Pi, you’ll learn programming, networking, and operating system operation and configuration.
The Arduino (http://www.arduino.cc/), like the Raspberry Pi, is about the size of a credit card. In the photo below, the Arduino is the blue card in the foreground. Normally, it’s programmed and powered through the USB connector at the rear of the left edge. Once, a program has been loaded, it can be powered via the black connector at the front of the left edge (for example by a 9-volt battery). This unit illustrated is mated to a solder less breadboard, on which you can build circuits just by pushing component leads into its holes. Jumpers connect the breadboard with the Arduino’s input/output pins along its front and rear edges. The Arduino is almost always used as a circuit element, and many experimenter’s kits are available to get you started. These usually include an Arduino, a breadboard, and a collection of jumpers and electronic parts, e.g., LEDs, switches, motors, and sensors. Make an Internet search, and you will certainly find many interesting products and projects. My favorite vendor is Adafruit, but it has many fine competitors.
Getting started with the Arduino is quite easy. Go to their home page, http://www.arduino.cc/, and download the Integrated Development Environment (IDE), which is available for Linux, Mac OS X, and Windows. (Linux users can also find it in their repositories.) Connect an Arduino board to a USB port and start the IDE. As you may be able to tell from the screenshot, the Arduino uses a variant of the C programming language. The example here is the program blink, which just cycles an LED on and off. This is the equivalent of the classic “Hello World” program that is almost every C programmer’s first effort.
The Arduino’s capabilities are quite modest – typically the processor runs at 16 MHz, has about 20 I/O pins (some analog, some digital), and is equipped with 32 kbytes of EEPROM (for programs) and 2 kbytes of RAM (for data). Normally, you would use the Arduino just to control the hardware and send any data it collects to a PC for analysis. To make this easier, consider using the Processing language on your computer, available at http://processing.org/. It’s very close to what the Arduino uses and has an almost identical IDE.
You should be able to get started using only information available from the Internet, but if you prefer a book, look at Getting Started with Arduino by Massimo Banzi. Many others are available, some for the beginner and others describing advanced projects.
While the Arduino is a simple controller, the Raspberry Pi, http://www.raspberrypi.org/, is a real computer that uses the Linux operating system. The kit I purchased (from Adafruit) included a clear plastic case and a solder less breadboard, but many projects won’t need the latter. The Pi has two USB ports (silver connectors on the center right), an Ethernet port (silver connector on the front right), a HDMI port for the display (silver connector on the center front), a power connector (micro USB connector on the front left), a SD connector for storage (a SD card protrudes from the case on the left), a collection of ports (connected to the breadboard by a black ribbon cable at the left rear), an analog video port (yellow connector at the rear), and a stereo audio jack (blue connector at the rear).
The Raspberry Pi is more powerful than the Arduino, with a 700-MHz ARM CPU and 512 Mbytes of RAM. (These specs are for the model B. The model A is much less capable and costs only a few Dollars less.) The processor is not Intel compatible; however, its overall performance is similar to a 300MHz Pentium 2, but with much better graphics. Clearly, it isn’t an acceptable replacement for any modern home computer. However, it does act like a (slow) PC, as you can see from the screen-shot below, which shows the desktop with windows open for the Internet browser and file manager.
Getting a Raspberry Pi running is more involved than with the Arduino. Although it’s powered through a USB port, PC USB ports can’t supply enough current; you will need either a cell phone recharger or a powered USB hub. Be careful of cell phone rechargers though; many cheap units can’t supply the current they claim. The safe approach is to purchase one from the vendor from whom you buy your Pi. You will need a USB keyboard and mouse; if you don’t have an extra set, they are quite cheap. Hopefully, you have a HDMI display, either for your PC or a flat-screen TV; if not, you could try an old analog TV set, but its resolution will be poor. Finally, connect any USB peripherals through a powered hub, rather than ask the Pi to power them. I bought a no-name 10-port hub that had good user reports on Amazon, and it can also power the Pi. Finally, unlike the Arduino, which comes with its control software installed, you must supply the SD card for the Raspberry Pi and install Linux and its applications on it. This requires a SD card burner, and unfortunately many on the market aren’t up to the job. Again, purchasing one from your Pi supplier is the safe approach.
As with the Arduino, you can probably get started with the Pi using only what you learn on the Internet, but there are also numerous books. The project has published Raspberry Pi User Guide by Eben Upton. There are numerous others, as well as magazine and Internet articles. I’ve seen descriptions of a media center, an Internet radio, a time-lapse camera control, a network file server, a firewall, and a wireless access point. (Many of these don’t require a keyboard, mouse, or display once they are running, so you could disconnect these for use elsewhere once the project is on line.) You could even connect an Arduino to a Raspberry to obtain a portable sophisticated hardware control and data processing system.
Both these devices are ideal for experimenting. No matter how badly you screw up the software, you can just download a new program to your Arduino or reburn the SD card on your Raspberry Pi. Even if you manage to fry the electronics, you can replace either card for less than $50. Both are wonderful platforms for introducing electronics and computers to young people. There are many Arduino projects that can be completed in less than an hour, including building the circuit and writing the program. The Raspberry Pi software includes Scratch, a programming language for children that builds animated graphics with sound, and Python, a more sophisticated language for older kids and adults.