Mes Top 5 Ouvrages
Termes les plus recherchés
tia TECHNOLOGY IN ACTION™
STEP-BY-STEP INSTRUCTIONS FOR
BOTH BASIC AND ADVANCED ROBOTS
— DISCOVER HOW TO MAKE YOUR
— LEARN HOW TO WORK WITH DIFFERENT
TYPES OF SENSORS, MOTORS, AND
— BUILD, TEST, AND SHOW OFF YOUR
Josh Adams, and Harald Molle
For your convenience Apress has placed some of the front
matter material after the index. Please use the Bookmarks
and Contents at a Glance links to access them.
Contents at a Glance
■ About the Authors.xix
■ About the Technical Reviewers.xxi
■ Introduction. xxiv
Chapter 1: Introducing Oracle APEX.1
Chapter 1: The Basics.1
Chapter 2: Arduino for Robotics.51
Chapter 3: Let’s Get Moving.83
Chapter 4: Linus the Line-Bot.119
Chapter 5: Wally the Wall-Bot.169
Chapter 6: Making PCBs. 203
Chapter 7: The Bug-Bot.257
Chapter 8: Explorer-Bot. 295
Chapter 9: RoboBoat. 331
Chapter 10: Lawn-Bot 400. 403
Chapter 11 ■ The Seg^Bot ■■■■■■■■■■■■■■■■■■*■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■*■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■453
Chapter 12: The Battle-Bot.513
Chapter 13: Alternate Control.563
This book was written for anyone interested in learning more about the Arduino and robotics in general.
Though some projects are geared toward college students and adults, several early chapters cover
robotics projects suitable for middle-school to high-school students. I will not, however, place an age
restriction on the material in this book, since I have seen some absolutely awesome projects created by
makers both young and old.
Ultimately, you will need to be able to use some basic power tools, hand tools, a voltage meter, and
soldering iron. Do not worry if you are not yet experienced in these areas, as your first experience will get
you well on your way (you have to start somewhere)! Just like riding a bike, you will get better at it the
more you do it.
If you are an experienced robot builder, you will likely be able to improve upon some of my
methods. If, however, you are a beginner, you might end up with a few extra holes drilled in the wrong
spot, a wheel that is not mounted perfectly straight, or a downright ugly robot. Do not worry about trying
to complete every step perfectly the first time; do your best the first time around and then go back and
improve upon it later. It is better to have an imperfect robot that you can work on than no robot at all
because you were too afraid to try!
In conclusion, this book is intended to provide fun projects for those interested in the Arduino. If
you are working on one of these projects and you aren’t having fun, you’re doing it wrong. If you get
stuck on a project, please ask for help—nobody wants you to be frustrated, but learning something new
can sometimes make you want to drive your head through a wall...don’t do that. Just keep with it, and
you will eventually figure out your problem. I have created a Google web site to host the files for each
project and provide a place to ask questions and get help:
If you would like to try some other Arduino projects, dealing with various types of sensors, LEDs,
home automation, and various other projects, you might consider the following Arduino books from
Practical Arduino by Jonathan Oxer and Hugh Blemings (2009)
Beginning Arduino by Michael McRoberts (2010)
The Arduino microcontroller (Figure 1 -1) is like a little command center that is awaiting your orders.
With a few lines of code, you can make your Arduino turn a light on or off, read a sensor value and
display it on your computer screen, or even use it to build a homemade circuit to repair a broken kitchen
appliance. Because of the versatility of the Arduino and the massive support available from the online
community of Arduino users, it has attracted a new breed of electronics hobbyists who have never
before touched a microcontroller, let alone programmed one.
* AMAI nf*
Figure 1-1. An Arduino Duemilanove microcontroller
The basic idea of the Arduino is to create an atmosphere where anyone who is interested can
participate and contribute with little upfront cost. A basic Arduino board can be found online for around
$20, and all of the software needed to program the Arduino is open-source (free to use and modify). You
need only a computer and a standard USB cable. In addition to being inexpensive, the creators of
CHAPTER 1 THE BASICS
Arduino came up with an easy-to-learn programming language (derived from C++) that incorporates
various complex programming functions into simple commands that are much easier for a beginner to
This book integrates some basic robot-building techniques with the simplicity of the Arduino to
create hots that you can modify and improve with a clear understanding of your work. This book is not
intended to simply “show” you how to build a hot, but rather to educate the beginning robot builder and
hopefully inspire creativity so that you can design, build, and modify your own robots.
One unavoidable obstacle that most people encounter when building a robot is cost. Obviously we
can spend thousands of dollars adding top-of-the-line parts and expensive commercial products, but
most hobby builders have neither the time nor the money to build such a robot. With that in mind, this
book takes every opportunity to show you how to build a part from scratch—or as inexpensively as
possible to get the job done. If any of these methods seem too involved, do not worry because there are
substitute parts listed for you to purchase.
Please understand that each project in this book requires multiple tries before working—some of
them even take weeks of “debugging.” I can tell you from experience that when you are persistent, you
will eventually solve your problem—and this will make the experience that much more rewarding.
Figuring out why a robot is not working often requires a lot of troubleshooting. Troubleshooting requires
understanding each step in the process from start to finish, and inspecting each step for errors. The
more you tinker with something, the better you will understand it.
Lastly, do not be discouraged if some of the information in this book appears to be over your head.
We try to assume that you are new to robotics and programming, and we focus on providing a practical
working knowledge of the parts and code used in each project, rather than loading you down with
electronics theory and complicated instructions. It is best to take a positive “I can do it” attitude before
you start—this will be your greatest tool.
To better understand what is happening inside an Arduino, we should first discuss electricity and
other basics in general (i.e., electronics and circuits). Although levels found in your Arduino (+5 DCV) are
relatively harmless, if you don’t know how electricity works you won’t know at what point it becomes
dangerous. As it turns out, the projects covered in this book do not use electrical levels high enough to
conduct through your body, but electricity should still be handled with caution.
Electricity is nothing more than harnessed heat. This heat can be used to do a variety of different things
like lighting up a lightbulb, spinning a motor, or simply heating a room. If electricity can transfer
through an object easily, it is called a “conductor” (like copper wire). Every conductor has an internal
resistance to the electricity that keeps it from transferring 100% of the power. Even a copper wire has
some resistance that slows the flow of electricity, thereby generating heat. Conductors also have a
maximum amount of power that they can transfer before “overheating” (if the conductor is a copper
wire, that means melting). With regard to electricity, total power can also be referred to as total heat.
This is why you might see a lightbulb or microwave that has its heat rating in watts. A watt is not only a
measurement of heat, but of electrical power.
Some electrical devices (like the Arduino) consume little electricity therefore producing little heat,
so no attention is given to heat dissipation. Other devices are made specifically to transfer large amounts
of electricity (like a motor-controller) and must use metal heat-sinks or fans to aid in removing heat from
the device. In either case, it is helpful to be able to determine the amount of heat that an electrical device
produces so we know how to properly handle it.
CHAPTER 1 THE BASICS
Electricity is not usually seen (except maybe in a lightning storm), so it is difficult to understand what is
happening inside of a wire when you turn on a lamp or kitchen appliance. For ease of illustration,
consider an electrical system to be a tank of water with an outlet pipe at the bottom (see Figure 1-2).
Lower water level =
Lower water level =
lower water pressure
lower water pressure
Less water pressure =
Less water pressure = ,
less water coming out
less water coming out
L ^ ^ J
level = higher
^ ^ ^ J
More water pressure = S'
more water coming out
level = higher
More water pressure = S'
more water coming out
Figure 1 -2. An analogous electrical system
The four images illustrate how resistance and pressure affect the water output from the tank. A
higher resistance yields less water output, whereas a higher pressure yields more water output. You can
also see that as the resistance is lowered, much more water is allowed to exit the tank, even with a lower
The more water that is in the tank, the faster (higher pressure) it pushes the water through the outlet
pipe. If there were no outlet pipe, the tank of water would simply be a reservoir. The fact that there is an
outlet pipe at the bottom of the tank enables water to exit, but only at a rate determined by the size of the
pipe. The size of the outlet pipe determines the resistance to the water leaving the tank—so increasing or
decreasing the size of the outlet pipe inversely increases or decreases the resistance to the water leaving
the tank (i.e., smaller pipe = more resistance = less water exiting the tank).
Both the level (or pressure) of the water and the resistance (or size of the outlet pipe) can be
measured, and using these measurements, you can calculate the amount of water exiting the tank at a
given point in time. The difference in the water analogy and electricity flow is that the electricity must
complete its path back to the source before it can be used.
CHAPTER 1 THE BASICS
Notice that a higher water pressure yields a higher water output (keeping resistance the same). The same
is true with the electrical equivalent of pressure, called “voltage” (V), which represents the potential
energy that can be found in an electrical system. A higher system voltage has more energy to drive the
components in the system. The amount of “resistance" (R) found in a system impedes (slow) the flow of
electricity, just as the resistance caused by the outlet pipe slows the flow of water from the tank. This
means that as the resistance increases, the voltage (pressure) must also increase to maintain the same
amount of output power. The amount of electrical charge (in coulombs) that is passed through an
electrical system each second is called the “amperage” (I) or “current,” and can be calculated using the
voltage, resistance, and Ohm’s law. A “watt” (P) is a measure of electrical power that is calculated by
multiplying the voltage times the amperage. In this chapter, we further discuss voltage, resistance, and
amperage. First, let’s look at the relationship among them, Ohm’s law.
According to Wikipedia ( Source: http://en.wikipedia.org/wiki/Ohm' s_law), Ohm’s law states that
the current through a conductor between two points is direcdy proportional to the potential difference
or voltage across the two points, and inversely proportional to the resistance between them.
There is a simple relationship among voltage, resistance, and amperage (current) that can be
calculated mathematically. Given any two of the variables and Ohm’s law, you can calculate the third. A
watt is a measure of electrical power—it is related to Ohm’s law because it can also be calculated using
the same variables. See the formulas in Figure 1-3 where V = voltage, R = resistance, I = amperage, and
P = watts.
Note The pie chart in Figure 3-1 is used courtesy of www.electronics-tutorials.ws. If you are interested in
learning more about electronics, you should definitely visit this website —it has some helpful illustrations and
The different views of Ohm’s law include the following:
V = I * R
I = V / R
R = V /1
Use the following formulas to calculate total power:
P = V*I
P = I 2 * R
There are several other terms that you might come across when working on an electrical system; we
discuss a few here. As you might know, an electrical system usually has a "power” wire and a “common”
wire to complete the circuit. Depending on what you are reading, these two sides can be called different
things. To help avoid the confusion that I experienced when I was learning, Table 1-1 provides a quick
comparison of the various names for the positive and negative ends of an electrical system.
Table 1 -1. Common Names That Refer to the Positive and Negative Ends of an Electrical System
Electrical Current Flow
We discussed Ohm’s law and the common measurements that are used to describe the various
properties of electrical current flow. Table 1-2 provides a list of standard electrical units and their
symbols. These are used in every subsequent chapter of this book, so it is a good idea to get familiar with
Table 1 -2. Common Electrical Measurement Terms with Their Symbols
I or A
R or O
CHAPTER 1 THE BASICS
Power (electrical heat)
P or W
Let’s now talk more about the different parts of an electrical system.
The starting point of the electricity in a system is called the “source” and usually refers to the positive
battery lead or power supply. The electricity flows from the source, through the system, and to the sink,
which is usually the negative battery terminal or ground wire (GND). For electricity to flow, the circuit
must be “closed,” which means that the electrical current can get back to its starting point.
The term “ground” comes from the practice of connecting the return path of an AC circuit, directly
into the ground outside using a copper rod. You might notice that most electrical meters also have a
ground rod nearby that is clamped to a wire leading into the fuse-box. This ground wire gives the
returning electrical current a path to exit the system. Even though the DC equivalent of GND is the
negative battery terminal, we still call it GND.
Note the actual electron-flow of electrical current travels from negative to positive, but unless you are a
physicist, that is not relevant here. For learning purposes, we assume the conventional electron-flow theory, which
suggests that electrical current flows from Positive (+) —-> Negative (-) in a system.
An electrical system is called a “circuit,” and can be simple like a string of Christmas lights plugged
into a power outlet or very intricate like the motherboard in your PC. Now consider that in a circuit, the
electricity flows only if something is there to complete the circuit, called a “load” (see Figure 1-6). In
general, the load in a circuit is the device you intend to provide with electricity. This can be a lightbulb,
electric motor, heater coil, loud speaker, computer CPU, or any other device that the circuit is intended
There are three general types of circuits: open-circuit, closed-circuit, and short-circuit. Basically, an
open-circuit is one that is turned off, a closed-circuit is one that is turned on, and a short-circuit is one
that needs repair (unless you used a fuse). This is because a short-circuit implies that the electricity has
found a path that bypasses the load and connects the positive battery terminal to the negative battery
terminal. This is always bad and usually results in sparks and a cloud of smoke, with the occasional loud
In Figure 1-4, the lightbulb is the load in this circuit and the switch on the left determines whether
the circuit is open or closed. The image on the left shows an open-circuit with no electricity flowing
through the load, whereas the image on the right shows a closed-circuit supplying power to the load.
Sink (-) Source (+)
Figure 1-4. Open- and closed-circuits
Without a way to measure electrical signals, we would be flying blind—luckily, there is a device called a
“multi-meter” that is inexpensive and can easily measure voltage, resistance, and small levels of current.
There are different types of multi-meters that have varying features, but all we need is a basic meter that
can measure voltage levels up to about 50DCV.
A typical multi-meter can measure the voltage level of a signal and the resistance of a component or
load. Because you can calculate the amperage given the voltage and resistance, this is really all you need
to do basic circuit testing. Although the full-featured digital multi-meter in Figure 1-5 (left) is priced
around $50, you can usually find a simple analog multi-meter (right) that measures both voltage and
resistance for under $10. Both meters will do basic testing and although the digital meter is nicer, I
actually like to keep a cheap analog meter around to measure resistance, because you can see the
intensity of the signal by how fast the needle moves to its value.
CHAPTER 1 THE BASICS
Figure 1-5. The Extech MN16a digital multi-meter (left) measures AC and DC voltages, resistance,
continuity, diode test, capacitance, frequency, temperature, and up to 10 amps of current. An inexpensive
analog multi-meter purchased at my local hardware store (right) measures DC and AC voltages, resistance
(lk ohm), and up to 150mA (0.15A) of current. Either work to diagnose anArduino and most other
circuits—but you definitely need one.
The standard multi-meter has two insulated test-probes that plug into its base, and are used to
contact the electrical device being tested. If you test the voltage of a circuit or battery, you should place
the red probe (connected to the multi-meter “V, Li, A” port) on the positive battery supply, and the black
probe (connected to the multi-meter “COM" port) on the negative battery supply or GND.
Voltage is measured as either Alternating Current (AC), which is the type found in your home electrical
outlets, or Direct Current (DC), which is found in batteries. Your multi-meter needs to be set accordingly
to read the correct voltage type. Some multi-meters also have a range that you need to set before testing
a voltage. The analog multi-meter in Figure 1-5 (right) is set to 10DCV, effectively setting the needle
range from 0-10VDC.
Trying to read a voltage that is much higher than the selected range can result in a blown fuse, so
you should always use a voltage range that is higher than the voltage you test. If you are unsure what
voltage level you are testing, select the highest range setting (300VDC on this multi-meter) to get a better
idea. The digital multi-meter in Figure 1-7 (left) has DC and AC voltage settings, but the range is
automatically detected and the exact voltage number appears on the screen—just be sure not to exceed
the maximum voltage ratings stated in the multi-meter owner’s manual.
The voltage level of an electrical signal also determines whether or not it is capable of using your
body as a conductor. The exact voltage level that passes through the human body is probably different
depending on the size of the person (moisture levels, thickness of skin, etc.), but I can verify that
accidentally touching a 120v AC wall outlet (phase wire) while standing on the ground produces quite a
muscle convulsion, even if wearing rubber-soled shoes.
CHAPTER 1 THE BASICS
Caution Voltage levels above 40v can be harmful to humans or pets. Always remember to disconnect the power
source when working on your circuits and use insulated tools (with rubber grips) to test circuits. You don’t want to
end up in a hospital bed!
Most multi-meters have a feature to measure small amounts of amperage (250mA or less) of either AC or
DC. The digital multi-meter in Figure 1-5 (left) can measure up to 10 amps of current for a few seconds at
a time whereas the less featured meter can measure up to 150mA of current only. To measure large
amounts of current (over 10A), you either need a current-sensor, ammeter, or voltage clamp, depending
on the application.
This unit of measure depends on the operating voltage and resistance of the circuit. As the operating
voltage decreases (batteries discharge) or the resistance fluctuates, the amperage draw also changes. On
a large robot that is constantly moving, the amperage draw changes every time the robot drives over a
rock or up a slight incline. This is because DC motors consume more amperage when presented with
more resistance. An LED flashlight on the other hand, consumes a steady amount of current (about 20-
100mA per LED) until the batteries run dead.
You might have noticed that batteries are rated in Amp/Hours (AH) to reflect the amount of
electrical current they can supply and for how long. This loosely means that a battery rated for 6v and
12AH can supply a 6v lamp with 1 ampere of current for 12 hours or the same 6v lamp with 12 amperes
for 1 hour. You might also notice that smaller batteries (like the common AA) are rated in
milliamp/hours (mAH). Thus a 2200mAH battery has a rating equal to 2.2AH.
Capacitance is the measure of electrical charge that can be stored in a device, measured in Farads—but 1
Farad is a huge amount of capacitance, so you will notice that most of the projects use capacitors with
values in the microfarad (uF) range. A capacitor is an electrical device that can hold (store) electrical
charge and supply it to other components in the circuit as needed. Though it might sound like a battery,
a capacitor can be completely drained and recharged multiple times each second—the amount of
capacitance determines how fast the capacitor can be drained and recharged.
Some multi-nreters can measure the amount of capacitance that is present between two points in a
circuit (or the value of a capacitor), like the Extech MN16a in Figure 1-5. Most multi-meters do not
measure capacitance, because it is not usually of great importance in most circuits. Being able to test
capacitance can be helpful when trying to achieve specific values or testing a capacitor, but generally
you will not need this feature on your nrulti-meter.
CHAPTER 1 THE BASICS
Caution Larger capacitors can hold a significant charge for long periods of time, and touching the leads of a
charged capacitor can cause electrical shock. Capacitors found in CRT computer monitors or televisions, motor-
start capacitors, and even the small capacitors found in disposable cameras can provide a shock that leave your
arm tingling for several minutes and even burn your skin. It is a good idea to “short” the leads of a capacitor
together with an insulated screwdriver to discharge any stored current before attempting to handle it.
Resistance is measured in ohms and tells us how well a conductor transfers electricity. Current flow and
resistance are inversely related. As resistance increases, current flow decreases. Thus, a conductor with
lower resistance transfers more electricity than one with higher resistance. Every conductor has some
resistance—some materials have such a high resistance to current flow, they are called “insulators”
meaning that they will not transfer electricity. When electricity is resisted while passing through a
conductor, it turns into heat; for this reason, we use conductors with the lowest resistance possible to
avoid generating heat.
A resistor is an electrical device that has a known resistance value in ohms and is used to limit the
amount of current that can flow through it (see Figure 1-6).
Figure 1-6. Three resistors: 1/4 watt surface mount resistor (left), 1/8 watt through-hole resistor (center),
and 1/4 watt through-hole resistor (right)
Notice that the 1/4 watt surface mount resistor (left) is much smaller than the equivalent l A watt
through-hole resistor (right), even though it dissipates the same amount of power. I typically use 1/8
watt through-hole resistors as they are small but still easy to work with.
CHAPTER 1 THE BASICS
You can use a resistor in-line with a component to limit the amount of electrical current delivered to
the device, in order to ensure it stays within a safe operating range.
The number on the chip resistor designates its resistance value in ohms, while the color-coded
stripes on the through-hole resistors designate their resistance value. If you want to manually check the
resistance of a component, use your multi-meter on the Ohm (£2) setting - polarity does not matter,
unless you measure the resistance of a diode or transistor.
I use a neat web page that enables you to enter the colors of each band on a resistor, and it tells you
the resistance value in ohms (see Figure 1-7). It is helpful for quick reference while prototyping or
identifying a loose resistor’s value. Visit http: //www. dannyg. com/examples/res2/resistor. htm.
Calculate Resistor Values from Color Codes
Brown v Black v i Red
Illustration Copyright 1996 Danny Goodman (AE9F). All Rights Reserved.
Image used with permission from Danny Goodman.
Figure 1-7. This screen-shot shows the web application designed by Danny Goodman. I have this web page
bookmarked in my web browser and use it often to check unfamiliar resistor color codes.
Calculating Resistor Power Using Ohm’s Law
Remember that any time resistance is present in a circuit, heat will be generated, so it is always a good
idea to calculate how much heat will be passed through a resistor (depending on the load) in order to
select a resistor with a sufficient power rating. Resistors are not only rated in ohms, but also by how
much power they can dissipate (get rid of) without failing. Common power ratings are 1/8 watt, Vi watt,
Vi watt, and so on, where larger watt values are typically larger resistors unless using surface mount
components (see Figure 1-5).
To calculate the power dissipated in a resistor, you need to know the circuit voltage and the resistor
value in ohms. First, we need to use Ohm’s law to determine the current that will pass through the
resistor. Then we can use the resistance and amperage to calculate the total heat that can be dissipated
by the resistor in watts.
For example, if we have a 1000 ohm resistor (lkilo-Ohm) and a 12v power supply, how much
amperage will be allowed to pass through the resistor? And what should the minimum power rating be
for the resistor?
First we calculate the amperage through the resistor using Ohm’s law:
CHAPTER 1 THE BASICS
V = I * R
I = V / R
I = 12v / 1000 ohm
I = 0.012 amps or 12 milliamps
Now we use the amperage to calculate the total power (heat):
P = 1 2 * R
P = (0.012 amps * 0.012 amps) * 1000 ohms
P = 0.144 watts
The total power is calculated as 0.144 watts, which means we should use a resistor with a power
rating greater than .144w. Because common resistor values are usually l/8w (0.125w), l/4w (0.25w),
l/2w (0.5w), and so on, we should use a resistor with a power rating of at least l/4w(a commonsize) and
still safely dissipate 0.144w of power. Using a 1 / 2w resistor will not hurt anything if you can fit the larger
size into the circuit-it will simply transfer heat more easily than a 1 /4w resistor with the same resistance
Now you should be able to figure out if your resistors have an appropriate power rating for your
application. Let’s talk about the different types of load components.
Although the multi-meter is great for measuring the voltage, resistance, and amperage, it is sometimes
helpful to be able to see exactly what is going on in an electrical signal. There is another device that is
designed to analyze electrical signals, called an “oscilloscope.” The oscilloscope can detect repeated
patterns or oscillations in an electrical signal, and display the wave-form of the signal on the screen of
the device. It is effectively a microscope for electrical signals. These machines have been expensive
($500-$5000) until recently—some hobby grade oscilloscopes have entered the market for under $100.
The open-source DSO Nano (see Figure 1-8) digital oscilloscope built by Seeedstudio.com and also
sold (in the United States) through Sparkfun.com (part #TOL-10244). I have had this oscilloscope for
about a year and use it frequently because it is easy to use and about the size/weight of a cell-phone, all
for about $89. It contains a rechargeable lithium battery and can be charged through a mini USB cable. It
also has a memory card slot available for storing readings to view later on a PC.
Figure 1-8. The DSO Nano from SeeedStudio.com (and sold through Sparkfun.com) is an excellent choice
for an inexpensive ($89), but full-featured, digital pocket oscilloscope.
Although an oscilloscope is an invaluable tool to have when diagnosing electronic signals, it is not
necessary to have for the projects in this book. You can get by with readings from a simple multi-meter.
There are also other budget oscilloscope options available, including a DIY kit from Sparkfun.com for
around $60 (part #KIT-09484).
The "load” in a circuit refers to a device in the circuit that uses the electricity. There are many different
examples of a load from a DC motor to an LED or a heater coil, and each will create a different reaction
in the circuit. For instance, a heater coil (found in a hair dryer or space heater) is simply a coiled resistive
wire made from a metal that can become glowing red when it is hot, but it does not melt. Whereas an
electric motor uses electricity to energize an electro-magnetic field around a coil of wire, causing the
motor shaft to physically move. There are two types of loads on which we focus: inductive and resistive.
If you apply power to a device and it creates moving energy, it is likely an inductive load-this includes
motors, relays, and solenoids. Inductive loads create an electro-magnetic field when energized and
usually take some time to deenergize after the power is disconnected. When the power is disconnected
using a switch, the magnetic field collapses and dumps the remaining current back to the power
terminals. This phenomenon is called Back-EMF (Electro-Motive Force) and it can damage the
switching components in a circuit if they are not protected by rectifying diodes.
A resistive load uses electrical current to produce light or some other form of heat, rather than
mechanical movement. This includes LEDs, heater elements, lightbulb filaments, welding machines,
soldering irons, and many others. Resistive loads use a constant amount of electricity because their load
is not affected by external influence.
CHAPTER 1 THE BASICS
When building an electrical circuit, you should determine the desired operating voltage before selecting
components with which to build the circuit. Although lowering AC voltage levels requires the use of a
transformer, specific DC voltage levels can be achieved by using different wiring methods to connect
several individual battery packs. There are two different types of electrical connections: series and
To arrange a circuit in “series” means to place the devices in-line with or through one another. We often
use a series connection with batteries to achieve a higher voltage. To demonstrate this circuit, we use
two 6v 10-Ah batteries with the positive (+) terminal of the first battery connected to the negative (-)
terminal of the second. The only open terminals now are the negative (-) terminal of the first and the
positive (+) terminal of the second, which will produce a difference of 12v.
When two batteries are arranged in a series circuit (see Figure 1-9), the voltage is doubled but the
Amp/Hour capacity stays the same. Thus the two 6v 10AH batteries work together to produce a single
12v 10AH battery pack. This technique can be helpful to reach specific voltage levels.
Figure 1 -9. Two batteries arranged in a series circuit produce twice the voltage but the same Amp/Hour
To arrange a circuit in “parallel” means to place all common terminals together. This means that all the
positive terminals are connected together and all the negative terminals are connected together. If we
place the two 6v 10AH batteries from the previous example into a parallel circuit (see Figure 1-10), the
voltage will stay the same but the Amp/ffour capacity will double resulting in a single 6v 20AH battery
Figure 1 -10. Two batteries arranged in a parallel circuit produce the same voltage but with twice the
Series and Parallel Connection
It is also perfectly acceptable to arrange several battery packs in both series and parallel at the same
time, in order to achieve a specific voltage and Amp/Hour rating (see Figure 1-11). Notice that there are
two sets of 6V, 10AH batteries arranged in series to produce 12V, and then the two series packs are
arranged in parallel to produce the same voltage, but with 20AH capacity.
Figure 1-11. By making two sets of series connections and placing them in parallel, you can create a 12v
battery pack with 20AH of current capacity using four 6v 1OAH battery packs.
When building a battery pack, it is important to use batteries of the same voltage and AH capacity to
build larger cells. This means that you should not pair a 12v battery with a 6v battery to achieve 18v.
Instead use three 6v batteries with the same capacity to achieve 18v and avoid uneven
The field of electronics deals with controlling the flow of electrical current through a circuit, specifically
using the electronic switch. Prior to the invention of the electronic switch, electrical circuits were turned
on and off using mechanical switches, which requires mechanical motion (i.e., your hand moving the
switch up or down) to connect or disconnect the circuit. Although mechanical switches are perfectly
acceptable and even preferred for some applications, they are limited to how fast they can be switched
due to the physical motion that must occur during the switching process. Even an electro-mechanical
CHAPTER 1 THE BASICS
switch (called a relay) does not qualify as an electronic device, because it uses electricity to generate a
mechanical motion used to activate the switch.
The electronic switch forgoes the mechanical switching action by using an electrical reaction within
the device, thus there are no moving parts. Without a physical movement, these devices can be switched
extremely fast and with much greater reliability. The substances that these switches are made from
conduct electricity only under certain circumstances—usually a specific voltage or current level must be
present at the input and output of the device to open or close it. When the device is turned on, it
conducts electricity with a specified amount of resistance. When the device is turned off, it does not
conduct electricity and instead acts as an insulator. This type of electronic component is called a “semi¬
conductor” because it can become a conductor or insulator depending on the electrical conditions.
The use of semi-conductors in place of mechanical switches is what makes a circuit “electronic,”
because they enable electrical signals to be switched at extremely high speeds, which is not possible with
mechanical circuits. There are many different semi-conductors, and we discuss a few important types
that are used in most of our circuits.
• Diode: Like a one-way valve for electrical current, this device enables only
electrical current to pass through it in one direction-extremely useful by itself, but
also the basis for all solid state electronics.
• Light Emitting Diode (LED): This type of diode emits a small amount of light when
electrical current passes through it.
• Light Dependent Resistor (LDR): This type of semi-conductor has a changing
resistance, depending on the amount of light present.
• Bipolar Junction Transistor (BJT: This is a current-driven electronic switch used for
its fast switching properties.
• Metal-Oxide Semiconductor Field-Effect Transistor (moset): This is a voltage-driven
electronic switch used for its fast switching properties, low resistance, and
capability to be operated in a parallel circuit. These are the basis for most power
These devices all have multiple layers of positively and negatively charged silicon attached to a chip
with conductive metal leads exposed for soldering into the circuit. Some transistors and mosfets have
built-in diodes to protect them from reverse voltages and Back-EMF, so it is always a good idea to review
the datasheet of the part you are using.
Each device should have its own datasheet that can be obtained from the manufacturer-usually by
downloading from its website. The datasheet has all of the important electrical information about the
device. The upper limits, usually called “Absolute Maximum Ratings,” show you at what point the device
will fail (see Figure 1-12). The lower limits (if applicable) tell you at what level the device will no longer
respond to inputs-these usually will not hurt the device, it just won’t work.
PN2222A / MMBT2222A / PZT2222A
NPN General Purpose Amplifier
• This device is for use as a medium power amplifier and switch requiring collector currents up to 500mA.
• Sourced from process 19.
Absolute Maximum Ratings * T a - 25°C unless otherwise noted
Operating and Storage Junction Temperature Range
Figure 1 -12. Flereyou can see the first page of a sample datasheet from Fairchild Semiconductor for the
popular 2n2222 NPN transistor switch. First it shows the available packages and pin-configurations, and
then a brief listing of the absolute maximum ratings.
There is also a section called “Electrical Characteristics” that tells you at what level the device
operates properly. This usually shows the exact voltage or current level that will turn the device on or off.
These ratings are helpful in determining what other component values (i.e., resistors and capacitors)
should be selected or whether the device will work for the intended purpose.
The datasheet usually tells you far more than you know what to do with, ending with graphs and
package dimensions. Some datasheets even have circuit layout recommendations and suggest ways to
interface the component with a micro-controller. For popular or commonly used component parts, you
can also check the manufacturer’s website for additional documents that further describe how to use the
component-these are called “application notes,” and can be insightful.
Some semi-conductors include multiple components housed on the same chip, which are called
Integrated Circuits (IC). An Integrated Circuit can contain thousands of transistors, diodes, resistors, and
logic gates on a tiny chip (see Figure 1-13). These components are available in the larger “through-hole”
packages and newer versions are being made on super-small "surface mount” chips.
CHAPTER 1 THE BASICS
Figure 1-13. Here you can see an 8-pin Dual Inline Package (DIP) IC (left), and a 16-pin DIPIC (right).
The Arduino 'sAtmegal 68/328 is a 28-pin DIP IC (14 pins on each side).
We use different types of semi-conductors in various packages. The component package refers to the
physical shape, size, and pin-configuration in which it is available. Different packages allow for various
heat dissipation depending on the semi-conductor. If you are going for high power, larger cases usually
dissipate heat better. For low power circuits, it is usually desirable to be as compact as possible, so
smaller package sizes might be of interest. The most common packages that we use are the TO-92 and
the T0-220 (see Figure 1-14), which house anything from temperature sensors to transistors to diodes.
Figure 1-14. The smaller TO-92 IC package (left) is used for low-power voltage regulators, signal
transistors, and sensor ICs. The larger TO-220 package (right) is used for higher power voltage regulators,
power Mosfet switches, and high-power diodes.
The TO-92 is a smaller package that is usually used for low-power transistor switches and sensors.
The TO-220 packaged is commonly used for high-powered applications and is the basis for most power
Mosfet transistors, capable of handling close to 75 amperes before the metal leads on the chip will fail.
The TO-220 package also has a built-in metal tab used to help dissipate more heat from the package, and
allowing a heat sink to be attached if needed.
Throughout this book, we look for the easiest way to build and modify our projects. Usually that means
using parts that can be replaced easily if needed and also using parts that are large enough for a beginner
to feel comfortable soldering into place.
With respect to semi-conductor components, the term “through-hole” refers to any component
whose leads are fed through holes drilled in the PCB and soldered to a copper “pad” on the bottom of
the board. These parts are typically large enough to easily solder to a PCB, even for a beginner. Many
through-hole components have pins that are much longer than needed, so it is recommended to solder
CHAPTER 1 THE BASICS
the component in place and finish by snipping the excess from the bottom of each pin to avoid any
short-circuits on the under-side of the PCB.
An “IC socket” is a plastic base that has metal contacts, which are intended to be soldered to the PCB
Lire la suite
- 20.96 MB
Vous recherchez le terme ""