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
1,05 MB
Nội dung
372 Part III — More Complex Interfacing Roomba APIs and Applications The RoombaComm API you’ve worked with in this book’s projects is just one example of how to communicate with the Roomba, and not a very advanced one at that. You’ve seen from the microcontroller code and the various incarnations of “roombacmd” on Linux that any language can be used to build a Roomba controlling library. RoombaFX/Roomba Terminal http://sourceforge.net/projects/roombafx http://sourceforge.net/projects/roomba-term RoombaFX is a C# framework by Kevin Gabbert for Roomba interfacing. If you’re a Microsoft .NET user, then RoombaFX is for you. RoombaFX provides both high-level and low-level access to Roomba through well-designed C# objects. Build Your Own Costume If you’re handy with a needle and thread, you can build your own Roomba costume. Liz Goodman has posted a great step-by-step guide on Instructables about how to make a furry mouse costume out of fake fur and pink felt. The pattern shown can be assembled with a sewing machine or hand-stitched. Liz’s site is: http://www.instructables.com/id/ESYFHPW859EP286VS4/ The pattern is pretty simple and even if you have no sewing experience you can make it. You can also modify it to match some of the new algorithms and behaviors you’ve created from previous chapters. For example, make a bug costume. With pipe cleaners for anten- nae and shimmery insect-like fabric, it would be the perfect companion to the roach brain you created in Chapter 13. You could also use the myRoomBud costumes but design your own behaviors for your Roomba. Get the ladybug costume and have your Roomba flit around your houseplants. (A green filter in front a light sensor lets you detect plants just like NASA satellites do.) Another idea is to send the frog to the bug zapper on the porch at night to get dinner. For both of these ideas you would need to modify the Roach code from Chapter 13 to make it go toward light rather than away from it. If your bug zapper isn’t very bright, you could add a microphone and tune the code to listen for the zaps it makes. Alternatively, create a little butler outfit for it and put lights or remote control code emitters on the fridge. Program Roomba to go find the light or emitter to fetch you a drink from the fridge. A simple servo-driven gripper could be added to the top of the robot and controlled by a Basic Stamp or Arduino. 373 Chapter 16 — Other Projects Roomba Terminal is an application written in Visual Basic .NET. Also part of Roomba Terminal is Roomba Monitor, an application to display various Roomba statistics and serve as a tool to spy on the Roomba and run macros. Figure 16-9 shows the Roomba Terminal main screen, allowing you to drive Roomba and read its sensors. Figure 16-10 shows the Sensors screen of Roomba Terminal and some of the more advanced actions that can be performed. F IGURE 16-9: Roomba Terminal, using RoombaFX SCI Tester http://www.roombadevtools.com/productcart/pc/content_software.asp Also for Windows, RoombaDevTools.com has created a simple Roomba SCI tester applica- tion with Visual Basic 6 source code (see Figure 16-11). It’s called SCI Tester because it was created back when the ROI was called the SCI. It works with any of the Roomba interface products that RoombaDevTools sells, as well as the serial tether or Bluetooth adapter presented in Chapters 3 and 4. You can use the SCI Tester as an independent software verification of your interface hardware, if you’re unsure of code you write. 374 Part III — More Complex Interfacing F IGURE 16-10: Sensor handling with Roomba Terminal and RoombaFX If you program primarily on Windows, Visual Basic is a great way to create Windows programs quickly. You can create buttons, controls, and windows with code not much more complex than PBASIC. Check out the source code to the SCI Tester to see how easy it is to make a Windows program with it. You’ll find that the source doesn’t try to be a complex Roomba API, but is rather more like the roombacmd tools you created in Chapters 14 and 15. Microsoft Visual Studio, the program you use to create Visual Basic programs, normally costs several hundred dollars, but Microsoft has recently released an Express version for free that can create simple programs. F IGURE 16-11: SCI Tester running 375 Chapter 16 — Other Projects Warranty-Voiding Hacks This book has purposefully steered away from projects that definitely void the warranty of your Roomba. Interfacing through the ROI probably doesn’t void the warranty, but the following hacks definitely do. If the following hacks interest you, you should get a second Roomba to do them on. These hacks can destroy a Roomba, and you don’t want to take your nice, expensive Roomba and void its warranty. You can find older used Roomba models on eBay. And factory-refurbished ones with a significant discount can be found on Amazon.com and other retailers on the Internet. Line-Following Roomba http://www.northridgerepair.com/plog/ Ben Miller discovered a way to turn the four cliff sensors on the front of Roomba into line sen- sors. He found that by placing a calibrated resistance across the photodiode of a cliff sensor, he could make the cliff sensor differentiate between carpet and black tape. Figure 16-12 shows the essence of his hack. The resistors are attached across the photodiode part of the cliff sensor and can be made reversible so you get normal functionality back. Each sensor has to be calibrated by tuning the variable resistor until it triggers when it passes over the tape. Then, by programming the robot through the ROI (Ben used a Basic Stamp), you can poll the cliff sensors and watch for when Roomba crosses the black line. F IGURE 16-12: Schematic of added components to each cliff sensor Vacuum Motor Connector Hacking The vacuum motor of Roomba exists in the removable dustbin. This means power must be routed to that motor and if you remove the dustbin and look at the right side of Roomba, you’ll notice two electrical connectors (see Figure 16-13). This connector provides power directly from the Roomba battery but switched through the vacuum motor bit in the ROI MOTORS Sensor photodiode 100 100 Original Roomba circuitry Added circuitry 376 Part III — More Complex Interfacing command. The connector is even labeled plus/minus so you know the voltage polarity. Any manner of device that can be powered off +16 VDC can be hooked up to this port and switched on and off under software control. The vacuum motor draws a few hundred milliamps, so you can draw at least that much current from the port. F IGURE 16-13: Vacuum motor connector, a powered output port Battery Upgrading http://www.roombareview.com/hack/battery.shtml If you have a Roomba battery pack that stops working for some reason, normally you’d be resigned to getting a new one. However, you also could fix it and upgrade it. Originally docu- mented by Craig Capizzi of RoombaReview.com, the battery pack is a simple linear array of 12 sub-C sized NiMh cells. The screws on the battery pack have strange triangular heads, but a Torx T6 seems to work okay too. The top of the pack is tacked down with glue but other- wise isn’t too hard to take apart. Figure 16-14 shows what the battery pack looks like with the top off. 377 Chapter 16 — Other Projects F IGURE 16-14: Battery pack partially apart Once you pull the cells out of the plastic holder, you can see that they’re all connected in a line (see Figure 16-15). There are several online battery retailers, but you may have the best luck with hobby stores. High-performance RC cars use 7.2V battery packs, which are just six of these sub-C cells in a series. The RC cars need enormous amounts of current, so you can easily find cells with a 3800 mAh rating. F IGURE 16-15: Battery pack internals spread out 378 Part III — More Complex Interfacing There are two mystery parts inside the battery pack. The first is a little flat rectangle connected in series with the cells. This is a positive temperature coefficient (PTC) resistor that acts as a sort of resettable fuse. If a short happens across the battery terminals, the cells heat up as they dump current. This heats the PTC resistor, increasing its resistance and limiting the current output. It’s a great failsafe device. The other mystery part is the temperature sensor, usually located in the middle of the pack. In Figure 16-15 it’s the small black protuberance in the center. Watch out! Even apparently discharged battery packs can contain a lot of charge and cause a nasty shock. The Roomba battery pack is designed to prevent rapid discharge, but if you start taking it apart you’ll bypass that feature. Be careful. Remote Control Hacking The remote control that comes with Roomba is a standard circuit internally, but outputs custom infrared remote codes. You can use a learning universal remote to record the Roomba remote’s commands and then take apart the remote and use it as another way of computer-controlling the robot. Figure 16-16 shows what the remote looks like taken apart. Each button circuit con- sists of two circuit traces interleaved and a rubber button containing a conductive coating on its bottom surface. When the button is pressed, the conductive coating makes the connection between the two interleaved traces. F IGURE 16-16: Roomba remote taken apart 379 Chapter 16 — Other Projects To hack this, find alternative ways of making that connection. One way is to bridge the con- nection electrically. Soldering wires to the interleaved traces is difficult because of the coating used, but there are metal test points on the traces that wires can be soldered to. Figure 16-17 shows wires soldered to the two traces that make up the Forward button. When you have these wires, you can run them out to an external circuit. You could hook them to a relay and control the relay with a computer’s parallel port or microcontroller circuit. Repeat with the other but- tons and you have a rudimentary way to remotely control the Roomba, albeit without sensors. F IGURE 16-17: Soldering wires across the Forward button If you’ve replaced the brain of your Roomba and made it autonomous, then the remote codes become just another sensor input and the remote control becomes a low-cost unidirectional communication mechanism. If you have two Roomba robots, you could have one emit remote commands to the other, thereby creating a way for the two to talk to each other. Virtual Wall Hacking Like the remote control, the Virtual Wall is a standard IR remote transmitter outputting a custom code. Unlike the remote, it only outputs a single code, which you can read with the vir- tual sensor byte. Figure 16-18 shows the virtual wall taken apart. There’s a lot of unused space available for sticking in additional circuitry. The virtual wall has a directional IR transmitter on its front and what looks like the same hyperbolic lens and IR receiver the Roomba has on its top. It may also be a transmitter however, transmitting different codes. 380 Part III — More Complex Interfacing F IGURE 16-18: Virtual Wall taken apart, not much there To just tell if the lens on top is for a transmitter or receiver, the easiest way is to point a digital camera at it and see if it lights up. The near-infrared used by remote control IR transmitters are invisible to the human eye but visible to electronic sensors. Figure 16-19 shows a virtual wall turned on. You can see light from the directional emitter on the front yet nothing from the lens on the top. The lens on top is likely only used by the Scheduler variant of Roomba to program when virtual walls are turned on and off. Having a nicely machined powered enclosure with both an IR receiver and transmitter is a great hacker toy. You could uninstall and entirely replace the virtual wall circuitry with some- thing that responds to arbitrary remote control codes and emits Roomba remote control codes. Or take advantage of the directionality of the emitter and mount the virtual wall unit on Roomba like a gun and have laser tag battles between Roombas. If you’re concerned about power, there are chips by Maxim and others can convert the 2–3V from batteries into regulated 5 VDC. 381 Chapter 16 — Other Projects F IGURE 16-19: Checking which parts are emitters and receivers Summary Roomba owners have done a dizzying number of things with their Roombas. This list of exist- ing hacks in this chapter is far from complete, and new ones are being created all the time. From the projects in the book and the ones on the Net, you may wonder if there’s anything new to do with Roomba. However, any programmable system is infinitely deep in terms of what can be done with it. The Roomba, because of its extensibility, is even more so. Hacks using multiple Roombas or alternative sensors have barely been attempted. The ROI protocol that allows so many of these projects has only been available for a short time. The projects peo- ple have accomplished so far have focused mainly on just getting that to work. Now that low- level communication has been established, it’s time to start doing some really innovative things. Roomba is a great low-cost platform for robotics exploration. What was once available to only academics is now for sale in every department store. Try out some of these hacks, invent some new ones, and let others know by posting your findings on one of the web sites mentioned in this chapter. [...]... close to the board with the cutters close, as in Figure A -1 4 FIGURE A -1 4: Testing continuity with multimeter Making Connections Using these prototyping boards means running wires between parts yourself The snipped-off portion of the leads make great jumpers, as shown in Figures A-15 and A-16 Using the needlenose pliers, bend one of the leads into a U-shape to match the distance you need it to cover Poke... iron, Jameco part number 170587 Ⅲ Soldering iron holder, Jameco part number 192153 Ⅲ Solder, lead 0.031˝, 60/40, rosin flux core, Jameco part number 141 795 in this appendix Basic tools you need Safety considerations Soldering components Soldering wires Static safety 384 Appendix A — Soldering and Safety Basics Ⅲ Third-hand tool, Jameco part number 26690 Ⅲ Diagonal cutters, Jameco part number 146 712 Ⅲ Needle... FIGURE A-6: How much solder to use Placing the Component Figure A-7 shows a new component being placed on a board To start out, clamp the board down in the third-hand tool to stabilize it; then insert the component When inserted, splay its leads out to hold the part in If the part leads are too short to do this, you can hold the part from the bottom with a finger Applying Solder As in Figure A-8, with... pair Figure A-4 shows both cutters and pliers They last a long time The ones in the figure are over a decade old FIGURE A-4: Diagonal cutters and needle-nose pliers Digital Multimeter A digital multimeter is a Star Trek tricorder in many ways It can measure DC and AC voltage and current, resistance, capacitance, and frequency It can also test diodes or transistors Figure A-5 shows a 20-year-old digital... number 26690 Ⅲ Diagonal cutters, Jameco part number 146 712 Ⅲ Needle nose pliers, Jameco part number 217891 Ⅲ Digital Multimeter, Jameco part number 220767 Ⅲ Desoldering braid, 0.075˝, Jameco part number 124118 Ⅲ Hookup wire, 22 gauge, 100 ft, Jameco part number 36792 Ⅲ Heat-shrink tubing, 0.12˝ diameter, 10 ft, Jameco part number 184721 The total cost of these items is a little over $100, and with them... A-11) Desoldering braid works by creating a metallic surface that solder likes even better than your part It’s a fine mesh of copper that has a very high surface area Since solder likes to cover metallic surfaces, applying desolder wick is almost like sucking the solder off a part FIGURE A-11: Desoldering braid Figure A-12 shows how to apply the desoldering wick to the bad solder joint in Figure A-10... large assortment of helping-hand or third-hand tools that can assist you Figure A-3 shows one type that has two spring-loaded alligator clips on arms and a magnifying glass (which no one seems to use) The alligator clips can be abrasive on boards and wires so to make them a bit gentler, slide small bits of rubber tubing (such as heat-shrink tubing) on each jaw of the clips FIGURE A-3: Helping hands 387... first tin each part with a thin layer of solder Tinning is the process of applying a thin layer of solder to a metal part The part turns silver colored where the solder has been applied but otherwise shouldn’t look different than before That is, it shouldn’t be blobby with solder Solder naturally likes flowing along metal, so tinning parts isn’t very hard Many components already come pre-tinned to make... Safety Basics Cutters and Pliers A good pair of diagonal cutters (or flush-cut cutters) is essential to trimming part leads The diagonal part means the cutting edges are at an angle to the handles, enabling you to more easily make a flush cut A decent pair of diagonal cutters is about $6 Needle-nose pliers are useful for placing parts, bending component leads, holding leads while soldering, and basically... the part in the middle, bring the solder and soldering iron together quickly When the solder melts, it will naturally try to go onto the soldering iron By putting the part in between, you’ll get the solder onto the part Be sure to be close to the board so the melting solder touches the board’s copper pad too The result will look like Figure A-9 Add just enough solder so it appears to crawl up the part . It doesn’t cover the more complex techniques like soldering printed-circuit boards or surface-mount devices, although the techniques presented here can carry over to them. When you feel like you. sensor, he could make the cliff sensor differentiate between carpet and black tape. Figure 1 6-1 2 shows the essence of his hack. The resistors are attached across the photodiode part of the cliff sensor. you pull the cells out of the plastic holder, you can see that they’re all connected in a line (see Figure 1 6-1 5). There are several online battery retailers, but you may have the best luck with