ATtiny Hacks: ATtiny45/85 servo library

ATtiny Hacks Theme Banner

Servo8bit is a library for AVR microcontrollers that allows you to drive servo motors without the need for a 16-bit timer. Obviously, this is quite useful for smaller chips that only have 8-bit timers and it is specifically targeted at the ATtiny45 and ATtiny85 microcontrollers. The library offers 256 steps of resolution, and can drive up to five servos at one time. Servo control pulses can be generated between 512 and 2560 microseconds and if you don’t mind increasing the time between these pulses [Liya] says it would be possible to increase the 5-servo limit.

The library is quite easy to use, but in its current state it would take just a bit of work to port to another device. It’s been written for an 8 Mhz clock signal with PortB used to drive the motors. Using find-and-replace to change the PORTB keywords to use a DEFINE variable should be easy enough, but we don’t know how hard it would be to change the clock frequency.

We wonder if it’s possible to make this a slave device, perhaps implementing a 1-wire protocol?


  1. Wolf says:

    Epic! (And useful…) ^^

  2. Ivan says:

    I have always been looking for a good multi-servo driver chip. I have tried making my own (failed), getting a PICAXE 08M to do it (only support 2 servos) and even considered buing one of these “servo controller” chips that are just a 8 pin PIC programmed with some proprietary code on which I don’t want to depend.

  3. Ivan says:

    When I mean making my own, I referred to programming some PIC to do it.

  4. Mike bradley says:

    I have an open source driver for 32 servos, I just modified the code last week to compiler for 32/16/8 servos…

  5. Deejay says:

    Hi guys
    does any of you guys have source code for servo motor interface with ATTiny2313 microcontroller?

    please email me on

    it is very urgent andd important for me. please help me out

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 96,401 other followers