Let's Make Robots!

A Tiny Bot

Lives on a table, reacts to light

This is my first attiny project after getting an led to blink. I guess it's a little ambitious - I hadn't even cracked the datasheet when I started. For my plan I needed to get PWM working, figure out how to take ADC readings, and figure out something to do with an extra pin. Here are the main parts I used (USB adapter thing for scale):

a tiny bot's parts

I've got a bunch of attiny85s, sockets, batteries, and battery holders. I only have the two pager motors (scavanged from misc. things), but I have an order in for some geared pager motors. I don't know if I have any more of the light sensors around either, but I can probably make due. I plan on making at least one more of these tiny bots!

I'm using an Arduino setup as an AVR ISP:

Arduino ISP

I ordered and assembled a programmer from AdaFruit. I didn't get around to testing it out until this morning though... and then OSX said it disabled it because "a device was drawing more power then it should"... even without the power jumper in! Oops! Well, The Arduino ISP works really well!

I did a bunch of reading, read a few chapters of the datasheet forward and backward. I made several tests, building up the pieces I needed - first getting PWM working with timer1, then getting readings from a sensor (and using PWM output on the motor to see the reading). Finally I breadboarded all the parts to see if I could get it all running:


(oops, can't see the MCU in that shot)

No surprise, but it turns out one CR2032 can't power the MCU, an LED, and both motors. Luckily its easy to add an extra power supply to just the motors - I just moved both positive leads to one trace, then connected a battery between that trace and ground. Here is something like the motor "driver" I'm using.

I also added an LED to my leftover pin (PB0). The only interesting thing that pin can do by itself is output PWM using timer0, so I decided to make the LED pulse to show that the MCU is running. I had some problems getting a fade though, all I could get was some flickering. I also had some problems getting both light sensors working... I think I should have tested them with an Arduino where I could have printed the readings to serial...

So I decided to freeform the whole robot around the dip socket. Freeforming is so open ended, I had some problems deciding how to route power and mount the motors. It turned out okay though.

steps 1step 2steps 3

Disaster! Even though I double checked and labeled the motors so when I wired them they turned the right way... So of course the left motor turns the wrong way! I also can't tell if the sensors are having an effect... I've run out of weekend though. Hopefully I can get things sorted during the week and get some video to post!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cool design

Very nice work on this one. I love the microbots and this one really is impressive for size and design....

Currious though,how did you mount the motors? did you glue them to a point ?

The motor mounting was the hardest part. I had no idea how I was going to do it when i started. Once I had the driver resistors mounted to the socket, and the transistors soldered to ground and glued to the resistor I figured they were sturdy enough to hold the motors. I also glued them to the electrical tape I used to insulate the sensor leads, nice flexible mounting! I thought about soldering a brace between both motors, but they didn't seem to need it. If I was doing it over I would definitely re-arrange things, mainly to make better connections though. I also want to try using some SMT parts too!

Most of the robot is held together by solder, everything else is held together by superglue... Except the bottom battery holder/skid (paperclip). I tried mounting the clip with superglue, but it didn't bond. Instead I had to use the new hot glue gun I got a while back. It was messy and hard to control, but it turned out really sturdy!

Nice things I didn't mention: The wire sticking out the middle-back is the common ground (common freeforming style). Under the plastic battery holder is a power switch (that connects the ground wires and batteries) that you can't really see in the photos. The batteries are mounted with negatives facing in, but the bottom is only connected to the motor positive, while the top feeds the MCU.

Nice going.


add a video if you can.


did you have any issues using the arduino to program it?

It's probably no revelation to anyone here, but work sucks...

Anyway, I managed to re-wire the backward motor last night. It wasn't nearly as painful as I expected. Now it runs forward! Actually they both run forward, at 100%, regardless of lighting, for the few seconds it takes to run the battery down. So yeah, gearmotors and Li-pos are probably a good plan. I was frustrated with this last night though, so I worked on a different project.

This morning while getting ready for work I had a few minutes to peek at my code. I found one obvious mistake (modified the address of the sensor rather than the return value), and after fixing it the motors don't move at all! Progress!

Now if I can just find an output between 100% and 0%...

I tested the new geared pager motors I got yesterday - They are really cool! I don't know if they are $15/pc. cool though...

Work pays for it all, and sometimes it's not all that bad, except when you don't have time to read this site.  :D

...your project is also inspiring me to start playing around with my avr's again...