Some time ago I put together a little LEGO rover and added a PICAXE motor control board. A little bit of programming goes a long way and although the motors are slightly different speeds, this thing wanders around quite happily.
Two large lever-arm microswitches take care of sensing obstructions. If it hits these, the rover is programmed to reverse and turn away. The overall effect is quite effective for such simple programming. I also modified a 2×2 brick with a 220Ω resistor and a green superflux LED. By drilling out the internal pillar, there’s enough space to hide the superflux LED inside with its resistor. I then connected it to one of the MOSFET outputs connected to output 0. I’ve also put a 2×2 clear brick on top and this is great for spreading the light out.
The overall power supply is 6x AA Alkaline cells. I will eventually change these for NiMH but they’re in use around the house somewhere. Once the volt-drop through the L293 integrated circuits have been taken into account, it’s about the right voltage for powering the 4.5v LEGO motors.
The simple algorithm for this rover is:
start: go forwards if left sensor touched, then stop, flash the LED, reverse and then rotate right if right sensor touched, then stop, flash the LED, reverse and then rotate left go to start