Boe-Bot Final Report
Project Requirements:
The a robotic device that would perform a given task. The choice of task was left open ended with the only stipulations being that five components (LEDs, Piezoelectric speaker, Servos, Photo-resistors, and an IR system) must somehow be incorporated into the design. To this end, I propsed to construct a mobile robot that would traverse an obstacle course/maze and successfully find the exit. Additional details, concerning system logistics, can be found in the project proposal.
Project Development:
The scheduling of the poject was set up in a Gantt chart that divided the the construction period into five separate phases. An optimization phase was scheduled at the end of construction to fine tune all components. The final phase consisted of scheduling time to document and present the overall project.
Testing and Evalutation:
The first circuit set to be constructed the IR system for obvious reasons. Without a properly funtioning detection system, object avoidance and boundary detection would be impossible. Thus, unless the Boe-Bot was positioned initially at the exit, it would have little to no chance of successfully traversing the course.
Starting simple, the initial IR circuit and code was completed in little time. The IR system was evaluted to ensure that it could detect objects immediately in front of the IR sensors. To allow for some peripheral "vision" the IR LEDs were positioned outward to account for the width of the wheel base and avoid the wheels running into sharp corners. One intial problem noted was the dominance of the right servo over the left. This was a concern not for any programming related issues, but mainly for aesthetic purposes. Amazingly, the servos still had dominance issues even after manually centering the servo motors (see page 66 of the Robotics with the Boe-Bot manual).
Origianlly successive if then statements were to be used to determine which direction that Boe-Bot would turn in respose to its environment. It was suggested by Will Baumeister that a Branch statment would be a more elegant alternative. Not only would it provide a more concise manner in which to represent the if then statements, but it would also provide more rapid program progression since the processor could skip immediately to the paricular state it observed. The four possible states chosen for the IR system were in effect: all clear, object detected on the left, object detected on the right, object detected on both the left and right.
For each possibility a given subroutine was written that facilitate proper navigation throught the course. However, one major problem that was not initially solved was the "corner problem". It was observed that whenever the Boe-Bot encountered a corner it would successfully backup to avoid the object and then immediatley get out of range of the IR detectors and proceed forward again. In the end I decided to allow the Boe-Bot to "choose" the most optimal direction to turn rather than generating a default turning direction. This was incorporated mainly to reduce the amount of time needed to get out of a 3-walled room.
The incorporation of a speaker in this circuit was utilized to let the human bystander know that the Boe-Bot had encountered an object and that it was set to back away from the object. The dump truck and other large vehicles was my inspiration for the back-up speaker
The second main circuit to be constructed was the photo-resistor system. Rather than attmept to incorporate the IR and photo-reistor code immediately I decided to develop the photo-resistor circuit independently to make sure that all the components worked properly. Unlike the IR circuit which was set up mainly to avoid objects the singluar goal of the photo-resistor system was to detect light. Initially I set up the servo output code to match that of the IR servo code (with the only difference being that the Boe-Bot would turn right if it detected light from the right and vice-versa. However, this code was not suitable because it merely caused the Boe-Bot to rotate back and forth in place. The end result was that it went nowhere. Evidently, the sensitivity of the photo-resistors was so great that the slightest deflection in light would be picked up and cause the Boe-Bot to shift back to achieve optimal illumination. Thus a FOR loop was implemeted so that some forward progress would be made each time the an individual photo-resistor detected light.
After verifying this my next task was to integrate the two subroutines into the mainloop. In order to avoid fighting between the two methods, in the case that the photoresistors detected light, but an object was in the way, I gave precedence to the IR navigation method. I chose this because if the Boe-Bot ran into something and damaged itself then it would never get out the maze in the first place, no matter how much light it could detect. The remaining to circuit (LED) serves only visual purposes and was relativley simple to implement in the existing circuit.
Optimization:
The IR frequencies chosen for IR detection were reduced from those recommended in the text. It was obseved that the given 38.5 kHz frequency was able to detect objects more than a foot away. The main reason I chose to abandon this frequency was my fear that the IR subroutine would never allow the photo-resistors a chance to detect any signal from the chosen light source, particulary if the light was close to an object. Also the limiations in table space and materials presented other reasons for using a less sensitive frequency. To determine which frequency to use, I measured the maximum distance detected. I also used various combinations of resistor values to further augment optimal distance selection. I found that 40.5 kHz was "optimal" for the course I would be using. After testing it was found that 40.5 kHz yielded the maximum allowable light searching distance wihtout hitting any objects.
Additional testing of the completed circuit demonstrated that the origianl servo pulsout values did not allow sufficient time for the photo-resistors to detect the Christmas and make a navigational correction. Thus, the pulsout periods for the left and right servo were lessened in the IRForward subroutine. It was also discovered that the original counter values given to the FOR loops for the left and right turns in the photo-reisistor navigation method were too long and caused the Boe-Bot to overshoot the light string. Thus, these were lessened as well.
Finally, it was observed that the program orinally written to follow a string of lights to a larger exit light was sufficiently sensitive and robust to detect the larger exit light alone, without any assistance from string of lights. Thus, I feel that if desired the string of lights may or may not be necessary to find the exit.
Final Design and Contrast:
The final design consists of a mobile robot that will tranverse an obstable course using the IR system to avoid walls and other various objects. The photo-resistors will be used to determine the true exit from the maze/course. This will be possible as the true exit be illuminated via light from a flashlight or similar device. A string of lights may also be incorporated to assist in the discovery of the exit. A speaker will be used in two separate instances: 1. To alert a human user that both sensors have detected an object and that the Boe-Bot will reverse direction momentarily and 2. the speaker will emit a tone when it feels it has detected the exit. The craft should stop just short of the more instense exit light. Finally, the LEDs will be used in conjunction with the speaker to notify the user that the exit has been reached.
There is no significant deviation from the intial proposal to the final design. Again the only major alteration (elimination of the light string) is optional. In the event that the Boe-Bot fails to sucessfully detect the light string in the intial presentation, the obstacle course may be re-run with only the exit light.