Chapter 2
In This Chapter
Setting up a project-building workspace
Choosing the right tools for the job
Selecting your accessories
Using breadboards and soldering
Finding out about Raspberry Pi LEGO projects
The first thing you need to do to get started with Raspberry Pi projects is to get your workspace ready. You need a dedicated work area and the right tools so that you can build the projects quickly and easily. In this chapter, we explain how to create a good workspace with the right set of tools for the projects in this book.
The project chapters assume that you have the basic workspace and tools ready to go. After you dive into a project, it can be a drag to interrupt your work to get some basic tool that you’ve overlooked. But if you have most (or all) of the basics of your workspace covered, you won’t have to stop what you’re doing to go get a hand tool or run to the hardware store.
You can start working on Raspberry Pi projects almost anywhere, but it’s best to have a dedicated spot in which to build them. Completing the projects will take some time, so you want to choose a place where you can work comfortably and see what you’re doing. Generally, setting up and taking down unfinished projects is a hassle — it takes more time and can introduce errors if your connections come loose. You can avoid this problem by setting aside a dedicated workspace.
You need a dedicated area where you can build and test your projects — especially the advanced ones in this book, which can take a few hours or more. You have to connect all the components together, provide power, keep the cables and connection wires organized, and do some light fabrication. So, find a spot in your house, apartment, shed, garage, studio, or wherever, where you and your work will be undisturbed and where you can make a bit of a mess. The workspace in Figure 2-1 has all these things covered.
The environment needs to be comfortable to work in for a long stretch. If it’s too cold or too hot, too noisy, or filled with distractions, it’ll take you longer to complete the work. Make yourself a sort of hideaway where you can stay focused.
Your Raspberry Pi is a fine computer in its own right, but an extra computer is sometimes useful during the project-building process, so it’s good to have room for a desktop or laptop computer on the workbench. Plus, you’ll want to be able to hunt for references online, look up datasheets, and post questions to forums, so a reliable Internet connection is vital.
A few of the projects in this book deal with low-voltage electronics. Safety is always a factor when working with electrical circuits. None of these projects works with wall power, but you should always treat electronic projects as if they could have potentially dangerous voltages. If children may roam around your work area, take special precautions to keep them away. Little kids love pulling on cords and cables and could easily drag everything off your desk with one quick tug. A hot soldering iron left unattended could cause severe burns, besides being a fire hazard.
It’s probably best to keep food and drink separate from your workbench. Empty pizza boxes or soda cans may hide critical parts, and you can waste time hunting for things. Accidentally spilled drinks don’t do good things for live circuits.
You need some basic tools to build several of the projects in this book. The tools basically fall into two categories: electronics tools and physical building and fabrication tools. You can get most or all of these components from electronics retailers such as Radio Shack (in the United States) or Maplin (in the UK). Specialty electronics suppliers on the Internet also stock them and are often cheaper, so hunt around at places like Farnell (www.farnell.com
), Newark (www.newark.com
), Rapid Electronics (www.rapidonline.com
), and RS (www.rs-components.com
). Sometimes you can find good deals on Amazon (www.amazon.com
) and eBay (www.ebay.com
), too.
Here are the basic electronics tools you’ll want on your shopping list:
A multimeter is an essential tool for testing, measuring, and diagnosing problems in electronic circuits. You use a multimeter to measure several basic attributes of your circuit, including:
With a multimeter, you can also measure the voltage provided by batteries and power supplies, and the characteristics of discrete electronic components, such as resistors, capacitors, diodes, and transistors.
Many of the projects in this book can be built without soldering anything at all, but you’ll need to do a little bit of soldering for some of the projects, so it’s good to have a soldering iron on hand.
Soldering involves melting solder (a metal alloy that melts at about 700°F) and allowing it to cool, creating a strong, conductive joint. You can solder wires to each other and join wires to components. You can bond wires to circuit prototyping boards such as perfboards and stripboards. Soldering secures components in place, while creating a good electrical connection for a more permanent, longer-lasting project. You can also simply solder certain components (like switches and displays) to wires that lead to your breadboard. That way, you can mount them in a project box. On some projects, you may want to move buttons or switches from the breadboard to the project enclosure, which means you’ll need to solder extension wires on them.
Your soldering iron provides the heat for creating a soldered joint. Many people have the impression that you melt solder onto the parts that you want to connect, but this is actually backward. When soldering, you use a soldering iron to heat up both the solder and the components that are being joined together. When the components are hot enough, the solder will flow onto them, at which point, you remove the tip of the soldering iron and, thus, the heat supply. The solder cools rapidly and, if done correctly, forms a reliable bond.
Figure 2-3 shows a basic array of soldering tools. The key soldering tools you need at your workbench are as follows:
Solder: A metal alloy you use to create soldered joints. There are both leaded and lead-free varieties. Some purists prefer leaded 60/40 solder (60 percent tin, 40 percent lead), but lead is toxic, so unless you have a particular need for it, we recommend you opt for the lead-free variety, with a rosin core. The rosin core melts and helps to clean the surfaces you’re joining. Solder comes in a variety of diameters measured in standard wire gauge (SWG). For most electronics soldering needs, 18 SWG or 20 SWG diameter is ideal. You can use 22 SWG for detailed work.
Somewhat counterintuitively, as the wire gauge number goes higher, the diameter of the wire gets smaller.
Extra soldering tips: Tips do the main work of the iron, directing the heat in the right place. Tips come in a variety of shapes and sizes. For most electronics work, you’ll need a cone-shaped tip rather than a chisel tip. Because they come into contact with molten metal and impurities, tips can degrade over time, so it’s a good idea to get spares.
Different manufacturers have different tip-mounting systems, so buy a couple extra tips when you buy your iron to avoid having to hunt for the right product later.
You also need some basic tools for light fabrication. Not all these tools are essential, but often the one tool you don’t have is the one you need so you may want to stock up. Figure 2-4 shows some of the essential tools. We’ve listed these roughly in order of importance, from most to least:
When you’ve assembled all the tools and set up your workspace, you’ll probably be eager to dive right in! But before you do, take a few minutes to read the information in this section so you don’t hurt yourself or those around you.
To quickly and easily connect your project circuits, start out by using a breadboard. All the projects involving electronic circuits in this book can be built on a breadboard. After testing on a breadboard, you can either put your Raspberry Pi and your breadboard inside an enclosure or build your circuit permanently on a stripboard or perfboard, which requires a bit of soldering.
A breadboard is a small block of plastic with lots of rows of holes into which you can insert jumper wires and electronic components. Underneath the holes are tiny metal strips forming springs, which grasp wires and the legs of components that are inserted into the holes. Because the springs are metal, if you connect wires or components to the same springs, they’re electrically connected together.
In the main work area on the breadboard, the holes are typically organized into rows of five and grouped into two columns. There is usually a trough between the two columns of holes, which allows you to insert an integrated circuit (IC) into the breadboard so that each of its legs is served by four adjacent holes.
Many breadboards have columns of holes running the full length of either side of the board. These holes aren’t electrically connected to the main work area, and they’re often labeled + (positive) and – (negative or “ground”) and may be color coded. You use these as “rails” for power and ground. You’ll often want to connect components to power or ground, so you usually need lots of connections to them.
Breadboards come in various sizes, from small (with 400 contact points) to large (with 830 points or more). You’ll want to have at least a small one on hand for testing. If you run out of room, you can connect two breadboards using the notches and fingers on the sides of the boards. But be warned: There’s no standard for these, so they usually need to be from the same manufacturer in order for you to connect them.
Stripboards and perfboards are similar to breadboards — they have lots of holes to connect things together — but they’re designed for permanent connections that are soldered in place. Stripboards are coated with adhesive strips of conductive copper that run underneath the holes. Electronic components are soldered to the strips of copper, providing an electrical connection and a strong physical bond. Perfboards have metallic pads that surround each individual hole, into which you can solder parts and which you can solder together to create electrical circuits.
Stripboards and perfboards come in a huge range of shapes and sizes (see Figure 2-5), so if and when you’re ready to go for a more permanent solution, shop around for the size and type you need.
A number of manufacturers offer a printed circuit board that has a prototyping area for soldering electrical components, plus a multi-pin jack that you connect to the GPIO socket on your Raspberry Pi. This makes it easy to build circuits and experiment. Our favorite is the Humble Pi prototyping board, available from Ciseco (http://shop.ciseco.co.uk
). If you’re outside the UK, you should be able to find it from other online retailers, like Amazon (www.amazon.com
).
This board stacks right on top of your Raspberry Pi to make a little sandwich, as shown in Figure 2-6. It comes in a kit form and is easy to put together. You simply solder the GPIO socket to the board. If you aren’t confident with your soldering skills, this is a good kit to practice with, because it’s difficult to damage it by making soldering mistakes.
Many of the projects in this book are built on a breadboard because it’s a fast and easy way to get going. If you want to protect the project, you can transfer it to a dedicated enclosure.
Potential project housings are everywhere, and almost anything that can be used as a small box will do. Electronics suppliers usually stock a range of generic enclosures, in both metal and plastic. When selecting one of these, make sure that you have the correct tools to fabricate your housing. If you’re going to mount switches, buttons, or a display on the project box, you’ll need to be able to cut through the material cleanly. It’s really difficult to drill a hole into thick materials and metals without the right saws, drills, and bits, so make sure to select a housing that you can work with.
Another source of project enclosures is one of the new and popular laser cutting or 3D printing services, such as Pololu Robotics & Electronics (www.pololu.com
), Ponoko (www.ponoko.com
), and Thingiverse (www.thingiverse.com
). You send off your design to them, and they’ll ship you your finished custom laser-cut design. Many of these companies also have templates you can download for boxes and enclosures.
When you’re first trying your hand at soldering, it’s a good idea to practice on some throwaway stuff that you won’t mind messing up. It takes a while to get the hang of soldering — how long it takes to heat up the solder, how to flow it onto components, and how to make a good solder joint. You can use a piece of stripboard to do a few test connections, without worrying about damaging things on your project.
When soldering, follow these basic steps:
After a moment, press the end of the unwound bit of solder against the surfaces that you want to join.
This should be right near where the tip of the iron is heating up the components. The solder should begin to melt and coat the components.
Examine the joint.
The joint should be shiny. On a stripboard or perfboard, the joint should form a volcano shape around the wire that you’re soldering and should be mechanically secure. It shouldn’t wiggle around if you press against it.
Figure 2-7 shows an example of soldering components to a perfboard. When you’re soldering, you apply the iron to the components and then flow the solder into the heated area. You need to ensure that the components are hot enough for the solder to adhere to them. You don’t heat the solder and drip it onto the parts. The solder will liquefy around the components and coat them. When they’re coated, remove the solder and the iron, and allow the parts to cool. The result should be a strong connection that you can’t pull apart.
Chapters 13 through 15 use the LEGO MINDSTORMS system. LEGO has been a popular toy for decades. Since the 1980s, it has produced a series of products that can interface with a computer and be programmatically controlled. Recently, the company has produced products geared toward robotics experimentation called MINDSTORMS. You can connect your Raspberry Pi to this latest range of products. We use the MINDSTORMS system to quickly and easily build complex projects. The modular building system makes the physical work of rigging up a robot or computer-controlled object very easy.
The core of the MINDSTORMS system is the MINDSTORMS Intelligent Brick, which contains the processor and memory required to do programmatic control. You send programs to the Intelligent Brick, which can then execute complex instructions, such as reading data from sensors or controlling motor drive systems. The brick has several ports for input and output, along with a display that you can program, as well as a number of buttons that can be used for input that you can read with your Raspberry Pi.
Several kinds of MINDSTORMS systems have been developed over the years, and the latest version is the MINDSTORMS EV3. If you plan on trying out some of the LEGO projects, you’ll need to get the most recent version. You can buy the LEGO MINDSTORMS EV3 kit, which contains both the control brick and a bunch of extras to build several projects. This kit is pretty expensive (around $350), so if you want to save a little, you can just buy the control brick, which is about half the cost of the full kit. You can sometimes find the brick for sale on eBay at a lower price.
In Chapter 13, we provide more information on the EV3 system and using it with your Raspberry Pi.
3.129.210.17