Chances are, you picked up a Gemma because it is programmable with the Arduino IDE. Note that the Gemma is not a full Flora or Arduino-compatible, it uses a different (smaller) chip than the Flora, Uno, Mega, Leonardo or Due. However, there are many small sketches and libraries that will work just fine. Some may not even need anything other than pin number changes.
Even though Gemma has a USB connector, it does not have a "Serial Console" capability, so you cannot use Serial to send and receive data to/from a computer!

Arduino IDE Setup

Just follow the steps in the steps in the Adafruit Arduino IDE setup guide to easily install a pre-configured Arduino IDE to program Gemma!

If you are running Arduino IDE 1.6.4 or greater, you can also use this quickstart guide to add in the Gemma plugin

When you're finished installing the IDE come back to this page to continue the Gemma guide.

There is currently a bug in Arduino 1.8.7 which requires you to select a Port before upload but we don't use Ports for Gemma uploads. If you don't have a Serial Port available to select, please use Arduino 1.8.6

Blink!

After installing the Arduino IDE with support for Adafruit's boards you can load a simple blinking LED example to test uploading to Gemma works as expected.  Open the Arduino IDE and replace the sketch code with the following blink code:

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.

  To upload to your  or Trinket:
  1) Select the proper board from the Tools->Board Menu (Arduino Gemma if
     teal, Adafruit Gemma if black)
  2) Select the uploader from the Tools->Programmer ("Arduino Gemma" if teal, 
	 "USBtinyISP" if black Gemma)
  3) Plug in the Gemma into USB, make sure you see the green LED lit
  4) For windows, make sure you install the right Gemma drivers
  5) Press the button on the Gemma/Trinket - verify you see
     the red LED pulse. This means it is ready to receive data
  6) Click the upload button above within 10 seconds
*/
 
int led = 1; // blink 'digital' pin 1 - AKA the built in red LED

// the setup routine runs once when you press reset:
void setup() {
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);

}

// the loop routine runs over and over again forever:
void loop() {
    digitalWrite(led, HIGH); 
    delay(1000);
    digitalWrite(led, LOW);
    delay(1000);
}
Make sure to pick the right version of the Gemma board in the IDE! If you're using the Adafruit Gemma it won't program correctly when selecting the Arduino Gemma option and vice versa! Carefully read the instructions below to pick the right board.

Adafruit Gemma (Black Gemma)

If you're using the Adafruit Gemma (with a black PCB board) select the Adafruit Gemma 8MHz board from the Tools->Board menu.

Then, select USBtinyISP from the Tools->Programmer sub-menu

Arduino Gemma (Teal Gemma)

However if you're using the newer Arduino Gemma (with a teal PCB board) select the Arduino Gemma board from the Tools->Boards menu.

Then select Arduino Gemma as the Programmer type

Get Into Bootloader Mode

Plug in the Gemma, make sure you see the green LED lit (power good) and the red LED pulsing. Press the button if the red LED is not pulsing, to get into bootloader mode.

Click the Upload button (or select File->Upload)

If everything goes smoothly you should see the following (no red error messages) and of course, the red LED on the Gemma will blink on/off once a second

Something Went Wrong!

If you get the error message avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)


That means the bootloader wasn't active. Make sure to press the button on the Gemma to activate the bootloader before clicking the Upload button.

If you get a lot of red text, errors and also a warning about Verification Failed


Check that you updated the avrdude.conf file above - if you don't update the description of the Attiny85 in the configure file by replacing it, the IDE wont know to be patient with the Gemma bootloader and will have many upload errors

On Linux if you get the error message "usbtiny_receive: error sending control message: Protocol error (expected 4, got -71)"

These can generally be ignored and should not interfere with the program upload.  Unfortunately Linux's USB core is a little flakey communicating with the ATtiny85 processor on the Trinket/Gemma and can cause these errors.  If an upload does fail, try it again as it is likely an intermittent issue.

This guide was first published on Sep 13, 2013. It was last updated on Sep 13, 2013.

This page (Setting up with Arduino IDE) was last updated on Sep 11, 2013.

Text editor powered by tinymce.