First, credit due where credit is due. This project is inspired by the “Tiny Robot Family” by shlonkin. This is a fairly simple, low cost (~$10/unit) project that can be done in a weekend.

To build one robot with 2 obstacle detecting sensors I used these parts:

1 x Perfboard

1 x ATTiny85

1 x 8 pin socket

2 x NPN transistors (PN2222A)

2 x 22Ω resistors

2 x 10kΩ resistors

2 x Pager motors

2 x Photo transistors (ASDL-6620-C22)

2 x Infrared LEDs (VSLB3940)

1 x 2 pin header

many LR2032 rechargable batteries

Heat shrink tubing, various sizes

Hookup wire

I ordered most of the parts from Mouser, only the pager motors are from Electronic Goldmine. I got a 10 pack for $15. They ship really quickly and their packaging is on the more cautious side.

One of the problems I had to solve was adding “wheels” to the motors. What I ended up doing was gluing 2 beading beads onto the shaft and adding several layers of heat shrink tube till the “wheels” had a larger diameter than the motor’s body.

Next I cut the PCB to size. I did some test layouts with all components and figured I can fit everything onto an 8×8 grid. The additional cut outs are where the motors will be glued in at the end.

This is the schematic for the circuit:

You won’t be able to see the light emitted by the IR LEDs. You can set your phone into video mode tough and you will see if the LEDs are on. This can be helpful for some basic debugging. The LEDs are mounted directly above the photo transistor. To ensure that the transistors only get triggered by light reflecting off an obstacle I wrapped the photo transistors in heat shrink tube and only left a small opening in the front, additionally I recessed the LEDs a bit.

Here a view of the final layout from the top:

One of the things that were difficult to figure out was how to make the robot go in a straight line. Because it is basically impossible to glue the motors into 100% identical, mirrored positions I needed to figure out how to correct for the mounting error. Even though the motors are in fairly similar positions the robot would originally simply spin in circles. I ended up adding a “tail” to the back and bending it into a position that would make the robot go in a straight line. That worked surprisingly well. One thing to keep in mind when connecting the motors is that you need to make sure that they have inverse polarity. Otherwise one motor will spin forwards while the other one spins backwards.

To program the ATTiny85 I used the Sparkfun Pocket AVR Programmer and the Arduino IDE. You can view the code here. For now the robot basically just moves around and turns away from an obstacle when detecting one. I still got 2 unused IO pins and the design could potentially be extended to add sensors for detecting vertical dropoffs. I will keep working on the program and update the GIT repository. I like shlonkin’s idea to build several units with different sensors and have them communicate with each other. I still got motors to build 4 more robots and might look into that in the future.

The motors draw quite a bit of current. I only get a few minutes out of each battery. That’s why I recommend to go for rechargeable cells. I ordered one of those $1 coin cell chargers from Ebay but I’m still waiting for it to arrive. One mistake I did was to get cells without the mounting tabs attached. It’s impossible to solder a wire to the cell. What I ended up doing was to add a fair amount of solder to the end of the wire and sticking the cell and the wire into a piece of heat shrink tube. I tried to keep the wires really short which allows to plug the battery into the robot without using additional battery mounting hardware.

Here a short video of the robot in action:

