This step is not optional! Avoid heartbreak later by testing your circuit now.

Use a breadboard, hook-up wire, and alligator clip leads to test out the circuit. This is a good way to get familiar with the connections you'll be making before soldering, as well as a chance to upload the sketch and test out the lighting effects.

If this is your first time using GEMMA, work through the Introducing GEMMA guide first; you need to customize some settings in the Arduino IDE (or download ours). Once you have it up and running (test the 'blink' sketch), then download and install the NeoPixel library:

Installing Arduino libraries is a frequent stumbling block. If this is your first time, or simply needing a refresher, please read the All About Arduino Libraries tutorial.If the library is correctly installed (and the Arduino IDE is restarted), you should be able to navigate through the “File” rollover menus as follows:


Connect up your NeoPixels in a solderless breadboard and use alligator clips to attach to GEMMA, referring to the circuit diagram if necessary.

You’ll need to change a few lines in the code regarding the data pin (1), and number of pixels (30). The resulting (and slightly simplified) code is below:

//  NeoPixie Dust Bag by John Edgar Park
//     No fairy costume is complete without a glowing pixie dust bag. 
//     This one uses a touch sensor to cycle through colors on the beautifully twinkling NeoPixel rings, 
//     controlled by the tiny Adafruit GEMMA microcontroller.
//     Build instructions:
//  Some code based upon Adafruit GEMMA earring code and Adafruit NeoPixel buttoncycler code

#include <Adafruit_NeoPixel.h>  //Include the NeoPixel library

#define NEO_PIN 0        // DIGITAL IO pin for NeoPixel OUTPUT from GEMMA
#define TOUCH_PIN 2      // DIGITAL IO pin for momentary touch sensor INPUT to GEMMA
#define PIXEL_COUNT 30   // Number of NeoPixels connected to GEMMA
#define DELAY_MILLIS 10  // delay between blinks, smaller numbers are faster 
#define DELAY_MULT 8     // Randomization multiplier on the delay speed of the effect
#define BRIGHT 100        // Brightness of the pixels, max is 255

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number on Arduino (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
//   NEO_GRB     Pixels are wired for GRB bitstream, correct for neopixel stick (most NeoPixel products)
//   NEO_KHZ400  400 KHz bitstream (e.g. FLORA pixels)
//   NEO_KHZ800  800 KHz bitstream (e.g. High Density LED strip), correct for neopixel stick
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(PIXEL_COUNT, NEO_PIN, NEO_GRB + NEO_KHZ800);

bool oldState = HIGH; //sets the initial variable for counting touch sensor button pushes
int showColor = 0;    //color mode for cycling

void setup() {
  pinMode(TOUCH_PIN, INPUT);    //Initialize touch sensor pin as input using external pull-up resistor
  pixels.setBrightness(BRIGHT);;                //Set all pixels to "off"

void loop() {
  int RColor = 100; //color (0-255) values to be set by cylcing touch switch, initially GOLD
  int GColor = 0 ;
  int BColor = 0 ;
       if (showColor==0) {//Garden PINK
         RColor = 242;
         GColor = 90;
         BColor = 255; 
       if (showColor==1) {//Pixie GOLD
         RColor = 255;
         GColor = 222;
         BColor = 30; 
       if (showColor==2) {//Alchemy BLUE
         RColor = 50;
         GColor = 255;
         BColor = 255; 
       if (showColor==3) {//Animal ORANGE
         RColor = 255;
         GColor = 100;
         BColor = 0; 
       if (showColor==4) {//Tinker GREEN
         RColor = 0;
         GColor = 255;
         BColor = 40; 
  int p = random(PIXEL_COUNT); //select a random pixel
  pixels.setPixelColor(p,RColor,GColor,BColor); //color value comes from cycling state of momentary switch;
  delay(DELAY_MILLIS * random(DELAY_MULT) ); //delay value randomized to up to DELAY_MULT times longer
  pixels.setPixelColor(p, RColor/10, GColor/10, BColor/10); //set to a dimmed version of the state color;
  pixels.setPixelColor(p+1, RColor/15, GColor/15, BColor/15); //set a neighbor pixel to an even dimmer value;
  //button check to cycle through color value sets
  bool newState = digitalRead(TOUCH_PIN); //Get the current button state
  // Check if state changed from high to low (button press).
  if (newState == LOW && oldState == HIGH) {
    // Short delay to debounce button.
    // Check if button is still low after debounce.
    newState = digitalRead(TOUCH_PIN);
    if (newState == LOW) {
      if (showColor > 4)
  // Set the last button state to the old state.
  oldState = newState;  

From the Tools→Board menu, select Adafruit Gemma 8MHzor Adafruit Trinket 8 MHz as appropriate. Connect the USB cable between the computer and GEMMA, press the reset button on the board, then click the upload button (right arrow icon) in the Arduino IDE. When the battery is connected, you should get a light show from the LEDs. All your pixels working? Great! You can take apart this prototype and get ready to put the pixels in the collar. Refer to the NeoPixel Uberguide for more info.

This guide was first published on Oct 22, 2014. It was last updated on Oct 22, 2014.

This page (Prototype the Circuit) was last updated on Mar 11, 2021.

Text editor powered by tinymce.