After a long period of procrastination here is the follow-up to Part 1 of Obstacle avoidance with a PICAXE 08M.

This is a simple obstacle avoidance robot using a PICAXE 08M.  Basically the robot moves around powered by the SN754410 motor driver  and uses the Sharp  GP2D120 IR Distance Sensor to detect objects in front. In this post I cover the circuit and components used, so for a description of the operation and code please see part 1. It will make more sense then.

 

Picaxe 08M Robot

Disclaimer: You can tell from the wiring mess that this was put together without a plan. The following schematic was drawn well after construction so if you do use it for reference please check to avoid building a small smoke machine! If you spot an error please let me know.

 

Picaxe 08M with Motor Driver

The schematic is fairly basic and omits a bunch of components that would be used in higher power situations like EMF protection diodes.

In the first half “Picaxe Programmer, Logic, Power” the Picaxe chip is connected to a stereo socket via a couple of resistors. This forms the required programmer circuit for a Picaxe chip to connect to the Picaxe programmer cable. I added this to make it easy to plug the robot into the cable for lots of trial and error programming. A DPDT switch is included because it was the smallest one I could find and next to that ‘LED 5’ is used as a power indicator.

The motor driver requires two pins for direction control of each motor and since there aren’t many output pins on the Picaxe 08M a little trick is played to control the motors. Q1 & Q2 each form an inverter logic circuit so when Pin4 goes high MA1 is high and MA2 is low and vice versa, similarly for Pin2 and MB1, MB2. This gives direction control for both motors from just two pins on the Picaxe. To stop the motors and provide speed control both motors are enabled via the only PWM output pin on the 08M. From only three pins we now get full speed and direction control of both motors.

In the ‘Motor Driver’ circuit there is very little going on with a few LEDs included for dramatic effect. EMF protection diodes are not included as the GM10 motors draw little current. The datasheet for the SN754410 recommends protection diodes when operating closer to the maximum ratings but for this case it seems ok. C1 & C3 are little ceramic capacitors added to cut down on noise from the motors.

No doubt there are many better ways to design this circuit, so don’t take it as gospel!

Here’s the complete list of parts for reference: