Page 199 - Amphibionics : Build Your Own Biologically Inspired Robot
P. 199

Amphibionics 05  3/24/03  8:44 AM  Page 178
                                                       Amphibionics
                                          cating that no object was sensed and 1 indicating that an object is
                                          present. These values will be stored in the variable object_detect.
                                          When the program execution is returned back to the main pro-
                                          gram, certain decisions can easily be made, based on this infor-
                                          mation.
                                          The infrared subroutine takes 40 samples from the module and
                                          counts the number of positive hits received. The number of sam-
                                          ples  taken  can  also  be  configured  by  changing  the  variable
                                          num_samples.  Because  of  stray  infrared  and  signals  from  the
                                          environment,  the  module  is  constantly  producing  false  positive
                                          signals  that  are  referred  to  as  “noise.”  The  average  acceptable
                                          amount of noise picked up by the sensor module is called the noise
                                          floor. The routine needs to set a threshold point above the typical
                                          amount of noise and report a sensed object only if the number of
                                          positive signals received throughout the number of samples taken
                                          exceeds the noise floor.

                                          With the PNA4602M sensor modules, I found that the typical false
                                          positive was actually very low—five for every 40 samples taken. To
                                          be on the safe side, the threshold is set at 25 for every 40 samples,
                                          to  ensure  that  an  object  is  present.  By  changing  the  threshold
                                          value,  you  can  change  the  sensitivity  and  distance  detection
                                          response of the module. If you want a more accurate reading, the
                                          num_samples value can be increased, but will take more time for
                                          the routine to execute.
                                          The last option is using the mode select push button to invoke the
                                          infrared  sensor  calibration  routine.  This  will  enable  the  user  to
                                          simply push the button on the robot’s head to calibrate the sensor,
                                          as described earlier. The experimenter can also develop a software
                                          routine to use the push button to choose different modes of behav-
                                          ior  when  the  robot  starts  up.  When  the  main  software  routine
                                          senses that the button has been pushed, it goes into a tight loop
                                          until it senses that the switch has been let up before going to the


                      178
   194   195   196   197   198   199   200   201   202   203   204