Righty-o. Now that we have the basics of machining, moldmaking, and resin casting covered to a good extent, it's useful to discuss more practical designs and part geometries of interest to robotics and other mechanical work. But before we dive into the inner workings of custom-designed gears and drivetrains, it's important to take a brief detour, and go over some of the prefabricated components that may come handy in your projects. Without a good source for tiny screws, springs, dowel pins, or cheap electronic sensors, you simply won't be able to get far.
Rest assured, this chapter will merely scratch the surface of it all. If you are looking for inspiration, get "Machine Devices and Components Illustrated Sourcebook" by Parmley, or "Mechanisms and Mechanical Devices Sourcebook" by Sclater and Chironis; and if you need a primer on electronics, my concise guide to electronics for geeks may come handy, too.
Machine screws, also known as bolts, are one of the most important items to put on your shopping list: if you want to create durable, serviceable designs that can't be approximated with indiscriminate use of glue, suitable fasteners are simply a must. In tough plastics such as polyurethanes, the use of screws is particularly easy: simply machine a slightly undersized hole and drive the fastener into it, impressing its own thread onto the part. Much of the time, you don't need a nut!
If you want to shop for useful sizes and quantities of machine screws, skip your local hardware store. There are three particularly good online sources for miniature and subminiature fasteners in bulk: Micro Fasteners, Fast Metal Products, and Amazon Supply. Micro Fasteners is a good all-around source for low-cost screws in diameters over 1.5 mm or so; FMP offers decent pricing on fasteners smaller than that. Last but not least, Amazon Supply (formerly Small Parts) tends to be a tad more expensive - but Amazon Prime customers get free two-day shipping on every single nut and bolt, so especially for small orders, it's quite a good deal.
The exact selection of fasteners depends on the projects you intend to pursue, but I recommend starting with a good assortment of 0.8 mm, 1.5 mm, and 2 mm screws (000-120, 0-80, and 2-56 designations in ANSI UTS, respectively), 100 pieces each. You should grab the cheapest variety of steel or brass screws, aiming for lengths around 4, 6, 8, and 15 mm; drive type doesn't matter a lot - could be slotted, Phillips, or hex. Expect to pay around $2-$5 per 100 pieces for common diameters, and closer to $10-$15 for sizes under 1 mm. Getting some nuts and washers, especially for 2 mm screws, is not a bad plan - but as noted, you won't be routinely needing them.
You may also want to look into threaded rods, available from sources such as Amazon - the diameter around 2 mm probably being the most useful. Their more boring use is an extended-reach screw (with one nut at each end); a more interesting possibility is creating extremely compact and simple linear motion systems, like so:
Another possible arrangement is using a motor to directly rotate the shaft. In both cases, the transmission enjoys a very high ratio, because every turn of the motor moves the nut by a distance equal to the pitch of the shaft - often in the vicinity of 0.5 mm or so. The downside is poor efficiency - likely under 20% - due to significant friction under load.
Note: when it comes to online retailers, many hobbyists also love McMaster-Carr as a source for screws and other mechanical components. That said, they are almost always significantly more expensive than specialized distributors, and often more expensive than Amazon. I really want to shop with them, but it seldom makes any financial sense to do so. YMMV.
Traditional dowel pins are rather unassuming: they are just pieces of featureless, cylindrical steel, machined to tight tolerances. For their appearance, they find a truly surprising number of uses: as axles for spur gears and other rotating parts; as registration pins for molds and multi-part assemblies; as movement limiters and contact sensors; as serviceable torque couplers; and so on. You just need to have some - trust me on that.
Non-tapered, solid metal dowel pins are available from many sources, including Small Parts / Amazon Supply, and cost very little - usually in the vicinity of $4 to $8 per 100 pieces. I suggest stocking up on 2 mm diameter pins in several lengths ranging from 4 to 20 mm. For high-precision work, 1 and 1.5 mm diameters may come handy, too.
Dowel pins aside, it's also good to have some vanilla steel rods or tubes: they are very cheap (usually $1-$2 per meter), and can be cut to size with a hand saw to build anything from long-reaching axles (left) to fairly complex frames (right, also showing threaded rods used as linear motion systems):
Metal bars with rectangular, hexagonal, or L-, I-, or T-shaped cross-sections are particularly useful for torque transfer, because you can simply slide components onto them, and there is no risk of slippage under radial load; perfectly round profiles may require the application of glue or the use of a lock screw.
Similarly to dowel pins, springs have quite a few uses; many of them are obvious (wheel suspension and other pre-tensioned mechanisms, energy storage, etc), but some aren't. For example, springs are indispensable for transfering rotary motion at an angle - a process that otherwise requires complex bevel gears or universal joints.
Perhaps the most common sort is a compression spring: it has generous spacing between its coils, and is meant to contract under load. You can find them inside many types of pens, spray bottles, and so on. The other popular type is an extension spring: it is tightly wound, and offers little or no compressive action - but stretches very well.
It's difficult to recommend a particular selection of compression and extension springs up front, but it's definitely a good idea to have a robust variety always available in your workshop, simply to prototype stuff easily. Possibly the best and least expensive assortment I have seen so far is this set - 200 reasonably sized springs for less than $9; comparable kits are also available on Amazon. A great selection of individual springs with specific diameter, pitch, and length, can be also found on Amazon, usually in packs of 10.
Traditional springs aside, you should also grab some spring wire (also known as music wire). It comes handy for making contact sensors (especially whiskers!), for creating simple tensioners, and for designing other devices where you want to use a straight piece of elastic material to deflect effortlessly, and then spring back to its original shape. There are many low-cost assortments you can find on the Internet - and as usual, Amazon isn't bad.
There are many situations where it is desirable to constrain rotary movement to a particular axis of rotation, and support it so that the part doesn't wiggle back and forth, or snap under load. Sleeve bearings are the simplest solution: you can route the rotating part through a round, slightly oversized opening, and perhaps use a bit of grease to minimize friction.
Alas, this approach has its limits: if the part is rotating very quickly, or if it's subject to significant radial forces, sleeve bearings will result in significant power losses or excessive wear. In particular, sleeve bearings for propellers and wheels may have a very limited lifespan.
Because of this, you should get a decent assortment of ball bearings, and use them when appropriate. There are many sources of bearings on the Internet, but most of them tend to be pricey; VXB.com is a notable exception to this rule. They ship internationally and have an amazing selection of 10-, 20-, 30-, or even 100-packs at sensible prices - often hovering around $1 to $1.50 per piece. Some comparably good or even better deals can be found in the $0.99 discount bin or the 10-pack-section of Boca Bearings, too - although their "regular" prices are higher than VXB.
Some of my favorite bearing sizes (ID x OD x H) are: 3x6x2 mm (link, $1 a piece, only for miniature projects); 6x10x3 mm (link, $1.50); 8x12x3.5 mm (link, $1.50); and 8x16x5 mm (link, $1). For larger projects, 8x22x7 mm bearings are a bargain, too - trading for about 50 cents a piece or less (link).
If you don't have any specific designs in mind, but plan to work on small to medium-scale projects, grabbing a set of 6x10x3 mm or 8x12x3.5 mm bearings is not a waste of money.
The selection of motors at your disposal is definitely the single most important factor affecting the ability to bring your electromechanical designs to life. It's also something very easy to get wrong - or get right, but grossly overspend on.
It is probably safe to assume that you are interested primarily in small, low-voltage DC motors; if so, the choice is roughly as follows:
Vanilla brushed motors: the traditional variety, with rotating electromagnets and a mechanical commutator that powers them up in a particular sequence. The most important advantage of this class of motors is the broad availability of many different form factors, often at ridiculously low prices ($1-$2). That allows you to buy them by the dozen, and helps with rapid prototyping.
Unfortunately, these motors operate efficiently only at very high RPM, and deliver fairly low torque, requiring the use of external gearboxes in almost every application; such gearboxes aren't difficult to make, but they add some complexity. The motors are also electrically noisy, and their lifespan is limited by the wear of commutator brushes - an issue in continuous-duty applications.
Geared motors: these typically consist of a small brushed motor coupled to an integral gearbox that reduces output RPM, and brings the torque up to a more useful range. They usually operate with decent efficiency (85-95%) and offer transmission ratios of 20:1 to 400:1 or so.
The main trade-off is that many of the lower-cost plastic gear transmissions are flimsy and rather unwieldy, so in many applications, it may be more desirable to create them yourself; higher quality alternatives, and planetary gearboxes in particular, often fetch as much as $20-$150.
As a rule of thumb, it makes little or no sense to buy anything that looks like this; microminiature metal gears are a usually better investment, and if you look around, you may be able to find them under $8 a pop.
R/C servos: affordable motors in this category usually consist of a geared motor coupled to a gearbox, a potentiometer attached to the output shaft, and a small integrated circuit that uses this feedback loop to maintain a position requested by the external microcontroller. The huge advantage of servos is the ease of use: they eliminate the need for additional sensors, H-bridge drivers, and other widgets normally involved in the control of a regular motor.
Unfortunately, most of the low-cost servos are pretty bulky - a brick about 4-5 times the size of the actual motor within; most of them are also not capable of performing 360° turns, owing to the design of the internal potentiometer. On top of that, most of the plastic-geared servos are somewhat fragile - the sale of replacement gears is an industry of its own.
Vanilla brushless: brushless motors deal away with mechanical commutation, and instead, have a rotor with permanent magnets, surrounded by stationary electromagnets that are switched electronically in a specific sequence. They are more durable than their brushed counterparts, and because of improved heat dissipation, occupy a smaller, more lightweight envelope.
The key challenge with brushless motors is that they require precise external control to operate with good efficiency, often incorporating current sensors or Hall effect detectors; this adds cost and complexity. The other issue is that almost all the commonly available brushless motors are designed for high-current, high-performance applications, such as model aircraft - and with their extreme speeds and power demands, they are not particularly well-tailored for projects with more modest needs.
Stepper motors: steppers are similar to brushless motors, but use a different rotor design with multiple densely packed poles; this makes the motor turn only by a small, precisely defined degree every time one of the coils is switched (7.5° or 15° is common in small motors; 1.8° in larger ones). There is no position sensing; their high-resistance coils are designed to let them hold a particular position without overheating, but limit their ability to operate at high speeds (their efficiency drops rapidly past perhaps 300 RPM or so).
The primary advantage of stepper motors is their high precision, ease of operation, and competent performance at relatively low speeds, suitable for directly operating many types of mechanical assemblies. Their disadvantage is that they are essentially a constant-current device, sinking the same amount of power when freewheeling and under load.
Exotic actuators: somewhat disappointingly, there aren't that many alternatives to plain old motors. Linear actuators are interesting, but typically prohibitively expensive ($100 and more). Solenoids, often used in door locks, are pretty cheap, but usually of limited utility. Lastly, "muscle wire", a material that contracts slightly (5% or so) when heated up by the flow of electric current, may sound cool - but because of the small displacement and fragility, it's more of a novelty than a practical tool.
As you can see, there is no perfect solution. I personally prefer sticking to vanilla brushed motors and creating my own gearboxes, but if your patience can wear thin, servos or geared motors may be a better choice. For any of these motors, you should definitely look at the following characteristics when shopping around:
Maximum rated voltage: every motor is designed for a particular maximum voltage, past which it may overheat or blow up in some other fashion. You can operate any motor at as little as 20% of its rated voltage - but in such a case, you will be hauling around a lot of dead weight in the form of windings, magnets, and so on, that are grossly oversized and serve no useful purpose.
In general, motors rated for somewhere between 3 and 9V are probably of most use in small- to medium-size projects, owing to the availability of affordable batteries and power-switching transistors compatible with these voltages. Going beyond 12V can be expensive, and is best avoided unless you are building something big.
No-load RPM and stall torque: these two parameters describe the behavior of the motor at two extremes: its speed when freewheeling with no load, and the turning force needed to effectively stop the motor in its tracks. In both of these cases, the motor is not doing any useful work, and its efficiency is zero. In between, the dependency between RPM and torque is roughly linear: with a load equal to 80% of the stall torque, the RPM will hover around 20%.
This dependency may suggest that instead of using complex gears, it may be possible to simply operate the motor with a carefully tuned load of 95%, thus reducing its speed down to 5%. Unfortunately, this is usually a bad idea. In essence, every motor has a specific efficiency curve - and for low-power DC motors, it typically looks like this: the device is most efficient when the load is around 20%, and the performance drops off somewhat linearly past this point, eventually reaching 0% at stall. Therefore, in any application where power consumption and heat dissipation are of concern, it's good to operate the motor at somewhere between 5% and 50% of its maximum load most of the time; outside that range, you're just heating the air.
To understand what you will be getting out of a specific motor, and to compare different products, it is often useful to compute their normalized torque: the torque they will be able to deliver when paired with a gearbox that brings their speed to a particular value (say, 100 RPM). Assuming that you are aiming for a load of 50%, and that the gearbox has an efficiency of 85%, the formula will be:
normalized_torque = (stall_torque * 50%) * (idle_RPM * 50%) / 100 * 85% = stall_torque * idle_RPM / 470
Stall current: this parameter should help you size the power supply and all the associated driver circuits. When multiplied by the supply voltage and compared to normalized torque, it may be helpful for comparing the efficiency of various motors, too.
Dimensions: all things being equal, the smaller the better - but form factors matter, too. Long but slim motors are preferable for wheeled robots, as they result in optimum ground clearance when placed inline with or near the axle; while pancake-shaped motors with a large diameter but short length are much better when you need to cram them inside an articulated joint in a legged robot without anything sticking out.
Possibly the best source to find a great assortment of low-cost brushed motors (both vanilla and geared) is Kysan Electronics; they have a $100 minimum on all online orders, but seem to be willing to make exceptions if necessary. Good deals can be also sometimes found at various surplus outlets, including All Electronics, Electronic Goldmine, Surplus Shed, BG Micro, or HSC Supply - but their inventory can change rapidly, so your mileage may vary. Last but not least, for servos and brushless motors, Hobby King is hard to beat - they ship from Hong Kong, but do so promptly and cheaply; on orders under $200 or so, you are unlikely to run into import duties.
Whatever you do, I'd recommend avoiding robotics-oriented sources such as Solarbotics, Robotics Connection, Pololu, Acroname, and many more. They are good people, but they usually sell exactly the same low-cost motors, and simply charge you more for the privilege of shopping with them. Case in point: this motor costs $23 when bought from Robot Marketplace, or $16 when you go to Solarbotics - but Kysan Electronics carries it for $8 a piece... or just $3 on orders over 1,000 (which is probably the price that the first two shops have paid).
In any case, it makes sense to find 2-4 models that are best suited for your needs, and then buy 10-20 pieces of each; having a steady supply of well-performing motors beats having one or two of every mediocre product available on the market. My personal recommendations are:
Mabuchi FF-N20PN ("8117" or "8721") ($1.00): one of the tiniest motors I found that can still pack a punch (pager motors are smaller, but offer negligible torque). Diameter of 10 / 12 mm, length of 15 mm. When operated at 3V, it idles around 13,000 RPM, and delivers about 15 g*cm of stall torque - drawing 1.3A at that point. Great for miniature projects.
Mabuchi RF-356CA-10250 ($2.20): a reasonably powerful pancake-shaped motor for all-around use. Diameter of 24 mm, 8 mm long. About 11,000 RPM, 40 g*cm, 600 mA at stall when running at 6V. RF-300FA-12350 is a cheaper alternative, but it's 4 mm longer and has a lower speed.
Mabuchi FF-130SH-14230-6V ($1.90): an elongated all-purpose motor that delivers 13,000 RPM when idling, and stalls around 115 g*cm, drawing 1.3A, when operated at 10V. Diameter of 15.5 / 20.5 mm, length of 25 mm. A comparable but slightly larger 12V alternative is Canon EN22.
Spur geared motors:
Sanyo 12GN-0348-NA3S and 12GN-0348-NA4S ($7.50): two cheap, robust, extremely small metal gear motors delivering about 2,200 g*cm (NA3S) and 3,500 g*cm (NA4S) of stall torque, and idling around 100 and 70 RPM, respectively. Both run at 6V. Their tiny dimensions make it worthwhile: they measure just 12 x 10 x 25 mm.
Symbol Technologies 21-02485 ($1.00): about 20 mm wide and 12 mm thick; a 5-wire hybrid that is best operated in bipolar mode (where the polarity of the windings needs to be reversed, necessitating the use of H-bridge drivers), and runs fine at 9V. 15° per step, 100 mA per coil, around 40 g*cm of torque. Unfortunately, appears to be out of stock right now.
Epson STP35NI48SV50 ($3.00): a larger stepper motor, 35 mm wide and 12 mm thick. Unipolar operation (can be controlled with a couple of transistors), 7.5° per step, 12V, 250 mA per coil, around 220 g*cm of torque.
Mini Man 4.3 ($3.50): a really cheap, miniature 6V servo of acceptable quality, delivering around 500 g*cm of stall torque. Its speed is about 10 RPM with no load.
Hextronik HXT900 ($2.65): more powerful, slightly larger servo - 1,600 g*cm at stall, 40 RPM under no load, runs off of 6V. Very popular with hobbyists.
Hextronik HXT5010 ($4.50): a larger, ball bearing servo capable of delivering about 6,500 g*cm at stall. It's slow - 8 RPM with no load at 6V. Reportedly can be modified to rotate 360°.
If you need inspiration, here's a video of Mabuchi FF-N20PN powering a miniature planetary gearbox:
Sensors are essential in almost any electromechanical design, helping interact with the outside world, and providing internal feedback about the state of mechanical assemblies. This section covers some of the most useful, low-cost choices to consider in your work:
Tactile switches: simple, small, cheap, and very versatile. When placed behind an elastic bumper, they can work as a wall sensor for wheeled robots; in conjunction with rubberized foot or a floating axle, they can sense contact of the robot body with the ground; and when used as a movement limiter, they are useful for detecting the "home" position of many assemblies.
A wide selection of microswitches in all shapes and sizes is available from Mouser and from other major electronics outlets. Pricing starts at $0.10 or so a piece when bought in reasonable quantities; be sure to look at dimensions, trigger force, and button travel. In most cases, it makes sense to stock up on the smallest, low-profile non-SMD switches you can find - for example, Mountain Switch 101-TS4311T1601-EV ($0.20). Larger ones - such as ALPS SKHCBFA010 ($0.30) - may be useful when a greater pressure-sensitive area is desired.
Photointerruptors: extremely useful for non-contact position sensing when you don't want to obstruct the motion of a component. They work by shining an IR LED on the element, and then measuring the reflected or transmitted light with a phototransistor. My favorite is a tiny, wide-slot Toshiba TLP841 ($0.40); for reflective applications, Optek OPB609AX ($0.55) may come handy, too.
Mechanical rotary encoders: these can be used to measure the angular position of an assembly. They use mechanical coupling, and therefore add some friction - but often offer a convenient alternative to optical sensing. Linear sensors, such as ALPS RDC803001A ($1.50), leverage a heavy-duty rotary potentiometer with several taps; pulsed devices, such as Mountain Switch 101-5433-EV ($0.55), simply alternate between closed and open circuit at predefined angles, commonly producing 12 or 24 pulses per turn. Only linear sensors will provide the absolute position, but they cost more, and require an A/D converter to interpret the data.
Magnetic field sensors: solid-state Hall effect sensors such as Honeywell S41 ($0.50) can work very much like a photointerruptor, but will sense the position of a tiny permanent magnet embedded in the rotating element; their primary benefit is much lower power consumption, and the fact that they can "see" through opaque materials, enclosures, and so forth.
Distance sensors: these can be positioned either in a fixed location on the robot body, or rotated to sweep the environment in a manner similar to a radar - creating a 2D image that is a lot more more useful than the data that can be acquired with a digital camera, especially if you don't have too much computing power to spare. The two most common rangefinding options are infrared and ultrasound. Infrared sensors are cheaper, but have a limited sensing range, and may be considerably less effective in very bright light (e.g., outdoors); Sharp GP2Y0A02YK is probably the most interesting option here, selling for under $15. For ultrasound, you must be prepared to pay a bit more; for example, MaxBotix LV MaxSonar EZ2 fetches around $25.
Digital compasses: these may be useful in robots that need to maintain precise registration with the environment over extended periods of time. You can choose from specialized solid-state Hall effect sensor ICs, such as Honeywell HMC1051; and regular Hall effect sensors that monitor the position of a traditional compass needle (an example of that is Dinsmore 1490 or 1655). Expect to pay $10 to $40.
Other fancy sensors: some designs - especially flying robots - may benefit from accelerometers, such as MMA8453QT ($1.40); flex sensors; heat sensors; inclinometers; tilt switches; microphones; digital cameras; or GPS units. That said, these are usually selected for a specific application, and there is no need to keep a continuous stock.
If you have a favorite brand of microcontrollers, there is probably no need to revisit this topic; but if you are looking for advice, it's pretty hard to go wrong with AVR chips such as ATmega1284P ($8). This particular 8-bit MCU, for example, operates at speeds up to 20 MHz (internal oscillator is provided), has 128 kB of Flash memory for program storage, 16 kB of data memory (SRAM), and 4 kB of non-volatile EEPROM. It's essentially a complete computer-on-chip, complete with 32 bidirectional I/O lines, 8-channel 10-bit ADC, hardware PWM channels - all that supporting a wide range of supply voltages, from 1.8 to 5.5 V; there are precious few external components required to operate it in most real-world applications. ATmega chips have a mature GCC-based toolchain with tons of useful libraries, a nice emulator, and a pretty good IDE - and unless you are doing complex image processing or working on something else data-intensive, they will serve you well. (In more demanding tasks, you may need to spend quite a bit more on 32-bit ARM or AT32 chips.)
For ATmega, the only other gadget you need is a simple USB ISP dongle (e.g., AVRISP mkII), costing somewhere between $15 and $30 - and even that can be avoided if you opt for a chip with a built-in USB controller.
Note: some people love AVR-based development platforms such as Arduino or Teensy. I am personally wary of these boards, because I find them to offer very few real benefits over the AVR chip itself; you are essentially charged a 1000% markup in exchange for someone soldering the chip to a PCB, and then adding several components that are completely unnecessary in many uses, but make it look sophisticated (e.g., voltage regulators, external crystals).
Especially when developing more complex software, you may find it useful to add a way for the MCU to communicate essential information in an easily readable way. Tethering it to a computer is one option, but you may also consider getting an LCD module based on a well-known HD44780 chip; for example, NHD-0216K1Z-NSB-FBW-L ($11) is a very user-friendly device with ample display space. It can be controlled with as few as 6 data lines, and is pretty trivial to interface with - its dedicated controller maintains its own display memory, and even stores editable font data and track of the cursor for you, so you just have to send ASCII data to the appropriate port.
In addition to the MCU itself, you should also have a good assortment of standard "glue" chips that are useful for example in multiplexing and demultiplexing applications, and will allow you to extend the I/O capabilities of your chip almost arbitrarily. Probably the best IC family to stick to is 74HC - they are widely available and fairly cheap ($0.10 - $0.35 per chip), and offer respectable speeds and good load driving capabilities. You may want to grab basic logic gates (74HC00, 02, 04, 08, 32, 86 - NAND, NOR, NOT, AND, OR, and XOR respectively); line drivers (74HC240, 241, or 244); multiplexers, demultiplexers (74HC164, 165); line selectors (74HC137, 42, 151); and flip-flops / latches (74HC175, 75, 259). Some projects may also have uses for counters, timers (e.g., 7555), external oscillators, assorted op-amps, etc.
About the only thing you can't do with all these parts is driving any power-hungry loads, such as motors: the tiny transistors inside most MCUs and 7400 series chips can output at best around 20-40 mA per line - enough for a LED or two, but not much more. It is possible to use discrete power MOSFETs (e.g., BUK7510) to control high-current devices, but doing so is not always space- and cost-efficient - so you may want to look into IC-based motor drivers. FAN8082 is probably the cheapest ($0.40) full H bridge (i.e., bidirectional) driver capable of delivering up to 1.5A at 18V to brushed motors and bipolar steppers; it even comes with rudimentary speed control. The disadvantages of this chip are its reltively high voltage drop (almost 2V), and the fact that it doesn't support "freewheeling" (high impedance) mode. Somewhat more expensive TA7291P ($0.90, 2A peak at 20V) supports all four output states: forward, reverse, brake, and freewheel; TLE52052 chip ($3.50, 6A peak at 40V) can drive even larger motors with ease. Several dozen similar products exist - shop around, and grab at least around 10 pieces or so.
For driving unipolar steppers, solenoids, and other power equipment where you don't need to change polarity, you can also save some money by going with simpler devices: ULN2003 ($0.30) can drive up to 6 devices at 500 mA and 50V (or one device at 3A); while ULN2065 ($2) has four outputs capable of delivering 1.5A at 35V, adding up to 6A total.
About the last major set of electronic components that you need to think about are the power sources you will be using in your work. To make the right call, you need to consider several factors:
Nominal voltage: in most cases, you should use a power source that provides perhaps 10-15% more than the voltage required by the most power-hungry components of your design - and that's usually the motors. In general, somewhere between 3.5 and 11 V is ideal.
Capacity: try to estimate the power needs of your circuit, and aim for something that would give you a sensible run time on a single charge. For example, if you are expecting to sink 100 mA on average, you will get up to 8 hours out of any 800 mAh cell.
Peak current / ESR: make sure that the cell can accommodate the expected peak current draw of your device, with a generous safety margin. This matters: for example, a typical 9V battery will typically source no more than 1A - and once you exceed that, the voltage will drop dramatically.
Weight and dimensions: there are substantial differences in power density between various cell types, so pay close attention to these characteristics, especially if you are trying to build something lightweight.
Today, the best all-around option for robotics are rechargeable lithium-polymer cells, simply because of an excellent balance between capacity, weight, and cost. My favorite source is Hobby King. They have good products, and although they are in Hong Kong, they ship cheaply, quickly, and with no hassle whatsoever. If you browse their site, you can find a 7.4V 5 Ah cell, weighing around 300 g, for about $25; a smaller 1.6 Ah cell fetches $10 and tips the scales at 90 gram; while a tiny 800 mAh one weighs barely 50 g and costs $5.
Of course, nothing comes free: lithium batteries have two drawbacks that you should know about. First of all, if they are charged improperly or badly damaged, they can overheat and catch fire - so you need to store and handle them with some care. The other issue is that they shouldn't be discharged past a certain minimum voltage to avoid altering their chemistry; using a voltage cut-off IC, such as MAX8211 or MAX8212, is a very good idea.
Of course, there are many alternatives to Li-poly; a typical AA battery is nothing to sneeze at, and delivers up to 3 Ah, with peak current as high as 10A; your usual 9V battery is closer to 500 mAh and can't source more than 1A. If weight is not an issue, you can also go with lead-acid batteries, of course: they are cheap, but weight a ton ($20 will get you 15 Ah at 6V, but be prepared to haul around 2 kg). Ultracapacitors are also of some interest in recent years - but right now, they tend to be fairly expensive, especially if you are interested in supply voltages over 2.5V or so. Last but not least, solar cells deserve a honorable mention - although similarly to ultracapacitors, they are not that practical in everyday uses. Because of their lamentable power capabilities in function of their size, they are useful mostly as a way to conveniently recharge a chemical battery or a capacitor, and not as a continuous primary supply.
Oh, one more thing: for prototyping, I recommend grabbing an adjustable benchtop power supply, such as Mastech GPS-3030D ($90); convenience of being able to quickly adjust voltage aside, their huge benefit is that you can limit the current to a safe value, so that an accidental short-circuit will not destroy everything in its path. The same can't be said about most batteries.
Tip: the reason why you should match the supply voltage with the most power-hungry components in your circuit is that high-current DC voltage adjustments can be pretty tricky. It's easy to lower the voltage supplied to a low-current device, such as a microcontroller or a couple of LEDs: just grab a linear regulator such as LM317T ($0.25) or L7805 ($0.50) and be done with it. For efficient regulation of higher currents, or for stepping the voltage up, you generally need switched regulators, however.
Such regulators are fairly complicated to build on your own, and get expensive if you want a plug-and-play solution. For example, ICL7660 - a chip that can handle up to 20 mA - goes for $2; Murata OKR-T3-W12-C - a hybrid device that can deliver up to 3A - retails for $7; and a 6A variant of the same Murata product will fetch $14.
Well, it goes without saying that you will also need an assortment of generic electronic components to get anywhere: make sure that you have a bunch of resistors and capacitors, a handful of PCB mount potentiometers, some medium-power MOSFET transistors (n- and p-channel), a good selection of terminal blocks and ribbon connectors, a solderless breadboard or two for prototyping, perforated boards in various sizes, and so on. In fact, if you need any help with selecting the right components and using them in a circuit, check out my short primer on electronics in your spare time.
What else? If you want to make your own PCBs for finished projects, you can of course print and etch them - although keep in mind that it's also quick and easy - and often more precise - to machine them on your CNC mill: you can simply selectively remove copper plating from a blank board with a cutter - and drill mounting holes at the same time.
And of course, don't forget about installing a conveniently located and obvious self-destruct switch!
Click to proceed to chapter 6...