Electronic – How many servos can I run on an ATtiny85

atmelattinymotorregisterservo

This is my first time asking a question on this website, so please correct me if I'm doing something wrong…

I have been working on a small project which runs three Servo motors on an ATtiny85, using C on Code::Blocks on a Mac.

So far, I have accomplished to move two Servos using PWM on PB1 and PB4. PB1 is controlled by TCCR1 which is connected to OCR1A, and PB4 is controlled by GTCCR which connected to OCR1B. After reading the data sheet, I thought I could run one more on PB0, which is controlled by TCCR0A, but I cannot figure out which register to use to connect to servo (e.g. OCR1D).

So, my question is… Can I run three servos on an ATtiny85? If so, what is the register for the third servo?

Best Answer

Below is the pinout for the ATtiny85:

enter image description here

You said you are already using PB1 and PB4, so you must be using Timer1 to drive these PWM pins, using the pins as: OC1A and OC1B.

It appears you also have PB0 driven by Timer0 as pin: OC0A. It would also seem you are capable of controlling 3 PWM pins independently with the ATtiny85 (PB3 is just the NOT of PB4).

Simply set these registers for Timer0 in a similar fashion as you have with Timer1.

I've included the datasheet here: ATtiny85