Page 203 - Robots Androids and Animatrons : 12 Incredible Projects You Can Build
P. 203

a robot with two processors that operate in tandem (distributed
                                processing).
                                I will assign the targeting of the light source and bumper switch
                                detection to one microcontroller, called microcontroller 1. Con-
                                trolling the steering and drive motor will be assigned to the second
                                microcontroller,  called  microcontroller  2.  To  make  this  scheme
                                work, it is necessary to have the microcontrollers communicate with
                                one another. However, bidirectional communication isn’t required;
                                we will have one microcontroller talk and the other one listen.

                                Microcontroller  1 Microcontroller  1  will  handle  reading  the  CdS
                                cells and bumper switch detection. It will communicate to micro-
                                controller 2 using three I/O lines.
                                  I/O line 1 will communicate the status of CdS 1. If light falling
                                   on CdS 1 is brighter than light falling on CdS 2, then bring the
                                   line low. If equal, bring the line high.
                                  I/O line 2 will communicate the status of CdS 2. If light falling
                                   on CdS 2 is brighter than light falling on CdS 1, then bring the
                                   I/O line low. If equal, bring the line high.
                                  I/O line 3 will communicate either the status of the bumper
                                   switch or that the CdS cells are receiving too much light. In
           182                     either case this will bring line 3 high.

                                Microcontroller  2 Microcontroller  2  will  check  the  status  of  the
                                three I/O lines and, based on the status, it will steer and move the
                                robot as follows:


                                  CdS 1       CdS 2    Tilt switch
                                 Line 1      Line 2      Line 3             Results
                                    0           0           0        Sleep mode, not moving
                                    1           1           0        Move forward
                                    1           0           0        Steer right, move forward
                                    0           1           0        Steer left, move forward
                                    X           X           1        Avoid mode
                                X   don’t care.

                                Accordingly, lines 1 and 2 represent the two CdS cells and line 3,
                                the status of the bump switch.
                                Adding sleep mode
                                I added a sleep mode for when the ambient light is very low. The
                                robot moves forward when both CdS sensors receive approximately
                                the same light intensity. The robot steers right or left when one CdS


                                                       Team LRN
            Chapter eight
   198   199   200   201   202   203   204   205   206   207   208