Can the servo library be made to run on an ATTiny85v-20?

Basically, I want to use an Arduino to control a servo-actuated gripper. The arduino receives an on/off signal from another controller and tells the servo to open or close. It's simple enough that the 328p seems like overkill and the program size is less than 5k, so I got to wondering if the ATTiny85 might be better suited to this simple application. However, I get the following errors when I try to compile the "Knob" example:

C:\Program Files (x86)\Arduino\libraries\Servo\Servo.cpp: In function 'void __vector_3()':
C:\Program Files (x86)\Arduino\libraries\Servo\Servo.cpp:105: error: cannot convert 'volatile uint8_t*' to 'volatile uint16_t*' for argument '2' to 'void handle_interrupts(timer16_Sequence_t, volatile uint16_t*, volatile uint16_t*)'
C:\Program Files (x86)\Arduino\libraries\Servo\Servo.cpp: In function 'void initISR(timer16_Sequence_t)':
C:\Program Files (x86)\Arduino\libraries\Servo\Servo.cpp:151: error: 'TCCR1A' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\Servo\Servo.cpp:152: error: 'TCCR1B' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\Servo\Servo.cpp:159: error: 'TIFR1' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\Servo\Servo.cpp:160: error: 'TIMSK1' was not declared in this scope

To me, it looks as if the timer and or interrupts are to blame. Is it possible to tweak the servo library to run on an ATiny?If so how might I go about doing it?

seanz2003:
It's simple enough that the 328p seems like overkill and the program size is less than 5k

Does that matter when Pro Minis are only $2.60 each?

seanz2003:

C:\Program Files (x86)\Arduino\libraries\Servo\Servo.cpp:152: error: 'TCCR1B' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\Servo\Servo.cpp:159: error: 'TIFR1' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\Servo\Servo.cpp:160: error: 'TIMSK1' was not declared in this scope

To me, it looks as if the timer and or interrupts are to blame.

Looking at those messages, I'd say it's because Timer1 isn't the same on Mega328 and Tiny85.

seanz2003:
Is it possible to tweak the servo library to run on an ATiny?If so how might I go about doing it?

  1. Arm yourself with knowledge about what signals a Servo expects:
  1. Grab the datasheets for both devices and go to the chapter on "Timer/Counter 1".

so I got to wondering if the ATTiny85 might be better suited to this simple application

Digispark & Trinket have servo libraries what are t85-based.

From Newark, in qty 25, attiny85 is about 0.85¢ each. Similar prices from Mouser. If you intend on playing with t85's you should consider a 25 quantity buy with friends to spread the shipping costs.

The above said, an under $3 ProMini from Hong Kong delivered in your mailbox for under $3 does seem more reasonable unless you just want to play.

Ray

Thank you for replies! I have a bunch of ATTINY85 chips leftover from another project . When you're holding hammer, everything tends to look like a nail... I'm also too short on time to order parts from china

seanz2003:
Thank you for replies! I have a bunch of ATTINY85 chips leftover from another project . When you’re holding hammer, everything tends to look like a nail… I’m also too short on time to order parts from china

I have a few t85 projects here:
http://www.hackster.io/rayburne

Ray