We'll start with the top pins BAT+ and USB+ and GND
BAT+ is the Battery + Input pin. If you want to power the trinket from a battery or power adapter or solar panel or any other kind of power source, connect the + (positive) pin here! You can connect up to 16V DC. If you have a 3V Trinket, you'll want at least 3.5V input to get a good 3.3V output. If you have a 5V trinket, 5.5V or higher is suggested. This input is reverse-polarity protected.
- USB+ is the USB + Output pin. If you want to use the USB 5V power for something, like charging a battery, or if you need more than 150mA of current (this pin can supply 500mA+ from USB ports) or to detect when the Trinket is plugged into USB, this pin will have 5V power on it if and only if its plugged into something via the mini B connector
- GND is the common ground pin, used for logic and power. It is connected to the USB ground and the power regulator, etc. This is the pin you'll want to use for any and all ground connections
Next we will cover the 5 GPIO (General Purpose Input Ouput) pins! For reference you may want to also check out the datasheet-reference above for the core ATtiny85 pin
All the GPIO pins can be used as digital inputs, digital outputs, for LEDs, buttons and switches etc. They can provide up to 20mA of current. Don't connect a motor or other high-power component directly to the pins! Instead, use a transistor to power the DC motor on/off
On a 3V Trinket, the GPIO are 3.3V output level, and should not be used with 5V inputs. On a 5V Trinket, the GPIO are 5V output level, and can be used with 3V inputs but may damage electronic devices that are 3V input only!
The first 3 pins are completely 'free' pins, they are not used by the USB connection so you never have to worry about the USB interface interfering with them when programming
- GPIO #0 - this is connected to PB0 on the ATtiny85. This pin can be used as a PWM output, and is also used for I2C data, and SPI data input.
- GPIO #1 - this is connected to PB1 on the ATtiny85. This pin can be used as a PWM output, and is also used for SPI data output. This pin is also connected to the onboard LED (like pin 13 on a regular Arduino).
- GPIO #2 - this is connected to PB2 on the ATtiny85. This pin can be used as an analog input (known as Analog A1), and is also used for I2C clock and SPI clock.
The next 2 pins are also used for USB programming. That means that when the Trinket is connected to a computer and in bootloader mode or in the middle of uploading a new program, they are used for sending data to/from the computer! It's possible to share these pins if you are careful. The best use of these pins is as outputs to things like LEDs. We didn't want to keep these pins off the board but we strongly recommend not using them unless you're sure you need them since you might have to disconnect any connections to reprogram the Trinket!
GPIO #3 - this is connected to PB3 on the Attiny85. This pin is used for USB programming, but its also an analog input known as Analog A3
This pin has a 1.5K pullup to 3.3V built into the Trinket, for USB comm so it may be difficult to use for analog or digital input.
- GPIO #4 - this is connected to PB4 on the Attiny85. this pin is used for USB programming, but it can also be used as a PWM analog output and an analog input known as Analog A2
The final two pins are at the bottom of the board.
First is the Rst reset pin. This is connected directly to the ATtiny85's reset pin and also the reset button which is right next to it. The reset pin is used to enter the bootloader and to reset the board in case you want to restart it. It's also possible to use this pin to re-program in the bootloader or completely remove the bootloader if you have an AVR programmer such as an AVR Dragon, MKii or USBtinyISP. If you want to re-program the board when its in an enclosure or box or otherwise hard to reach, wire a simple button from the RST pin to ground and press it to enter the bootloader for 10 seconds. The #1 LED will pulse to let you know. The reset button cannot be used as a GPIO, but we think its a lot more useful as a proper reset button!
Lastly we have the regulator output pin. There is an onboard mini power regulator that will take up to 16V DC from the BAT+ or USB connection and regulate it down to a steady 3.3V or 5.0V DC so its safe to use with your sensors and LEDs. On a 3V Trinket, this output will be about 3.3V. On a 5V Trinket, this output will be 5V so be aware in case you want to swap one with the other. You can draw up to 150mA output from this pin. If you need more current, you may want to get it directly from the USB+ pin, which supplies 5V @ 500mA from a computer or wall adapter