Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 30 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
30
Dung lượng
389,63 KB
Nội dung
402 Appendix A — Soldering and Safety Basics Figure A-22 shows a standard anti-static bag used as a holder for an expensive part. These bags are made of metalized plastic and are meant to keep all pins of a part at the same voltage potential. What’s dangerous about static electricity is that it can put a several-thousand-volt spike between two pins on a part. The current is very low, but the delicate internals of an IC cannot withstand such a high voltage. Figure A-23 shows ICs pushed into anti-static foam, which serves a similar purpose of keeping all the parts at the same voltage level. F IGURE A-22: Anti-static bag with sensitive component on top If you solder directly to ICs (which is not recommended unless you have to), make sure you use a grounded soldering iron. All the better soldering irons (like the Weller ones) are grounded. If you live in a humid climate, static prevention issues become less of an issue, but if you live in the desert, take extra care. Once you get into the habit of not shifting too much in your chair and occasionally touching the grounded chassis of your computer or work light, you don’t have to consciously worry about static issues. 403 Appendix A — Soldering and Safety Basics F IGURE A-23: Anti-static foam Summary Soldering is fun. On the one hand, you get to play with molten metal and a dangerous device that can burn holes in things. On the other hand, you get to construct a working circuit using your bare hands. You can now build all of the circuits in this book and 90 percent of the circuits out there. The main difference with the more advanced circuits is the smaller parts. Electrical Diagram Schematics W hen you first stumble upon a circuit schematic it looks like a bunch of mysterious squiggly lines and weird little curves, not unlike hieroglyphics. Schematic symbols are indeed a language unto their own, but it’s a relatively recent language, derived from a hundred- year-old way of writing wiring diagrams for telegraphs and scientific experi- ments. Only in the last 50 years or so has it become standard enough for anyone to understand, used and refined by hackers like you who were trying to figure out unambiguous ways to share their hacks with friends and col- leagues. The various symbols in schematics are based very much on the physical devices they represent. The way one draws a schematic both influ- ences and is influenced by the physical layout of component parts and wires. It’s possible to draw a schematic that mimics closely the physical instantia- tion of a circuit. The first circuit schematics were sketches just like this, but as time passed people discovered better ways to translate a circuit to paper. Some of the changes involved short-cuts similar to contractions in English: no need to write the whole thing down if everyone knows what you mean. Other changes were more conceptual like the addition of pronouns: you can say “this” instead of “an appendix about schematics” when talking about this appendix. Because electrical schematic drawings are a lot like language, everyone who draws a schematic has his or her own style and idioms. Getting used to the idioms of different groups can take a few minutes. For example, European hackers have a different style than American ones. But thanks to Internet communication and common programs to draw schematics, the various accents used across the globe are becoming more unified. If you’re interested in drawing your own schematics, you can use any drawing program, preferably a vector-based one. People who draw many schematics use a schematic capture program. One of the best ones for hobbyist use is Eagle by Cadsoft, available at http://cadsoft.de/. It’s available for Linux, Mac OS X, and Windows, and is free for non- commer cial use. A completely open-source toolkit is the gEDA project at www.geda.seul.org/. It has many converts but is a little harder to use. A very easy-to-use system for Windows is PCB123 software. PCB123 will make a board from your schematic, at a very reasonable rate, but you have to use their software. The professionals use either ProTel (now Altium) or OrCAD. These comprehensive tools have huge part libraries and can even simulate your schematic. They also have a professional price tag to match their capabilities. Learn how to read schematics Understand schematic conventions and symbols Know how and when to create your own schematic symbols appendix in this appendix 406 Appendix B — Electrical Diagram Schematics Conventions When drawing schematics you should follow a few conventions. These aren’t hard rules and will be broken in the interest of making a schematic easier to understand. Ⅲ Signal flow goes from top-left to bottom-right. Ⅲ Positive voltages are on top; negative voltages are at the bottom. Ⅲ Each component is labeled with the part’s value, for example, 220 for 220 ohms, or 7805 for the 7805 voltage regulator. Ⅲ Each component is labeled with a unique identifier to distinguish it from other parts of the same type, for example R2 (for resistor #2) or IC4 (for integrated circuit #4). Sometimes integrated circuit chips (ICs) are labeled with identifiers starting with U (for U #4) instead of IC. Ⅲ No diagonal wires, only up-down and left-right. Ⅲ Minimize the crossing of wires. To read a schematic, note the above conventions and just dive in. You’ll often find little sub- circuits you understand, like the power supply and LED light circuits that keep popping up in this book. When you understand a sub-circuit, you can focus on the other parts of the circuit you don’t understand. Most circuits are built by connecting sub-circuits and they should be fairly intuitive when you understand the basics presented in this appendix. If you come across a symbol you don’t recognize, don’t worry. It’s probably a new symbol cre- ated with a special purpose (or perhaps a symbol from a different idiom, as mentioned earlier in this appendix). Usually you can tell by context and similarity with previous symbols as to what it does. Otherwise there will be some explanatory text to go with the circuit diagram. Similarly, when you’re drawing a schematic and you don’t have a symbol for a part, make one up based on what you think it should look like. Then, if it’s not obvious, label your new part so others understand. It is generally a good idea to familiarize yourself with some of the com- monly used idioms. That way, you can make sure that you don’t create a symbol that already exists, and you can also make sure that you make a symbol that will clearly imply what type of component it is, when possible. For example, a resistor should look like a resistor. By creating your symbols this way, you can make it easier for other people to understand your schematics later. It’s All About the Connections Schematics describe the connectivity between components. They are wiring diagrams. It’s not important where the parts are placed on the page but rather how the parts are connected to each other. There is no one right way of drawing a schematic; in fact, there’s an infinite number of ways. You can see throughout the book that I predominantly use the U.S. convention as drawn by the Eagle schematic capture software. Sometimes other conventions are used to match the style in which a circuit is normally seen. For example, the Basic Stamp circuits use a 407 Appendix B — Electrical Diagram Schematics slightly different idiom for power and ground to match the Basic Stamp documentation. The particular layout used is due to convention or author preference. Figure B-1 shows three different ways of drawing a flashlight circuit made out of a battery, resistor, and LED lamp. F IGURE B-1: Different but equivalent schematics to light an LED lamp Wires Schematics are made up of two types of pieces: components and wires. Wires join component parts together and are represented as simple lines. Sometimes a schematic cannot be drawn without having one line cross another. In such a case, the lines should just be drawn on top of one another, as in the left-most example in Figure B-2. If the two wires should connect, then a small dot is placed on the intersection to represent the connection. This representation likely grew out of the reality that a real connection would be accomplished by a small dot of solder. Usually you see intersecting wires depicted like the right-most example in Figure B-2, where one wire seems to grab on to an existing one. Graph Theory In a way, schematic diagrams are a lot like subway and train maps. Subway maps show the connectivity between stations, but misrepresent the distance between stations. The geo- graphic layout between stations isn’t as important as showing the connections between them. Both schematics and subway maps are examples of graphs, a mathematical concept that describes a set of objects (called nodes or vertices) and their connections (called edges or lines). The study of graphs is called graph theory, a field of study that, besides electronics, is critical in Internet search engines (connectivity of web pages), information storage and retrieval (connectivity of data), telephone and Internet routing (connectivity of a telephone network), and many other fields. GNDGND GNDGND a. b. c. Vcc Vcc 408 Appendix B — Electrical Diagram Schematics F IGURE B-2: Wires and their connections Power and Ground Symbols A great shortcut to avoiding drawing lots of wires is the use of labeled arrow symbols. Generally, arrows indicate a wire with a signal going off the page or connected elsewhere on the page. The very common cases for using labeled arrows are for the ground and power signals in a circuit. Ground is an important concept in circuits, as all other voltages and signals in circuits are measured in reference to the ground wire. The name ground comes from the first circuits where one wire was literally pushed into the earth. Figure B-3 shows a variety of different ground symbols. It’s always an arrow pointing down and labeled with GND or Gnd, or Vss. Vss is the more general way of saying negative supply voltage, but that almost always means zero volts, that is, ground. When building a circuit, all ground symbols are connected together. F IGURE B-3: Common symbols for ground Similar to the ground symbol is the power symbol. Figure B-4 shows a few of the most com- mon symbols for power. Sometimes the explicit voltage being used is shown (+5V), but usually the general label for positive supply voltage is used. Vcc and Vdd both mean positive supply voltage. F IGURE B-4: Common variations for power or positive voltage VddVcc+5V VssGNDGNDGND Crossing, no dot: no connection Crossing and dot: connected Usually seen on T-connections 409 Appendix B — Electrical Diagram Schematics The Vdd and Vss labels come from the MOSFET transistor that enabled high-density inte- grated circuits. A MOSFET has a drain (positive pin) and a source (negative pin). Vdd meant the voltage for all drain pins, and Vss meant the same for all source pins. The Vcc label comes from the earlier BJT transistor type that had collector and emitter pins instead of drain and source. As you might expect, there is a Vee label to go along with the Vcc, but today it’s more common to use Gnd instead. A circuit may have multiple voltage sources, each distinct from one another. For example, in the Roomba adapter schematics you see Vpwr or +16VDC to indicate the power from Roomba and Vcc+ or +5VDC to indicate the regulated power coming from the 7805 voltage regulator. When building a circuit, all power symbols with the same value are connected together. Basic Components When you have power and ground, you can start hooking up components between the two to do things. Simple components like resistors and capacitors are considered passive since they do not require a source of energy to perform their task. Passive components usually have two leads (also known as pins or terminals). They are the simplest parts physically but often have the most interesting symbols. In contrast, active components like integrated circuits (ICs) require power and have complex internal functionality, but are represented by simple rectangles bris- tling with short lines indicating their connection pins. Resistors Resistors are the most basic of components. They are commonly used to limit the amount of current or act as part of a filter circuit. Figure B-5 shows the symbols for several different types of resistors. This back-and-forth squiggle common to all the symbols is representative of the resistance that a resistor provides: It’s harder to move down a curvy road than a straight one. (As you can see, these symbols are made by regular people looking for good analogies.) F IGURE B-5: Types of resistors: fixed, variable, potentiometer, photocell, thermistor The left-most symbol is for the standard fixed resistor; its resistance value doesn’t change. Fixed resistors are often used to restrict the amount of current to other components, like the resistor that’s part of the LED sub-circuits in this book. Without the resistor, the LED would draw too much current and burn out. Two different types of variable resistor are the next two symbols. Most knobs on electronic devices are variable resistors. The second-to-last symbol is for a photocell: a light-sensitive resistor. These act just like normal variable resistors, but instead of a knob, the amount of light hitting them changes their resistance. The last symbol is T 410 Appendix B — Electrical Diagram Schematics for a thermistor, a resistor that changes its resistance value based on the temperature. Thermistors are sometimes used in thermostats for heaters and air conditioners. New types of variable resistors are created all the time (bend-sensitive, force-sensitive, and so on), and so new sym- bols are also created. Capacitors Capacitors store small amounts of electricity and are useful as parts of filters or to smooth out power supply fluctuations. The amount of electricity a capacitor can store is its charge capacity, thus its name. Figure B-6 shows three different symbols for capacitors. The symbol comes from the fact that capacitors were first made using two metal plates next to each other. The middle symbol isn’t used as much as it used to be because of its similarity to the battery symbol. The last symbol is for a polarized capacitor, like the electrolytic capacitors used in power supplies. A polarized capacitor needs to be oriented with its positive terminal attached to the more positive part of the circuit than its negative terminal. Otherwise the capacitor won’t work and might fail. F IGURE B-6: Capacitor symbols: regular, old-style regular, and polarized Many components are polarized like this and will indicate their polarity both physically and in their schematic symbol. Be alert when a symbol has an arrow or a plus sign. Polarized parts wired backward are one of the leading mistakes made when building circuits. Diodes Diodes only let current flow in one direction. The most common use is to turn the alternating current of AC from a wall socket into the single direction current of DC needed by most gadgets. A diode added before a battery connector protects the circuit in case the batteries are inserted backward. The arrow of the diode indicates the direction current is allowed to flow in the diode. Figure B-7 shows the symbols for a few different types of diodes. The left symbol is for a regular diode. The middle symbol is for an LED (light-emitting diode), a common part of any electronic device. The act of current flowing through an LED lights it up. The right-most symbol is a photodiode. A photodiode will generate current when light falls on it. Photodiodes are used as the receiver in all your devices that have infrared remote controls. In the diode symbol, sometimes the arrow is solid and sometimes it’s just an outline. There’s no difference between the two representations. + 411 Appendix B — Electrical Diagram Schematics F IGURE B-7: Diodes: regular, LED, and photodiode Other Components The preceding sections describe the most common components you’ll run into when building projects. Figure B-8 shows some other parts you may also see. F IGURE B-8: Battery, transistor, switch, inductor, and relay The first symbol is for a battery. It has a positive and negative terminal, as you’d expect. A sin- gle short-dash/long-dash pair originally indicated a single cell of a battery (approximately 1.5V). A stacked set of cells becomes a battery with the voltage indicated by the number of cells. This has fallen out of practice and now a general battery symbol is often shown with a voltage value given next to it. The next symbol is a transistor. It’s used as either an amplifier or an electrically controlled switch. The middle symbol is for a switch or button. Sometimes switches will have multiple contacts operated by a single push, represented as two switch symbols joined together with a dotted line. The next-to-last symbol is an inductor or coil. An inductor is sort of like a capacitor, but instead of storing charge, it stores magnetic fields. The electromagnets you might have played with in high school science classes are a special type of inductor. The final symbol is for a relay. It’s a compound symbol made up of an inductor (the electro- magnet) and a switch. When current flows through the electromagnet part of the relay, it cre- ates a magnetic field to pull down the switch contacts. Relays are great for turning on and off things that require more power than your circuit can provide, like motors. With the above basic components you can read just about any circuit written before 1960. There are a lot of fun circuits to build with that toolkit: alarm systems, telephones, audio amplifiers, clocks, and even rudimentary computers. But even the most rudimentary computer has hundreds of transistors. Imagine being required to draw (and read!) a hundred transistors. Some manner of summarization was needed for these more complicated parts. + [...]... 389 K Kamikaze firmware, 306 keyboards Bluetooth, 66 as musical keyboards, 157 158 , 157 KeyListeners, 104 keyPressed method, 104 DriveRealTime, 106 for musical keyboard, 158 RoombaView, 141 Keyspan adapters for Linux, 317 for SitePlayer Telnet, 219 Kismet tool, 235 kmod-usb-ohci package, 317 kmod-usb-serial package, 317 kmod-usb-storage package, 344–345 Konar, Murat N., 264 L ladybug costume, 372 Lamarr,... data Force-Seeking-Dock Command opcode: 143 Number of data bytes: 0 Turns on force-seeking-dock mode, which causes the robot to immediately attempt to dock during its cleaning cycle if it encounters the docking beams from the Home Base (Note, however, that if the robot was not active in a clean, spot or max cycle it will not attempt to execute the docking.) Normally the robot attempts to dock only... upgrading and replacing, 299 first generation of Roomba cleaners, 5–6, 6 fixed resistors in schematic diagrams, 409, 409 flash chips for OpenWrt, 302 flash drives for vision systems, 344–346, 344 flash-wl-hdd.sh script, 308 floor types, current variations from, 14 flush-cut cutters, 388, 388 flux in solder, 385–386 foam, anti-static, 402, 403 Force-Seeking-Dock command, 422 forwarding, port, 253 frames... time.sleep (2) Roomba battery ground The RXD, TXD, and Device Detect pins use 0 – 5V logic, so a level shifter such as a MAX232 chip will be needed to communicate with a Roomba from a PC, which uses rs232 levels 2 www.irobot.com Appendix C — iRobot Roomba Open Interface (ROI) Specification iRobot® Roomba Open Interface (ROI) Specification Roomba Open Interface Modes Roomba Open Interface Commands The Roomba. .. users to control a Roomba through its external serial port (Mini-DIN connector) The ROI includes commands to control all of Roomba s actuators (motors, LEDs, and speaker) and also to request sensor data from all of Roomba s sensors Using the ROI, users can add functionality to the normal Roomba behavior or they can create completely new operating instructions for Roomba By default, Roomba communicates... Detector - Left 0, 1 1 0 – 255 Dirt Detector - Right 0, 1 1 0 – 255 Remote Opcode 0, 2 1 0 – 255 Code Charging State Buttons 0, 2 1 0 – 15 0 Not Charging Distance 0, 2 2* -3 2768 – 32767 mm 1 Charging Recovery Angle 0, 2 2* -3 2768 – 32767 mm 2 Charging Charging State 0, 3 1 0–5 3 Trickle Charging Voltage 0, 3 2* 0 – 65535 mV 4 Waiting Current 0, 3 2* -3 2768 – 32767 mA 5 Charging Error Temperature 0, 3 1 -1 28... converting note names to MIDI note numbers, 154 , 155 radius/velocity to left/right speeds, 94–96, 94–95 core MIDI, 164–166 cost of Processing, 134–135 costumes building, 372 RoomBud, 370, 371 CP2103 chip, 317 cpuinfo command, 320 createSong method, 156 , 160 Creative Instant webcam, 340, 340 cross-platform compatibility of Processing, 135 crystals, 152 153 CSMA/CA (carrier-sense multiple access with collision... external Mini-DIN connector on Roomba The Mini-DIN connector provides two way serial communication at TTL Levels as well as a Device Detect input line that can be used to wake Roomba from sleep The connector also provides an unregulated direct connection to Roomba s battery which users can use to power their ROI applications The connector is located in the rear right side of Roomba beneath a snap-away plastic... baudrate=19200, timeout=0.1) 6 ser.open() 7 5 4 3 2 1 Pin Name Vpwr Roomba battery + (unregulated) 2 Vpwr Roomba battery + (unregulated) 3 RXD 0 – 5V Serial input to Roomba 4 TXD 0 – 5V Serial output from Roomba 5 DD Device Detect input (active low) – used to wake up Roomba from sleep 6 GND Roomba battery ground 7 GND # pulse device-detect three times for i in range (3): ser.setRTS (0) time.sleep (0.25)... 89–92, 90–91 Roomba section for, 13 for sound, 153 154 MOTORS command bit operations in, 31 opcodes and data bytes for, 28 overview, 30 specification for, 420 mouse Bluetooth, 66 Roomba as, 190–193, 191, 193–194 moving in curves, 102–104, 103 specific distances, 100–101 multimeters, 388, 389 multiple programs, running, 297 music See also sound commands for, 32–33 instruments, 157 158 , 157 , 161–162, . outline. There’s no difference between the two representations. + 411 Appendix B — Electrical Diagram Schematics F IGURE B-7: Diodes: regular, LED, and photodiode Other Components The preceding sections. Detect to change Roomba s baud rate. After you have awakened Roomba (using Device Detect or by some other method) wait 2 seconds and then pulse the Device Detect low three times. Each pulse. shifter): ser = serial.Serial(0, baudrate=19200, timeout=0.1) ser.open() # wake up robot ser.setRTS (0) time.sleep (0.1) ser.setRTS (1) time.sleep (2) # pulse device-detect three times for i in range