Since I had a lot of ATtiny2313s lying around I wanted to do something cool with them, I thought for a while and then decided to make a simple wall avoiding robot with the ATtiny2313, an ultrasonic sensor and 2 motors.

Its an easy to make and simple robot which runs on a very small amount of code so as to support and work with the ATtiny2313.

For those of you out there who want to make a small robot with the Arduino processing, but you are not able to as the Arduino is too big for a small robot, then this is the perfect robot for you!

Since the ATtiny2313 chip is much smaller compared to the Arduino, it fits in almost anywhere, which allows you to make a small simple robot which evades walls.


Note: This is by no means related to the Star Wars charecter R2-D2, its just my own robot :)

Step 1: Materials/Tools Required

Picture of Materials/Tools Required
Materials Needed;
  1. ATtiny2313
  2. Arduino (For programming the ATtiny2313)
  3. 2 Motors (Gear or normal, both seem to work for me)
  4. 2 NPN Transistors
  5. 2 10MicroFarad Capacitors
  6. 1 5V Voltage Regulator
  7. 2 9V batteries (Of 250~330mA current capacity each)
  8. 1 Ultrasonic Range Finder
  9. A piece of Protoboard
  10. A few headers (Male)
  11. 2 Wheels for the motors or some bottle caps might work
  12. 1 Wheel which is attached to an axis (For attaching it on the back of the robot to give it support)
  13. A few jumper cables or just some plain wire
  14. An ATtiny2313 Programming shield (Optional)(http://www.instructables.com/id/Arduino-ATtiny2313-Programming-Shield/)
  15. 2 9V battery cases or connectors.
  16. A switch

Tools Needed;
  1. Soldering Iron
  2. Solder
  3. Soldering Flux
  4. Glue Gun
  5. Small cutting knife
  6. Scissors

1-40 of 54Next »
Mic1002 days ago


I made it with Wall-E with a plastic toy, it works with two 3 Volt motors, one 9Volts battery for the ATtiny2313 and one 3,7 Volts battery for the motors, it can also back because I added an H-bridge-type L9110, I added 2 RGB LEDs for eyes,

green when it move forware, red when it turns left and blue when it move bakware.

Sketch uses 1,992 bytes (97%) of program storage space. Maximum is 2,048 bytes.

Global variables use 45 bytes (35%) of dynamic memory, leaving 83 bytes for local variables. Maximum is 128 bytes.

Thank You again

my instructable comming soon !

Mic1002 months ago

Good Job Thank You :)

I made a small ATTINY13A soicavec with a led infraeouge to avoid obstacles you can see a video at the end of this instructable:


can you please send me the library for mac

Maki_mx1 year ago

Thanks for clarifiying the connections :), yet the object I am triying to figure out is the one after the voltage regulator. Is it another button?

vishalapr (author)  Maki_mx1 year ago

Yes its a switch :D!

Maki_mx1 year ago


I am having a very hard time matching the information with the actual schematic. Any tip? Is it right? (I really dont mean to be disrespectful)

Another question: What objet it is from left to right.

Thank you! :)

vishalapr (author)  Maki_mx1 year ago

Can you tell me which parts are hard to understand? The schematic is correct as far as I remember so go ahead with the schematic. Im not sure what the 2nd question means?

Here, for example, you say "9 and 7 to the center pins of the transistors", but that is were the sensor is connected

Sorry, my question was not clear, What is the object in the schematic going from left to right?

vishalapr (author)  Maki_mx1 year ago

If you make this robot be sure to post a pic of it here! The object in the schematic is the ultrasonic sensor if you are talking about the small black square.

vishalapr (author)  Maki_mx1 year ago

Im sorry for the confusion I should have stuck to the pins on the attiny itself but I kept swapping between the attiny pins and the digital pins, I said digital pins 9 and 7 to the center pins of the transistors which are pins 9 and 12 on the attiny2313, have a look at this image.

rvyas31 year ago
there is an error in code for Ultrasonic ultrasonic(TRIG,ECHO); // Create and initialize the Ultrasonic object.line. i am making a same robot but i can't because of this code. all i need is a code.
vishalapr (author)  rvyas31 year ago

What does the error say?

Im not really sure because the code worked perfectly for me

harishqwe2 years ago
can any 1 give me the full code for attiny 2313 with arduino ??
vishalapr (author)  harishqwe2 years ago
Its on step number 6
vishalapr (author)  vishalapr2 years ago
ybsocurious2 years ago
can you give me your email? i have a problem. thanks
vishalapr (author)  ybsocurious2 years ago
I don't use my email that much, you can send me a message on instructables or just post the problem in the comments here and I can help solve it as it would help others with the same problem as well :)
Edgar2 years ago
With a Hemispherical Hull, this could make a cool Cat Toy, methinks... :D
Voted, and went to the Blog:
vishalapr (author)  Edgar2 years ago
Thanks! Yea It could act as a cat toy if the hull was spherical and was made of plastic instead of cardboard, as its a lot stronger, but unfortunately I don't have any pets :(
Edgar vishalapr2 years ago
Lots of people do, and so, you can use some friend's cat for the experiment.
vishalapr (author)  Edgar2 years ago
yea I know friends who have cats ;) I will be sure to try it!
alcurb2 years ago
Nice design. Have you considered making it self-balancing? I'm not sure if one could make such a tiny self-balancing robot.
vishalapr (author)  alcurb2 years ago
Do you mean like a different self balancing robot or modifying this to make it self balancing? Thanks alcurb!
Either. I just wonder if a robot of the same height can self balance.
vishalapr (author)  alcurb2 years ago
Hmm it might be possible...but I'm not really good with all the weights and measurements and stuff as I haven't got good tools to make very precise and accurate things, if I get a couple of tools and I get to use wood, then the first thing I'm going to make will be a quadrocopter as right now no matter what I do its always off balance or too heavy or too weak etc....and this might be something I can experiment with as well :)
haha nice tail! it looks cute ;)
vishalapr (author)  mprzymusiński2 years ago
Thanks! ;)
Transmisso2 years ago
This project is so simple to do and the results seem amazing!
vishalapr (author)  Transmisso2 years ago
Thanks Transmisso!
bajablue2 years ago
A fabulous Contest trifecta!!! Excellent work, vishalapr!!!
vishalapr (author)  bajablue2 years ago
Thanks! Its awesome u liked it!
(I had to google trifecta btw XD)
simple robot that can be a good example for students who want to get into robotics
vishalapr (author)  cdragos george2 years ago
Thanks! Glad you liked it
hisashime2 years ago
Just love following with your projects. Makes life easy with minimal parts.
vishalapr (author)  hisashime2 years ago
That's awesome :)
Glad you like my projects!
The reason why I barely use any complicated tools or parts is because I don't have any tools apart from a glue gun, soldering iron and the leather-man.
Helicopterz2 years ago
Great project and documentation, may I ask why you swapped the original motors though and may I also know what company the batteries are of because all the batteries 9V (rechargeable and Non-rechargeable never had 330mAh capacity)
vishalapr (author)  Helicopterz2 years ago
Glad you liked the project Helicopterz ;)

The battery I used was similar to this one:

I swapped the original motors with the geared ones as the original ones weren't able to move the robot at a good speed, it moved very slowly, but with these new motors, it moves at a nice speed when the batteries are fully charged!
RRoobboott2 years ago
That looks so cute :D, I am planning on making this and do you know any place online where I can buy the ATtiny2313 chips in bulk? like maybe 20 or 30,
vishalapr (author)  RRoobboott2 years ago
You should try checking on ebay as I remember seeing many sellers sell 1 chip for 2.5-3.5$ and in bulk (10 or more) for about 1.8-2.5$ each, so it would be a good deal

Once you make this be sure to upload pics of it :)
Lensquare 2 years ago
Such a great design! Thanks you for the contribution! Where would you recommend to buy the parts that are needed? Online?
1-40 of 54Next »