Using a very old alarm will render your “Smokey the Robot” fairlyineffectual at detecting the smoke of fires.. HACKING A SMOKE ALARM You can either buy a new smoke detector module for yo
Trang 1Test the circuit by connecting an LED and 270-ohm resistor from the Vout terminal to
ground Point the sensor at a wall, and note the condition of the LED Now, wave a match
in front of the phototransistor The LED should blink on and off You’ll notice that the cuit is sensitive to all sources of infrared light, which includes the sun, strong photolamps,and electric burners If the circuit doesn’t seem to be working quite right, look for hiddensources of infrared light With the resistor values shown, the circuit is fairly sensitive; youcan change them by adjusting the value of R1 and R2
cir-“WATCHING” FOR THE FLICKER OF FIRE
No doubt you’ve watched a fire at the beach or in a fireplace and noted that the flamechanges color depending on the material being burned Some materials burn yellow ororange, while others burn green or blue (indeed, this is how those specialty fireplace logsburn in different colors) Just like the color “signature” given off when different materialsburn, the flames of the fire flicker at different but predictable rates
You can use this so-called flame modulation in a robot fire detection system to determine
what is a real fire and what is likely just sunlight streaming through a window or light from
a nearby incandescent lamp By detecting the rate of flicker from a fire and referencing itagainst known values, it is possible to greatly reduce false alarms The technique is beyondthe scope of this book, but you could design a simple flame-flicker system using an op amp,
a fast analog-to-digital converter, and a computer or microcontroller The analog-to-digitalconverter would translate the instantaneous brightness changes of the fire into digital signals.The patterns made by those signals could then be referenced against those made byknown sources of fire The closer the patterns match, the greater the likelihood that there
is a real fire In a commercial product of this nature, it is more likely that the device woulduse more sophisticated digital signal processing
Using a Pyroelectric Sensor to Detect Fire
A pyroelectric sensor is sensitive to the infrared radiation emitted by most fires The mostcommon use of pyroelectric infrared (or PIR) sensors is in burglar alarms and motiondetectors The sensor detects the change in ambient infrared radiation as a person (or ani-mal or other heat-generating object) moves within the field of view of the sensor The key
ingredient here is change: a PIR sensor cannot detect heat per se but the changes in the
heat within its field of view In larger fires, the flickering flames create enough of a change
to trigger the PIR detector
Chapter 36, “Collision Avoidance and Detection,” discusses how to use PIR sensors todetect the motion of people and animals around a robot The same sensor, with little or nochange, can be employed to detect fires To be effective as a firefighter, you should ideallyreduce the sensor’s field of the view so the robot can detect smaller fires The larger thefield of view, the more the temperature and/or position of the heat source must change inorder for the PIR sensor to detect it
USING A PYROELECTRIC SENSOR TO DETECT FIRE 651
Trang 2With a smaller field of view, the magnitude of change can be lower However, with a smallfield of view, your robot will likely need to “sweep” the room, using a servo or stepper motor,
in order to observe any possible fires The sweeping must stop periodically so the robo cantake a “room reading.” Otherwise, the motion of the sensor could trigger false alarms
Smoke Detection
“Where there’s smoke, there’s fire.” Statistics show that the majority of fire deaths each yearare caused not by burns but by smoke inhalation For less than $15, you can add smoke detec-tion to your robot’s long list of capabilities and with a little bit of programming have it wan-der through the house checking each room for trouble You’ll probably want to keep it in themost “fire-prone” rooms, such as the basement, kitchen, laundry room, and robot lab.You can build your own smoke detector using individually purchased components, butsome items, such as the smoke detector cell, are hard to find It’s much easier to use a com-mercially available smoke detector and modify it for use with your robot In fact, theprocess is so simple that you can add one to each of your robots Tear the smoke detectorapart and strip it down to the base circuit board
652 FIRE DETECTION SYSTEMS
The active element used for detecting smoke—the radioactive substanceAmericium 241—has a half-life of approximately seven years After about five
to seven years, the effectiveness of the alarm is diminished, and you shouldreplace it Using a very old alarm will render your “Smokey the Robot” fairlyineffectual at detecting the smoke of fires
HACKING A SMOKE ALARM
You can either buy a new smoke detector module for your robot or scavenge one from acommercial smoke alarm unit The latter tends to be considerably cheaper—you can buyquality smoke alarms for as little as $7 to $10 In this section, I’ll discuss hacking a com-mercial smoke alarm, specifically a Kidde model 0915K, so it can be directly connected
to a robot’s computer port or microcontroller Of course, smoke alarms are not all designedthe same, but the basic construction is similar to that described here You should have rel-atively little trouble hacking most any smoke detector you happen to use
However, you should limit your hacking attempts to those smoke alarms that use tional 9-volt batteries Certain smoke alarm models, particularly older ones, require you touse AC power or specialized batteries (such as 22-volt mercury cells) These are harder tosalvage and, besides, their age makes them less suitable for sensitive smoke detection.Start by checking the alarm for proper operation If it doesn’t have one already,
tradi-insert a fresh battery into the battery compartment Put plugs in your ears (or cover up
the audio transducer hole on the alarm) Press the “Test” button on the alarm; if it isproperly functioning the alarm should emit a loud, piercing tone If everything checksokay, remove the battery, and disassemble the alarm Less expensive models will nothave screws but will likely use a “snap-on” construction Use a small flat-headed screw-driver to unsnap the snaps
Trang 3Inside the smoke detector will be a circuit board, like the one in Fig 39.2, that consists
of the drive electronics and the smoke detector chamber
Either mounted on the board or located elsewhere will be the piezo disc used to makethe loud tone Remove the circuit board, being careful you don’t damage it Examine theboard for obvious “hack points,” and note the wiring to the piezo disc More than likely,there will be either two or three wires going to the disc:
■ Two wires to the piezo disc: the wires will provide ground and V power This design
is typical when you are using all-in-one piezo disc buzzers, in which the disc itself tains the electronics to produce the signal for audible tones
con-■ Three wires to the piezo disc: the wires will provide ground, V power, and a signalthat causes the disc to oscillate with an audible tone
Using a volt-ohm meter or an oscilloscope, find the wire that serves as ground (It isprobably colored black or brown, but if no obvious color coding is used, examine the cir-cuit board and determine where the wires are attached.) Connect the other test lead to theremaining wire Or if the disc has three wires, connect the test lead to one of the remain-ing wires
Replace the battery in the battery compartment, and depress the “Test” button on thealarm Watch for a change in voltage For a two-wire disc you should see the voltagechange as the tone is produced For a three-wire disc, try each wire to determine whichproduces the higher voltage; that is the one you wish to use If you are using an oscillo-scope, find the wire that produces a clean on/off pulse
SMOKE DETECTION 653
FIGURE 39.2 The guts of a smoke detector.
Trang 4Once you have determined the functions of the wires to the piezo disc, clip off the discand save it for some other project Retest the alarm’s circuit board to make sure you canstill read the voltage changes with your volt-ohm meter or oscilloscope Then clip off thewires to the battery compartment, noting their polarity Connect the circuit to a 5 vdcpower supply Depress the “Test” button again Ideally, the circuit will still function withthe lower voltage If it does not, you’ll need to operate the smoke alarm circuit board with
9 vdc, which can complicate your robot’s power supply and interfacing needs
If you have an oscilloscope note the voltage It should not be more than 5 volts If it
is, that means the circuit board contains circuitry for increasing the drive voltage to thepiezo disc You don’t want this when you are interfacing the board to a computer port ormicrocontroller, so you’ll need to limit the voltage by using a circuit such as that shown inFig 39.3 Here, the output of the smoke alarm circuit is clamped at no more than 5.1 volts,thanks to the 5.1-volt zener diode
Because the output of the smoke alarm detector is often an oscillating signal, there is noeffective way to measure the peak voltage by using a volt-ohm meter The meter will onlyshow an average of the voltage provided by the circuit If you are limited to using only a volt-ohm meter for your testing, for safety’s sake add the 5.1-volt zener circuit as shown in Fig.39.4 While this may be unnecessary in some instances, it will help protect your digital inter-face from possible damage caused by over-voltage from the smoke alarm circuit board
INTERFACING THE ALARM TO A COMPUTER
Assuming that the board works with the 5 vdc applied, your hacking is basically over,and you can proceed to interface the alarm with a computer port or microcontroller By
way of example, we’ll assume that a simple microcontroller that periodically polls the
input pin is connected to the smoke alarm circuit board The program, checks the pin eral times each second When the pin goes HIGH, the smoke alarm has been triggered
sev-If your microcontroller supports interrupts, a better scheme is to connect the smoke alarmcircuit board to an interrupt pin Then write your software so that if the interrupt pin is trig-gered, a special “I smell smoke” routine is run The benefit of an interrupt over polling is thatthe latter requires your program to constantly branch off to check the condition of the inputpin With an interrupt, your software program can effectively be ignorant of any smoke detec-tor functionality If and when the interrupt is triggered because the smoke alarm circuit wastripped, a special software routine takes over, commanding the robot to do something else.See Chapter 28 for more information on using interrupts in microcontrollers
Rather than connect the output of the smoke alarm circuit board directly to the inputpin, use a buffer to protect the microcontroller or computer against possible damage Youcan construct a buffer using logic circuits (either TTL or CMOS) or with an op ampwired for unity-gain (with unity-gain, the op amp doesn’t amplify anything) The buffer
is optional, but I do recommend it Note also that the smoke alarm circuit board derivesits power from the robot’s main 5 vdc power supply and not from the microcontroller.Alternatively, you can use an opto-isolator The opto-isolator bridges the gap betweenthe detector and the robot You do not need to condition the output of the opto-isolator
if you are connecting it to a computer or microprocessor port or to a microcontroller.Several opto-isolator interfacing circuits are shown in Appendix D, “Interfacing LogicFamilies and ICs.”
654 FIRE DETECTION SYSTEMS
Trang 5TESTING THE ALARM
Once the smoke alarm circuit board is connected to the microcontroller or computer port,test it and your software by triggering the “Test” button on the smoke alarm The softwareshould branch off to its “I smell smoke” subroutine For a final test, light a match, and thenblow it out Wave the smoldering match near the smoke detector chamber Again, the soft-ware runs the “I smell smoke” subroutine
LIMITATIONS OF ROBOTS DETECTING SMOKE
You should be aware of certain limitations inherent in robot fire detectors In the earlystages of a fire, smoke tends to cling to the ceilings That’s why manufacturers recommendthat you place smoke detectors on the ceiling rather than on the wall Only when the firegets going and smoke builds up, does it start to fill up the rest of the room
Your robot is probably a rather short creature, and it might not detect smoke that fines itself only to the ceiling This is not to say that the smoke detector mounted on even
con-a one-foot high robot won’t detect the smoke from con-a smcon-all fire; just don’t count on it Bcon-ack
up the robot smoke sensor with conventionally mounted smoke detection units, and do not
rely only on the robot’s smoke alarm
DETECTING NOXIOUS FUMES
Smoke alarms detect the smoke from fires but not noxious fumes Some fires emit verylittle smoke but plenty of toxic fumes, and these are left undetected by the traditionalsmoke alarm Moreover, potentially deadly fumes can be produced in the absence of a fire.For example, a malfunctioning gas heater can generate poisonous carbon monoxide gas.This colorless, odorless gas can cause dizziness, headaches, sleepiness, and—if the con-centration is high enough—even death
Just as there are alarms for detecting smoke, so there are alarms for detecting noxiousgasses, including carbon monoxide Such gas alarms tend to be a little more expensive thansmoke alarms, but they can be hacked in much the same way as a smoke alarm Deducethe signal wires to the piezo disc and connect them (perhaps via a buffer and zener diodevoltage clamp) to a computer port or microcontroller
SMOKE DETECTION 655
OutputFrom alarm
5.1 v zener
FIGURE 39.3 Use a 5.1 zener diode to
ensure that the smoke alarm output does not drive the computer/micro- controller input above 5 vdc.
Trang 6Combination units that include both a smoke and gas alarm are also available Youshould determine if the all-in-one design will be useful for you In some combinationsmoke-gas alarm units, there is no simple way to determine which has been detected.Ideally, you’ll want your robot to determine the nature of the alarm, either smoke or gas(or perhaps both).
If your robot is on wheels (or legs) and is wandering through the house, perhaps it’ll be
in the right place at the right time and sense these irregular situations A fire is brewing,and before the house fills with smoke or flames the air gets a little warm Equipped with
a heat sensor, the robot can actually seek out warmer air, and if the air temperature gets toohigh it can sound an initial alarm
Realistically, heat sensors provide the least protection against a fire But heat sensorsare easy to build, and, besides, when the robot isn’t sniffing out fires it can be wanderingthrough the house giving it an energy check or reporting on the outside temperatureor…you get the idea
Fig 39.4 shows a basic but workable circuit centered around an LM355 temperaturesensor This device is relatively easy to find and costs under $1.50 The output of thedevice, when wired as shown, is a linear voltage The voltage increases 10 mV for everyrise in temperature of 1° Kelvin (K)
Degrees Kelvin uses the same scale as degrees Centigrade (C), except that the zero point
is absolute zero—about 273°C One degree Centigrade equals 1° Kelvin; only the startpoints differ You can use this to your advantage because it lets you easily convert degrees
Kelvin into degrees Centigrade Actually, since your robot will be deciding when hot is hot,
and doesn’t care what temperature scale is used, conversion really isn’t necessary
You can test the circuit by connecting a volt-ohm meter to the ground and output minals of the circuit At room temperature, the output should be about 2.98 volts You can
ter-656 FIRE DETECTION SYSTEMS
+5V
Output = 10mV/ΩK LM335
+
ADJ
-R1 4.7K
R2 10K
FIGURE 39.4 The basic wiring
dia-gram for the LM355 temperature sensor.
Trang 7calculate the temperature if you get another reading by subtracting the voltage by 273(ignore the decimal point but make sure there are two digits to the right of it, even if theyare zeros) What’s left is the temperature in degrees Centigrade For example, if the read-ing is 3.10 volts, the temperature is 62°C (310 273 62) By the way, that’s pretty hot!Time to turn on the air conditioner.
You can calibrate the circuit, if needed, by using an accurate bulb thermometer as a erence and adjusting R2 for the proper voltage How do you know the “proper” voltage?
ref-If you know the temperature, you can determine what the output voltage should be byadding the temperature (in degrees C) to 273 If the temperature is 20°C, then the outputvoltage should be 2.93 volts For more accuracy, float some ice in a glass of water for15–20 minutes and stick the sensor in it (keep the leads of the testing apparatus dry) Wait
5 to 10 minutes for the sensor to settle and read the voltage It should be exactly 2.73 volts.The load presented at the outputs of the sensor circuit can throw off the reading Theschematic in Fig 39.5 provides a buffer circuit so the load does not interfere with the output
of the 355 temperature sensor Note the use of the decoupling capacitors as recommended inthe manufacturer’s application notes These aren’t essential, but they are a good idea
Fire Fighting
By attaching a small fire extinguisher to your robot, you can have the automaton put outthe fires it detects Obviously, you’ll want to make sure that the fire detection schemeyou’ve put into use is relatively free of false alarms and that it doesn’t overreact in nonfiresituations Having your robot rush over to one of your guests and put out a cigarette he justlit is not only bad manners, it’s potentially embarrassing
It’s a good idea to use a “clean” fire extinguishing agent for your fire-fighting ‘bot.Halon is one of the best such agents, but, alas, the stuff is known to punch massive holes
in the earth’s ozone layer, and as a result it is no longer manufactured for general sumption It’s still legal to use, however, so if you have a working Halon fire extinguisher,you may wish to use it with your robot firefighter You may also consider one of a number
con-of Halon alternatives; select one that does not dispense a foam or powder For example,any inert gas (helium, argon) and many noncombustible gasses (e.g., nitrogen) can be used
to deplete a fire, and they will not leave a sediment on whatever they are sprayed on
No matter what you use for the fire extinguisher, be sure to use caution as a guide whenbuilding any fire-fighting robot Consider limiting your robot for experimental use, andtest it only in well-ventilated rooms—or better yet—outside
HEAT SENSING 657
TABLE 39.2 PARTS LIST FOR THE BASIC TEMPERATURE TRANSDUCER.
R1 4.7K resistor, 1 percent toleranceR2 10K 10-turn precision potentiometerD1 LM335 temperature sensor diodeAll capacitors have 10 percent tolerance unless noted; all resistors 1/4-watt.
Trang 8The exact mounting and triggering scheme you use depends entirely on the design ofthe fire extinguisher The bottle used in the prototype firebot is a Kidde Force-9, 2 1/2pound Halon extinguisher It has a diameter of about 3 1/4 inches You can mount the extin-guisher in the robot by using “plumber’s tape,” that flexible metallic strip used by plumbers
to mount water and gas pipes It has lots of holes already drilled into it for easy mounting.Use two strips to hold the bottle securely Remember that a fully charged extinguisher isheavy—in this case over 3 pounds (2 1/2 pounds for the Halon chemical and about 1/2
658 FIRE DETECTION SYSTEMS
3 7
+
12K
4.7 C1
741
-FIGURE 39.5 An enhanced wiring scheme for the
LM355 temperature sensor The load
of the output is buffered and does not affect the reading from the LM355.
TABLE 39.3 PARTS LIST FOR THE BUFFERED TEMPERATURE TRANSDUCER.
R1 12K resistor, 1 percent toleranceC1,C3 0.1 F ceramic capacitorC2,C4 4.7 F tantalum capacitorD1 LM335 temperature sensor diodeAll capacitors have 10 percent tolerance unless noted; all resistors 1/4-watt.
Trang 9pound for the bottle) If you add a fire extinguisher to your robot, you must relocate othercomponents to evenly distribute the weight.
The extinguisher used in the prototype system for this book used a standard ing valve To release the fire retardant, you squeeze two levers together Fig 39.6 showshow to use a heavy-duty solenoid to remotely actuate the valve You may be able toaccess the valve plunger itself (you may have to remove the levers to do so) Rig up aheavy-duty solenoid and lever system A computer or control circuit activates the solenoid
actuat-For best results, the valve should be opened and closed in quick bursts (200–300 liseconds are about right) The body of the robot should also pivot back and forth so theextinguishing agent is spread evenly over the fire Remember that to be effective, the extin-guishing agent must be sprayed at the base of the fire, not at the flames For most fires,this is not a problem because the typical robot stays close to the floor If the fire is up high,the robot may not be able to effectively fight it
mil-You can test the fire extinguisher a few times before the bottle will need recharging Iwas able to squeeze off several dozen short blasts before the built-in pressure gauge regis-tered that I needed a new charge For safety’s sake, experiment with an extra extinguisher.Don’t use your only extinguisher for your robot experiments; keep an extra handy in theunlikely event that you have to fight a fire yourself
If the fire-fighting robot bug bites you hard, consider entering your machine in the annual
Trinity College Fire Fighting Home Robot Contest (see www.trincoll.edu/events/robot/ for
additional information, including rules and a description of the event) This contest involvestiming a robot as it goes from room to room in a houselike test field (the “house” and all itsrooms are in a reduced scale) The object is to find the fire of a candle and snuff it out in theleast amount of time Separate competitions involving a junior division (high school andyounger) and a senior division (everyone else) help to provide an even playing field for thecontestants
From Here
To learn more about… Read
Connecting sensors to computers Chapter 29, “Interfacing with Computers and and microcontrollers Microcontrollers”
Adding the sensation of “touch” Chapter 35, “Adding the Sense of Touch”
Optical systems for detecting light Chapter 37, “Robotic Eyes”
Enabling the robot to move around in Chapter 38, “Navigating through Space”
a room or houseAdding a siren or other warning device Chapter 40, “Sound Output and Input”
FIRE FIGHTING 659
Trang 10660 FIRE DETECTION SYSTEMS
Plunger
Nozzle Lever
Heavy-duty solenoid
Fire extinguisher
FIGURE 39.6 Using a heavy-duty solenoid to activate a
fire extinguisher.
Trang 11The robots of science fiction are seldom mute or deaf They may speak pithy warnings—
“Danger, Will Robinson, Danger”—or squeak out blips and beeps in some “advanced” guage only other robots can understand Voice and sound input and output make a robot more
lan-“humanlike,” or at least more entertaining What is a personal robot if not to entertain?What’s good for robots in novels and in the movies is good enough for us, so this chap-ter presents a number of useful projects for giving your mechanical creations the ability tomake and hear noise The projects include using recorded sound, generating warningsirens, recognizing and responding to your voice commands, and listening for soundevents Admittedly, this chapter only scratches the surface of what’s possible today, espe-cially with technologies like MP3 compressed digitized sound and ultracompact compactdisc (and the ability to record them on a CD recorder connected to your computer) Alas,
my publisher told me I had killed enough trees as it is and the book could not get any ger, so this chapter must remain simply a primer on sound output and input
big-Mechanically Recorded Sound Output
Before electronic doodads took over robotics there were mechanical solutions for just abouteverything While they may not always have been as small as an electrical circuit, they wereoften easier to use Case in point: you can use an ordinary cassette tape and playback
Trang 12mechanism to produce music, voice, or sound effects Tape players and tape player nisms are common finds in the surplus market, and you can often find complete (and stillworking) portable cassette players-recorders at thrift stores With just a few wires you can rig
mecha-a cmecha-assette tmecha-ape plmecha-ayer in the robot mecha-and hmecha-ave the sound plmecha-ayed bmecha-ack, on your commmecha-and.When looking for a cassette player try to find the kind shown in Fig 40.1, which aresolenoid controlled These are handy for your robot designs because instead of pressingmechanical buttons, you can actuate solenoids by remote or computer control to play, fast-forward, or rewind the tape
For most cassette decks you only need to provide power to operate the motor(s) andsolenoids (if any) and a connection from the playback head to an amplifier Since you arenot using the deck for recording, you don’t have to worry about the erase head, biasing therecord head, and all that other stuff If the deck already has a small preamplifier for the playback head, use it It’ll improve the sound quality If not, you can use the tape headpreamplifier shown in Fig 40.2 (you can use a less expensive op amp than the one speci-fied in the parts list in Table 40.1, but noise can be a problem) Place the preamplifierboard as close to the cassette deck as possible to minimize stray pickup
Electronically Recorded Sound Output
While mechanical sound playback systems are adequate, they lack the response and bility of a truly electronic approach Fortunately, all-electronic reproduction of sound isfairly simple and inexpensive these days, in large part because of the wide availability of
flexi-662 SOUND OUTPUT AND INPUT
FIGURE 40.1 A surplus cassette deck transport This model is entirely solenoid
driven and so is perfect for robotics.
Trang 13custom-integrated circuits that are designed to record, store, and play back recorded sound.Most of these chips are made for commercial products such as microwave ovens, cellularphones, or car alarms.
In the following sections you’ll learn about two approaches to electronically recordedsound output: hacking a sound recorder toy and using a special-purpose sound storage chip
HACKING A TOY SOUND RECORDER
You can hack toy sound recorders, such as the Yak Bak, for use in your robot These units,which can often be found at toy stores for under $10, contain a digital sound recording chip,microphone, amplifier, and speaker (and sometimes sound effects generator) To use them,you press the Record button and speak into the microphone Then, stop recording and pressthe play button and the sound will play back until you make a new recording
Fig 40.3 shows a Yak Bak toy that was disassembled and hacked by soldering wiresdirectly to the circuit board The wires, which connect to a microcontroller or computer,are in lieu of pressing buttons on the toy to record and play back sounds The buttons onmost of these sound recorder toys are made of conductive rubber and are easily removed
To operate the unit via a microcontroller or computer, you bring the button inputs HIGH
or LOW (Which value you choose depends on the design of the circuit; you need to iment to find out which to use.) Connect a 1K to 3K resistor between the microcontroller-computer port and the button input
exper-ELECTRONICALLY RECORDED SOUND OUTPUT 663
7
Output LT1007
Input
R1 5K
C1 0.1
R2 100Ω
R3 330K
FIGURE 40.2 Preamplifier
cir-cuit for use with
a magnetic tape playback head.
TABLE 40.1 PARTS LIST FOR CASSETTE TAPE HEAD PLAYER AMPLIFIER.
IC1 LT1007 low-noise operational amplifier (Linear Technology)R1 330K-resistor
R2 4.9K resistorR3 100–ohm resistorC1 0 1 F ceramic capacitorAll resistors have 5 percent tolerance, 1/8- or 1/4-watt, metal film; all capacitors have 10 percent tol- erance, rated 35 volts or higher.
Trang 14Suppose you have a Yak Bak or similar toy connected to I/O pin 1 on a Basic Stamp II.Assume that on the toy you are using, bringing the button input HIGH triggers a previouslyrecorded sound snip The control program is as simple as this:
high 1 pause 10 low 1
The program starts by bringing the button input (the input of the toy connected to pin 1
of the Basic Stamp) HIGH The pause statement waits 10 milliseconds and then places the
button LOW again
The built-in amplifier of these sound recorder/playback toys isn’t very powerful Youmay wish to connect the output of the toy to one of the audio output amplifiers describedlater in the chapter (see “Audio Amplifiers”)
USING THE ISD FAMILY OF VOICE-SOUND RECORDER ICS
Toy sound recorders are limited to playing only a single sample For truly creative robotyapping, you need a sound chip in which you can control the playback of any of several
664 SOUND OUTPUT AND INPUT
FIGURE 40.3 A hacked Yak Bak can be used to store and play short sound
snips You can record sounds for later playback, which can be via computer control This model has two extra buttons for sound effects, which are also connected to the robot’s microcontroller or computer.
Trang 15prerecorded snips You can do this easily by using the family of sound storage and back chips produced by Information Storage Devices (ISD) The company has madethese “ChipCorder” ICs readily available to the electronics hobbyist and amateur robotbuilder.
play-You can purchase ISD sound recorder chips from a variety of sources, including Jamecoand Digikey (see Appendix B) Prices for these chips vary depending on feature andrecording time, but most cost under $15 While there are certainly other makers of soundstorage/playback integrated circuits, the ISD chips are by far the most widely used andamong the most affordable
The ChipCorder products enjoy a rich assortment of data sheets and application notes,
all of which are available from the ISD Web page at www.isd.com.
Sirens and Other Warning Sounds
If you use your robot as a security device or to detect intruders, fire, water, or whatever,then you probably want the machine to warn you of immediate or impending danger Thewarbling siren shown in Fig 40.4 will do the trick, assuming it’s connected to a strongenough amplifier (refer to the parts list in Table 40.2) The circuit is constructed usingtwo 555 timer chips (alternatively, you can combine the functions into the 556 dual timer chip) To change the speed and pitch of the siren, alter the values or R1and R4, respectively
For maximum effectiveness, connect the output of the IC2 to a high-powered
amplifi-er You can get audio amplifiers with wattages of 8, 16, and even more volts in build kit form See Appendix B, “Sources,” for a list of mail order companies that also sell electronic kits
easy-to-SIRENS AND OTHER WARNING SOUNDS 665
1 2 6
7
3
1 2 6
R2 1M
R4 1K
R5 4.7K
C1 0.22
IC1
C2 0.1
R3 10K
5
FIGURE 40.4 A warbler siren made from two 555 timer ICs.
Trang 16Sound Control
Unless you have all of the sound-making circuits in your robot hooked up to separateamplifiers and speakers (not a good idea), you’ll need a way to select between thesounds The circuit in Fig 40.5 uses a 4051 CMOS analog switch and lets you choosefrom among eight different analog signal sources You select input by providing a three-bit binary word to the select lines You can load the selection via computer or set it man-ually with a switch A binary-coded-decimal (BCD) thumbwheel switch is a goodchoice, or you can use a four-bank DIP switch Table 40.3 shows the truth table forselecting any of the eight inputs
You can route just about any of your sound projects through this chip, just as long asthe outlet level doesn’t exceed a few milliwatts Do not pass amplified sound through thechip Besides in all likelihood destroying the chip, it’ll cause excessive cross talk betweenthe channels It’s also important that each input signal not have a voltage swing thatexceeds the supply voltage to the 4051
Audio Amplifiers
Fig 40.6 shows a rather straightforward 0.5-watt sound amplifier that uses the LM386integrated amp The sound output is minimal, but the chip is easy to get, cheap, and can bewired up quickly It’s perfect for experimenting with sound projects The amplifier asshown has a gain of approximately 20, using minimal parts You can increase the gain toabout 200 by making a few wiring changes, as shown in Fig 40.7 Either amplifier willdrive a small (two- or three-inch) eight-ohm speaker Refer to the parts lists in Tables 40.4and 40.5 for these circuits
666 SOUND OUTPUT AND INPUT
TABLE 40.2 PARTS LIST FOR SIREN.
IC1,IC2 555 Timer ICR1 10K resistorR2 1 megohm resistorR3 10K resistorR4 1K resistorR5 4.7K resistorC1 0.22 F ceramic capacitorC2 0.1 F ceramic capacitorAll resistors have 5 or 10 percent tolerance, 1/4-watt; all capacitors have 10 percent tolerance, rated
35 volts or higher.
Trang 17AUDIO AMPLIFIERS 667
8 GND
16 +5
13 14 15 13 1 5 2 4
-5
INH 6
Input select A
B C
11 10 9
Output 3
0 1 2 3 4 5 6 7 7
IC1 4051 Audio Inputs
FIGURE 40.5 How to use the 4051 CMOS 8-input analog switch to
control the output of the various sound-making circuits
in your robot You can choose the sound source you want routed to the output amplifier by selecting its input with the Input Select lines (they are binary weight- ed: A 1, V 2, C 4) For best results, the audio
inputs should not already be amplified.
TABLE 40.3 4051 TRUTH TABLE.
C B A Selected Output Pin