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

cell receives more light than the other. If each CdS cell receives too
                                       much light or the bump switch is activated, the robot goes into
                                       avoid mode.
                                       Power
                                       Six-volt electrical power for the robot is supplied by a battery pack of
                                       four AA batteries. While I used this power supply for testing robot
                                       function, I suspect the batteries may wear out quickly.

                               Program

                                       The program flowchart is shown in Fig. 8.17. Upon power-up, the
                                       drive motor is off and the microcontroller begins scanning for the
                                       brightest light source using the servo motor. If a light source is
                                       too bright, the robot jumps into avoid mode. In avoid mode the
                                       robot backs away from the light source by reversing the drive
                                       motor while steering the drive wheel left or right. If the light isn’t
                                       bright enough to activate the avoid mode, the robot steers in the di-
                                       rection  of  the  light  and  activates  the  drive  wheel  forward.  If  the
                                       bumper switch is activated, the robot assumes it has hit an obstacle
                                       and the robot goes into avoid mode. But if the tilt switch is not acti-
                                       vated (no collision), the program jumps to the beginning and the
                                       process continues scanning and moving to the brightest light source.  183
                                       The program is written for the PICBASIC compiler that is directly
                                       programmed into a PIC16F84. The program should be able to be
                                       compiled and run with little or no modification on the PICBASIC Pro



                                                                       Scan
                                                                    Find light
                                                                    source & move
                                                                    toward light
                                              Avoid:
                                              Reverse
                                              motor

                                              Adjust        Yes      Is light too right?
                                              steering
                                              1 second
                                                                          No


                                                           Yes                        No
                                                                      Hit obstacle?
                                         8.17 Program flowchart


                                                       Team LRN
                                                   Behavioral-based robotics, neural networks, nervous nets, and subsumption architecture
   199   200   201   202   203   204   205   206   207   208   209