tape sensing
We decided to keep the tape sensing circuit as simple as possible and use it only for stopping when we hit the tape when moving towards the center of the board after the initial orientation. We therefore had the emitter part of the sensor emit a constant signal which would bounce off of the white board and be detected by the collector but would not reflect off of black tape. We found that 4V was the optimal center for the positive terminal of the comparator by experimentation with a potentiometer used as a voltage divider. The 20K R2 resistor is a pull-down resistor that ensures that the input to the comparator is not floating. We tested the performance of the basic circuit both by writing a test that printed whether the sensor was above tape or not and another test that drove the bot forward until it hit tape then stopped it. To check for tape, we just stored the previous output from the tape sensor circuit and determined that if the previous value was low and the current value was high then the bot was above tape.
Tape sensor circuit diagram