Page 292 - Hacking Roomba
P. 292

Chapter 13 — Giving Roomba a New Brain and Senses                    273



                             Making a Robot Roach

                             The many competing behavioral drives of a subsumption architecture robot are discussed in
                             Chapter 1. The BumpTurn program already exhibits a few simple behaviors, but why not add
                             an appropriate behavior in honor of the bugs that inspired the subsumption architecture idea?
                             Most insects are sensitive to light in some way.The moth flies toward light, while the cockroach
                             runs from it. Since Roomba can’t fly (yet), maybe it can be made to act more like a roach. Having
                             a robot that runs away from bright lights and scurries to the dimmest corner of the room is not
                             only a great example of real working artificial intelligence, but is also comical to watch.

                             Figure 13-10 shows the schematic of an updated Roomba BS2 interface. The additions are
                             photocells. Photocells are light sensitive resistors. Standard cheap photocells (even available at
                             Radio Shack), range from 50 Ohms in very bright light to 500 kOhms in darkness. These val-
                             ues vary greatly and are not calibrated. But with such a wide dynamic range, it’s at least easy to
                             tell bright from dark. Figure 13-11 shows the circuit implemented on the Board of Education.
                             Notice how each photocell is pointing in a different direction. The one pointing toward the
                             RS-232 port will be the front sensor and the other the back sensor. With two sensors you can
                             tell which direction the bright light is coming from.


                                                                           Vin
                                                        1               24
                                                           SOUT    VIN
                                                        2               23
                                                           SIN     VSS
                                                        3               22
                                                           ATN     RES
                                                        4               21
                                                           GND    VDD
                                                        5               20  Vss
                                       R5               6  P0      P15  19
                                       220        R4    7  P1      P14  18
                                                           P2
                                                                   P13
                                                  220   8  P3      P12  17
                                                        9               16
                                                           P4      P11
                                                       10               15
                                                           P5      P10  14
                                  Photocell R2  0.1  Photocell R3  0.1  R1  12  P6  P9  13  8  mini-din 8pin
                                                       11
                                            C1
                                   C2
                                                                    P8
                                                           P7
                                                    220
                                             µF
                                    µF
                                                   LED1                           DD  Vss  7 6 5
                                                                                 TXD
                                                                                          4
                                                                                 RXD      3
                                  Vss      Vss  Vss                                       2
                                                                        Vin   +16VDC      1
                                                                                               X1
                             FIGURE 13-10: Adding light sensors for the RoombaRoach
                             Figure 13-12 shows the Board of Education plugged into Roomba and positioned correctly for
                             the front and back orientation of the photocells. To anchor the Board of Education and keep it
                             from sliding around, you can attach a little bit of Velcro between the Board of Education and
                             Roomba.
   287   288   289   290   291   292   293   294   295   296   297