During my microprocessor lab last spring I started programming a PIC 18F1220 for fun. I started with a bunch of small projects that I put together to make this autonomous robot. For this robot, I learned how use a digital ultrasonic range sensor and how to write my own software PWM (pulse width modulation). I decided not to use the hardware PWM because at my clock speed it would not output at the 50Hz necessary for servo motors. If I wanted to use the hardware PWM for servos, I’d have to sacrifice speed. The software PWM I created has 3 outputs, one for the servo that moves the sensor, and the other two for the drive motors. Currently the robot does not drive in a straight line. I’ve tried to fix this in software but the differences in the motors is not constant. I’m working on adding an encoder so the motors can be set the same.
Since the video below was shot, I’ve made some modifications to the code to improve it’s autonomous navigation.