GEMMA jewelry! The bitty board fits perfectly in the center of a NeoPixel ring for flashy hoop earrings or a charming pendant. Read on to build your own!
Before you get started, follow the Introducing GEMMA guide or Introducing Gemma M0 guide
Overview
Tools & Supplies
Bill of materials (for one pendant-- double this for a pair of earrings):
|
|
Any entry level 'all-in-one' soldering iron that you might find at your local hardware store should work. As with most things in life, you get what you pay for. Upgrading to a higher end soldering iron setup, like the Hakko FX-888 that we stock in our store, will make soldering fun and easy. Do not use a "ColdHeat" soldering iron! They are not suitable for delicate electronics work and can damage the boards (see here). Click here to buy our entry level adjustable 30W 110V soldering iron. Click here to upgrade to a Genuine Hakko FX-888 adjustable temperature soldering iron. Learn how to solder with tons of tutorials! |
|
You will want rosin core, 60/40 solder. Good solder is a good thing. Bad solder leads to bridging and cold solder joints which can be tough to find. Click here to buy a spool of leaded solder (recommended for beginners). Click here to buy a spool of lead-free solder. |
|
You will need a good quality basic multimeter that can measure voltage and continuity. Click here to buy a basic multimeter. Click here to buy a top of the line multimeter. Click here to buy a pocket multimeter. Don't forget to learn how to use your multimeter too! |
|
Sharp scissors are a must! |
|
Don't forget your wire strippers, pliers, and flush snips! Tweezers can help manipulate the wires connecting components in your circuit. |
|
A helping third hand tool really makes this project a joy to build. Click here to buy a helping third hand tool. |
Circuit Diagram
Solder Components
Arrange GEMMA in the center of the ring, holding everything in place with a pair of helping hands.
Arduino Code
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. Once you have it up and running (test the 'blink' sketch), then follow the instructions on the following page for installing the NeoPixel library:
Plug in your circuit and load up the sketch below:
// Low power NeoPixel earrings example. Makes a nice blinky display // with just a few LEDs on at any time...uses MUCH less juice than // rainbow display! #include <Adafruit_NeoPixel.h> #define PIN 0 #define NUM_LEDS 16 Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUM_LEDS, PIN); uint8_t mode = 0, // Current animation effect offset = 0; // Position of spinner animation uint32_t color = 0xFF8000; // Starting color = amber uint32_t prevTime; // Time of last animation mode switch void setup() { pixels.begin(); pixels.setBrightness(60); // ~1/3 brightness prevTime = millis(); // Starting time } void loop() { uint8_t i; uint32_t t; switch(mode) { case 0: // Random sparkles - just one LED on at a time! i = random(NUM_LEDS); // Choose a random pixel pixels.setPixelColor(i, color); // Set it to current color pixels.show(); // Refresh LED states // Set same pixel to "off" color now but DON'T refresh... // it stays on for now...both this and the next random // pixel will be refreshed on the next pass. pixels.setPixelColor(i, 0); delay(10); // 10 millisecond delay break; case 1: // Spinny wheel (4 LEDs on at a time) for(i=0; i<NUM_LEDS; i++) { // For each LED... uint32_t c = 0; // Assume pixel will be "off" color if(((offset + i) & 7) < 2) { // For each 8 pixels, 2 will be... c = color; // ...assigned the current color } pixels.setPixelColor(i, c); // Set color of pixel 'i' } pixels.show(); // Refresh LED states delay(50); // 50 millisecond delay offset++; // Shift animation by 1 pixel on next frame break; // More animation modes could be added here! } t = millis(); // Current time in milliseconds if((t - prevTime) > 8000) { // Every 8 seconds... mode++; // Advance to next animation mode if(mode > 1) { // End of modes? mode = 0; // Start over from beginning color >>= 8; // And change color if(!color) color = 0xFF8000; // preiodically reset to amber } pixels.clear(); // Set all pixels to 'off' state prevTime = t; // Record the time of the last mode change } }
CircuitPython Code
GEMMA M0 boards can run CircuitPython — a different approach to programming compared to Arduino sketches. In fact, CircuitPython comes factory pre-loaded on GEMMA M0. If you’ve overwritten it with an Arduino sketch, or just want to learn the basics of setting up and using CircuitPython, this is explained in the Adafruit GEMMA M0 guide.
Below is CircuitPython code that works similarly (though not exactly the same) as the Arduino sketch shown on a prior page. To use this, plug the GEMMA M0 into USB…it should show up on your computer as a small flash drive…then edit the file “main.py” with your text editor of choice. Select and copy the code below and paste it into that file, entirely replacing its contents (don’t mix it in with lingering bits of old code). When you save the file, the code should start running almost immediately (if not, see notes at the bottom of this page).
This project is designed to work with RGB NeoPixel rings, not RGBW. The code will not work with RGBW.
If GEMMA M0 doesn’t show up as a drive, follow the GEMMA M0 guide link above to prepare the board for CircuitPython.
# NeoPixel earrings example. Makes a nice blinky display with just a # few LEDs on at any time...uses MUCH less juice than rainbow display! import time import board import neopixel import adafruit_dotstar try: import urandom as random # for v1.0 API support except ImportError: import random dot = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2) dot[0] = (0, 0, 0) numpix = 16 # Number of NeoPixels (e.g. 16-pixel ring) pixpin = board.D0 # Pin where NeoPixels are connected strip = neopixel.NeoPixel(pixpin, numpix, brightness=.3, auto_write=False) def wheel(pos): # Input a value 0 to 255 to get a color value. # The colours are a transition r - g - b - back to r. if pos < 0 or pos > 255: return (0, 0, 0) if pos < 85: return (int(255 - pos*3), int(pos*3), 0) if pos < 170: pos -= 85 return (0, int(255 - pos*3), int(pos*3)) pos -= 170 return (int(pos * 3), 0, int(255 - (pos*3))) mode = 0 # Current animation effect offset = 0 # Position of spinner animation hue = 0 # Starting hue color = wheel(hue & 255) # hue -> RGB color prevtime = time.monotonic() # Time of last animation mode switch while True: # Loop forever... if mode == 0: # Random sparkles - lights just one LED at a time i = random.randint(0, numpix - 1) # Choose random pixel strip[i] = color # Set it to current color strip.show() # Refresh LED states # Set same pixel to "off" color now but DON'T refresh... # it stays on for now...bot this and the next random # pixel will be refreshed on the next pass. strip[i] = [0, 0, 0] time.sleep(0.008) # 8 millisecond delay elif mode == 1: # Spinny wheel (4 LEDs on at a time) for i in range(numpix): # For each LED... if ((offset + i) & 7) < 2: # 2 pixels out of 8... strip[i] = color # are set to current color else: strip[i] = [0, 0, 0] # other pixels are off strip.show() # Refresh LED states time.sleep(0.04) # 40 millisecond delay offset += 1 # Shift animation by 1 pixel on next frame if offset >= 8: offset = 0 # Additional animation modes could be added here! t = time.monotonic() # Current time in seconds if (t - prevtime) >= 8: # Every 8 seconds... mode += 1 # Advance to next mode if mode > 1: # End of modes? mode = 0 # Start over from beginning hue += 80 # And change color color = wheel(hue & 255) strip.fill([0, 0, 0]) # Turn off all pixels prevtime = t # Record time of last mode change
This code requires the neopixel.py library. A factory-fresh board will have this already installed. If you’ve just reloaded the board with CircuitPython, create the “lib” directory and then download neopixel.py from Github.
Affix Jewelry Findings
You shouldn't rely solely on the wires to hold GEMMA in place. Secure it in four spots with clear thread-- we're using purple so you can see it better. Thread a needle and pass it through a hole on GEMMA. |
|
Tie the thread in a knot around the NeoPixel ring, aligning the thread between pixels. Do this in four spots around GEMMA to secure it in the center of the earring. |
|
You can either glue a pendant hanger on the back with E6000 adhesive (hot glue is INSUFFICIENT), or attach an ear wire with a jump ring and two pairs of pliers. |
|
Our tiny lipoly battery can be affixed to the back with double-stick tape. Secure it further with more clear thread if desired. |
Wear 'em!
This guide was first published on Sep 18, 2013. It was last updated on Sep 18, 2013.