Specifications
64
6.4 Not Driving in a Straight Line
If the robot is moving but fails to drive in a straight line it is most likely caused by a
fault in the odometer sensors. To check these, connect the serial port to a computer and
run a monitoring program such as OC Console. Connect a voltage to one of the motors
to make it spin. As the motor spins, either the character ‘A’ or ‘B’ should be repeated
on the screen. (‘A’ for motor A; ‘B’ for motor B). This character is sent to the screen
for every half turn of the motor armature. If these characters are not being sent to the
screen, either the IR LED, receiver or microcontroller interrupt is failing. Check the
voltage coming from the receiver. The receiver output should read 5 volts until the hole
in the motor shaft is aligned, when it should drop to approximately 0 volts. If this is
occurring and the character is still not being written to the screen disconnect the wire
from port G and apply a voltage edge (5 volts down to 0) directly onto the port G pin. If
this does not send a character to the screen the problem lies within the software. Check
the INITKWG and KWGISR subroutines.
6.5 Stopping for Objects but Irregular Behaviour
If the robot is not behaving as explained in any of the above sections, the problem is
most likely within the software. During construction sometimes changing hardware
required different properties in the code. For instance if the source used to drive the
motors was changed from 10 volts up to 12 volts, the number of odometer counts
required for a 90 degree turn was altered slightly. Due to the greater inertia of the motor
spinning faster, the wheel would continue to turn longer after the power was cut.
Generally, all of the driving subroutines can be operated separately. If major debugging
is needed, it is possible to comment out the ‘BACKUP’ and ‘TURNR’ subroutines
along with the branch instruction in ‘TURNL’. This will then make the robot behave
the same for every circumstance. Every time an object is detected the robot will turn
left. Evidently this is impractical however it provides a good base to start adding
additional code without worrying about all of the loops that are involved with the
driving sequence. The ‘TURNR’ can then be implemented after the turning left
sequence is working correctly, followed by the ‘BACKUP’ subroutine until the
complete driving sequence is functioning correctly.










