GEMMA sequin hat

Author Gravatar Image BECKY STERN
LED sequins are great for clothing and accessories! Here's a simple hat project to build with GEMMA.
You can start with the pixel + or -. For this hat we chose to start with the shared ground line that hooks up all the sequins. Stitch around the GND pad on GEMMA at the edge of a knit cap and knot/seal at the back.
Lay out your own design or use our circuit diagram above, with the sequins' + sides facing the microcontroller.

Continue stitching the ground line all the way around the perimeter of your sequin design, stitching to every sequin's - pad as you go.

Knot to your original knot, seal the knot, and trim the ends once dry.
Next hook up the + connections from each of GEMMA's outputs to two pixels. We stitched from one sequin to the GEMMA, then over to another sequin and back to the first, making a sort of triangle that results in the thread tails being in the same place.

Knot these thread tails, seal and trim short.
Plug in GEMMA over USB and load the following code into your Adafruit Arduino IDE. If you haven't before, check out our Introducing GEMMA guide to get started with the software.
Copy Code
int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by
int counter = 0;       // counter to keep track of cycles

// the setup routine runs once when you press reset:
void setup()  { 
  // declare pins to be an outputs:
  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(2, OUTPUT);

// the loop routine runs over and over again forever:
void loop()  { 
  // set the brightness of the analog-connected LEDs:
  analogWrite(1, brightness);
  analogWrite(0, 255-brightness);  
  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade: 
  if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount; 
  // wait for 15 milliseconds to see the dimming effect    

// turns on the other LEDs every four times through the fade by 
  // checking the modulo of the counter.
  // the modulo function gives you the remainder of 
  // the division of two numbers:
  if (counter % 4 == 0) {
    digitalWrite(2, HIGH);
  } else {
   digitalWrite(2, LOW);
This sketch is a mash-up of two very basic Arduino examples: blink and fade. You can modify it to display the patterns of light you like best or code up your own sketch starting with the examples provided from inside Arduino.
Once your program is doing what you like, unplug the USB cable and plug in a battery pack like our 2x2032 holder with on/off switch.

Take the batteries out if you get stuck in a rainstorm and for washing. Enjoy your new light-up hat!
Last updated on 2015-05-04 at 04.27.44 PM Published on 2014-04-02 at 01.30.14 PM