Overview

The Adafruit Trinket's small size makes it ideal for lightweight or small projects including robotics. This project demonstrates the use of a standard hobby servo with the Trinket.

The standard Arduino IDE servo library will not work with 8 bit AVR microcontrollers like the ATtiny85 on the Trinket and Gemma due to differences in available timer hardware. Fortunately the Adafruit_SoftServo library works well on any available pin (a hardware PWM (pulse width modulated) pin is not required). The library is not ideal, in that servos must be refreshed periodically. A true hardware library would be best if one could be coded, although it would be limited to pins capable of hardware PWM (GPIO #1 and #4).

If you turn the potentiometer, the servo will rotate from zero to 180 degrees. The circuit can be expanded into a number of useful projects.

Parts used:

  • Adafruit Trinket (You can use either the 3V or 5V version here as the power will come from USB or a battery pack). This tutorial can also be done with a Gemma, although the wiring is a little different of course
  • USB cable for power and reprogramming
  • Standard 5 volt hobby servo (several are available in the Adafruit shop)
  • Potentiometer (variable resistor), anything from 1K Ω to 10 KΩ, value not critical
  • Breadboard, jumper wires/hookup wire
  • Power supply and connector - if you want to have it connected to a battery pack or computer-independant
Last updated on 2016-02-08 at 03.31.26 PM Published on 2013-09-12 at 05.02.44 PM