Monday, April 1, 2013

SoftwareServo library - ATtiny85/45/25

This post will cover the the examples of ATtiny that come with the modified SoftwareServo library found HERE Please note that the commands themselves have not been changed. I merely changed it for IDE 1.0+ compatibility and added a few examples. For information, check it out HERE.

What you will need:

  • ATtiny85/45/25
  • USBtinyISP or other method of programming
  • Hobby servo
  • Jumper wires
  • Breadboard
  • 10K potentiometer 
First, I am assuming that you know how to load programs onto the ATtiny. If not, please refer to my last few posts and THIS link.

Second, I'm going to assume you have either tried the Servo library that comes with the IDE and know it does not work or have read my previous post.

Third, don't expect the SerialServo example to work on the ATtiny.

Configure the ATtiny: We need it to run at 8MHz. Luckily it has an internal 8MHz clock. We merely need to plug it in, select ATtiny85 (internal 8 MHz) under boards and hit burn bootloader. It should load pretty quickly.

In case you don't want to read the datasheet. (credits)
Sweep: This is the first example I added. It is very similar to the sweep example from the Servo library. Notice that you have to refresh the servo manually. This could be useful or annoying depending on your situation. Regardless, it is the nature of the beast.

Here is a diagram of how you should wire everything up. It is pretty simple. As you can see from the pinout chart above, you could change the pins somewhat. 

Knob: This too is similar to the example found in the Servo library. This requires that you hook up a 10k pot to pin 3. As you can see, you can choose one of the other analog inputs instead if you wish. 

Again, here is a diagram of how you can wire everything up.

Now in case you are one of those people that just like to see the real thing, you can check out a video of sweep HERE and knob HERE.

If you have any questions or comments, either comment here or send me an email.


  1. Hi. Thank you a lot for your wonderful guides about attiny. I'm trying to make InsectoBot from book on attiny85. It all goes well.. But I found in SoftwareServo Library this.. So I guess it's time for me to learn port manipulation myself. Have you been able to start Servo8Bit in arduino ide?

  2. Sorry I'm stupid. Guess it's okay to use digitalWrite here as pins changing.