Build, learn and share robotics.
New to this site? Get started here to share your creation

This little palm sized robot drives around and tries to avoid things. I made this to see what can be done with little Solarbotics motors and the limited pins on the PICAXE 08M chip but didn't plan ahead so ended up with a lot of crazy soldering.

This project started with the tiny Solarbotics GM10 motors that just needed to be used for something. I figured it had to be small so I went for a basic bot that used just a PICAXE 08M chip for logic and a SN754410 motor driver.

The 08M only has about 256 bytes of code space which is about 220 lines of Basic at most. That doesn't seem like much but the PICAXE chips already have firmware to support a bunch of stuff like servos, I2C and more. Still, it was a bit of a challenge to get some decent behaviour out of a little chip.

An infrared sensor was added so the bot could see things to avoid and some LED's show the direction of the motors. That lead to a soldering mess :(


No prizes for appearance here! A piece of perf board was used for the chassis cut to size with a hack saw.  On top I added a SN754410 motor driver chip and a PICAXE 08M using dip sockets so they could be replaced if need be. The SN754410 datasheet recommend EMF protection diodes but it's cheap anyway so I have skipped those.

A stereo socket and supporting resisters where added so the PICAXE chip could be reprogrammed in situ and a power switch added on the other side because pulling batteries out is a pain.

At the front is a Sharp GP2D120 infrared sensor which has a range of 4-30cm. It has a 10uf electrolytic capacitor soldered between the power and ground lines as this helps stabilise the voltage. Sharp recommend that somewhere.

Green and red LEDs are on both sides, wired to the motor connections with current limiting resistors in line. Because they are diodes they will only light up when the power is the right polarity making it easy to show direction. Joining to the motor connections also makes the LEDs shine in proportion to the motor power.

Also on the top are some transistors to do some sneaky tricks to get forward and reverse motor control from the 08M, some motor noise suppression caps and the half the batteries.

All the electronic components where soldered in first then the big bits where added.

It's all held together with gooey glue goo. Bostick hot glue - my favourite.

Underneath it gets messy. I jammed another two AAA batteries, a ball caster and hot glued the motors in place. It got quite confusing trying to ensure the circuit was correct.

The Wiring

This schematic was drawn after the robot was built so it may be a little wrong. It also explains why soldering little jumper wires everywhere became a bigger mess than I though. Click for a bigger view.

"PICAXE Programmer, Logic, Power"

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.

The stereo socket is wired up to enable the PICAXE 08M to be programmed on the board.

"Motor Driver"

Two LEDs are use for each motor. When the current switches direction the appropriate LED will light up because they are diodes. C1 & C3 are used to suppress motor noise.

The Code

The code for the robot is just a simple state machine implemented as a if-else and switch-case construct. I've attached the code as a file.

The code reads the value from the Sharp sensor using the readadc function then determines what should happen based on the value. It will either go forward, veer left or right or go backwards.

Sometimes the robot would get stuck or caught on something. A counter is used that is reset when the robot does something like change direction. If nothing has happened for a while the counter will trigger the "get out of trouble" manoeuvre involving some full power reverse and wiggling.

Parts Used

Here’s the complete list of parts for reference: