Overview
Create a delicate ring of NeoPixels attached to a Gemma bracelet. Program your ring in Arduino, CircuitPython, or with MakeCode Maker & then protect your NeoPixels by encasing them in resin.
Make sure you're familiar with the following guides:
Parts
This guide uses an Adafruit Gemma M0 and Nano RGB LEDs. The Gemma M0 should be used with the onboard dotstar LED, capacitive touch sensors, and ability to program using CircuitPython or MakeCode Maker.
Nano RGB LEDs are a quarter of the size of standard 5050mm NeoPixels you may be used to seeing. They're tiny and adorable and once encased in resin, will be both durable and waterproof. Although these LEDs are not really meant for hand soldering, each LED has a teeny tiny pad that can be carefully soldered to.
The following parts are the electronic parts for the project from Adafruit.
- Soldering iron - 120V US, 220V UK, 220V EU
- Soldering iron stand
- Solder
- Wire stripper
- Helping hands w/ magnifying glass
- Solder Tip Cleaner
- Ventilation: the USB Rechargeable Mini Solder Fume Extractor from Phillip Burgess
- Alligator Clips
- Tweezers
- Blue tack or large tape
- Blank bezel bracelet
- Foam tape
- E6000
- Optional: Ring Mold (I grabbed these from a seller on Etsy: 1, 2, & 3) plus Casting Epoxy
Page last edited March 08, 2024
Text editor powered by tinymce.
Code
With a Gemma M0, you can use it with the Arduino IDE, CircuitPython, or MakeCode Maker. Although the MakeCode Maker sketch is a bit different than the Arduino and CircuitPython examples, the sketch looks great on the NanoRing.
Choose your own adventure!
Page last edited March 08, 2024
Text editor powered by tinymce.
Arduino
This is a great basic Arduino sketch that looks fantastic on this NanoRing. You may recognize it from the example code used in the NeoPixel Tiara guide. I've updated the Random Flash animation to show flashes of 5 colors on a ring with 3 LEDs.
If you are new to Arduino, check out this guide: Adafruit Arduino IDE Setup. This sketch uses the Adafruit NeoPixel library. You can learn more about Arduino libraries by reading this guide from Adafruit.
Plug the Gemma M0 into your computer with a working USB cable and select Gemma M0 in Tools -> board. Download the code from the download link below. Verify and upload the code to the Gemma M0.
// SPDX-FileCopyrightText: 2017 Mikey Sklar for Adafruit Industries
//
// SPDX-License-Identifier: MIT
#include <Adafruit_NeoPixel.h>
#define PIN 1
#define NUM_LEDS 3
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
// R G B
uint8_t myColors[][5] = {
{30, 144, 255}, // dodger blue
{232, 100, 255}, // purple
{204, 0, 204}, //
{200, 200, 20}, // yellow
{30, 200, 200}, // blue
};
// don't edit the line below
#define FAVCOLORS sizeof(myColors) / 5
void setup() {
strip.begin();
strip.setBrightness(20);
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
flashRandom(10, 1); // first number is 'wait' delay, shorter num == shorter twinkle
flashRandom(10, 3); // second number is how many neopixels to simultaneously light up
flashRandom(10, 2);
}
void flashRandom(int wait, uint8_t howmany) {
for(uint16_t i=0; i<howmany; i++) {
// pick a random favorite color!
int c = random(FAVCOLORS);
int red = myColors[c][0];
int green = myColors[c][1];
int blue = myColors[c][2];
// get a random pixel from the list
int j = random(strip.numPixels());
// now we will 'fade' it in 5 steps
for (int x=0; x < 5; x++) {
int r = red * (x+1); r /= 5;
int g = green * (x+1); g /= 5;
int b = blue * (x+1); b /= 5;
strip.setPixelColor(j, strip.Color(r, g, b));
strip.show();
delay(wait);
}
// & fade out in 5 steps
for (int x=5; x >= 0; x--) {
int r = red * x; r /= 5;
int g = green * x; g /= 5;
int b = blue * x; b /= 5;
strip.setPixelColor(j, strip.Color(r, g, b));
strip.show();
delay(wait);
}
}
// LEDs will be off when done (they are faded to 0)
}
Page last edited March 08, 2024
Text editor powered by tinymce.
CircuitPython
Below is CircuitPython code that works similarly (though not exactly the same) as the Arduino sketch.
Your Gemma M0 already comes with CircuitPython but maybe there's a new version, or you overwrote your Gemma M0 with Arduino code. In that case, if you need to reinstall or update CircuitPython Gemma M0, see the set up CircuitPython Quick Start!
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 on the CIRCUITPY flash drive that appears when you plug the Gemma M0 in and then download neopixel.py from Github.
To use this, plug the GEMMA M0 into USB - it should show up on your computer as a small flash drive. Edit the file code.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, follow the GEMMA M0 guide link to troubleshoot).
If GEMMA M0 doesn’t show up as a drive, follow the GEMMA M0 guide link above to prepare the board for CircuitPython.
# SPDX-FileCopyrightText: 2017 Mikey Sklar for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
import board
import neopixel
try:
import urandom as random
except ImportError:
import random
numpix = 3 # Number of NeoPixels
pixpin = board.D1 # Pin where NeoPixels are connected
strip = neopixel.NeoPixel(pixpin, numpix, brightness=.1, auto_write=True)
colors = [
[30, 144, 255], # Dodger Blue
[232, 100, 255], # Purple
[204, 0, 204], # Pink
[200, 200, 20], # Yellow
[30, 200, 200], # Blue
]
def flash_random(wait, howmany):
for _ in range(howmany):
c = random.randint(0, len(colors) - 1) # Choose random color index
j = random.randint(0, numpix - 1) # Choose random pixel
strip[j] = colors[c] # Set pixel to color
for i in range(1, 5):
strip.brightness = i / 5.0 # Ramp up brightness
time.sleep(wait)
for i in range(5, 0, -1):
strip.brightness = i / 5.0 # Ramp down brightness
time.sleep(wait)
strip[j] = [0, 0, 0] # Set pixel to 'off'
while True:
# first number is 'wait' delay, shorter num == shorter twinkle
flash_random(.01, 1)
# second number is how many neopixels to simultaneously light up
flash_random(.01, 3)
flash_random(.01, 2)
Page last edited March 08, 2024
Text editor powered by tinymce.
MakeCode Maker
MakeCode Maker, https://maker.makecode.com, is a web-based code editor for physical computing. It provides a block editor, similar to Scratch or Code.org, and also a JavaScript editor for more advanced users. Microsoft MakeCode has been augmented to support more than the Adafruit Circuit Playground Express, like the GEMMA M0. See the Adafruit GEMMA M0 guide for more information.
Visit https://maker.makecode.com and create a New Project
Visit https://maker.makecode.com and create a New Project.
Drag a set strip to block so it's under on start.
Select the block and update the dropdowns. We're using D1 and we have 3 pixels.
Select strip set brightness under LIGHT and move this block under on start.
Set the brightness at 20. You may want to set it lower if the light is too bright. Lower values also make the battery last longer.
Select strip show frame of ( ) animation under LIGHT and move this under forever.
Choose an animation from the drop down. I selected the comet.
Preview the test animation on the left. Give your sketch a name and then download it to your desktop.
You can also get the code here:
Plug your Gemma M0 into your computer and ensure that the onboard switch it turned ON.
You should see it appear on your desktop as GEMMABOOT. If you have previously installed Arduino or CircuitPython, you may need to double press the reset button to get your board into bootloader mode.
Find the .uf2 file you just downloaded and move it to GEMMABOOT.
The status LED on the board will blink while the file is transferring. Once it's done transferring your file, the board will automatically reset and start running your code (just like in the simulator!)
Page last edited March 08, 2024
Text editor powered by tinymce.
Build it
Review the circuit diagrams for making a ring with 3 pixels. These illustrations are meant for referencing wired connections. The length of wire, position, and size of components will not match the actual project.
Lay out 3 LEDs in a diagonal orientation with the teeny tiny notch on the top of the row. The notch signifies the negative side of the pixels.
Using this orientation, the data in will be on the left and data out will be on the right.
Take a piece of blu-tack or tape and label the top with a "-" and the bottom with a "+". Since we've flipped things over, the data in will be on the right and the data out will be on the left. I used a screwdriver head to keep things labeled.
Tin all of the pads on the backs of the pixels. Tinning the pixels worked best when I hovered the soldering iron right above the pads instead of directly touching them.
Put the bracelet on your arm and move it as far up your arm it might go. Measure the distance between where the ring will sit (on your finger) and the bracelet. Add 1" and cut 3 pieces of wire.
Page last edited March 08, 2024
Text editor powered by tinymce.
Soldering
Use a wire stripper tool or your fingernails to strip a tiny bit off the end of one of the long pieces of wire.
Attach the wire to the positive pad of the middle pixel.
Separate and strip enough of one of the ribbon cable wires to cover all the positive pads.
Solder the wire across all the positive pads, using the tweezers to hold things down if needed. Leave the excess hanging off to the right.
Tin a piece of stripped wire. Cut a tiny piece of it.
Use that wire to connect the data between the 1st & 2nd pixels.
Use a wire stripper tool or your fingernails to strip a tiny bit off the end of one of the long pieces of wire.
Attach the long wire to the data in pad of the middle pixel.
Separate, trim, and strip the middle wire of the ribbon cable to align with the end data pad.
Solder the wire to the data pad. Leave the excess hanging off to the right with the power line.
Use a wire stripper tool or your fingernails to strip a tiny bit off the end of the last long piece of wire.
Attach the wire to the ground pad of the middle pixel.
Strip enough the last ribbon cable wire to cover all the ground pads.
Solder the wire across all the ground pads, using the tweezers to hold things down if needed. Leave the excess hanging off to the right.
Test the size of the ring around a finger. The fit should be loose, about a size & 1/2 larger than normal.
Connect the ring to the Gemma using alligator clips to test:
- Gemma GND -> Ring -
- Gemma Vout -> Ring +
- Gemma D1 -> Ring Data
Braid wires.
Page last edited March 08, 2024
Text editor powered by tinymce.
Ring & Bracelet
While encasing the ring in resin is optional, you will need to insulate the exposed components in e6000 or hot glue to avoid damaging the delicate solder joints.
I started testing by filling my molds with hot glue before putting a few components into the molds and testing resin. Hot glue rings could work in a pinch, but were more sticky and yellow than I wanted.
Insulate battery terminals and solder joints on Gemma M0 with e6000 or your other favorite adhesive.
Attach a battery to the Gemma M0 and then both to the bracelet using e6000 or foam adhesive. I carefully wrapped the wires around the battery so that I could still remove it for charging.
Page last edited March 08, 2024
Text editor powered by tinymce.