Overview
Planning an epic Iron Man costume for Halloween or Comic Con, or looking for that iconic piece that turns a plain t-shirt into Tony Stark? Look no further, for in this guide we'll show you how to make your own electronic glowing reactor with a cool pulsing effect.
You can even customize it once complete, go for red, purple, green, pink: Whatever color will power you up! Or change the pulse rate or effects to add a special touch.
This is a simple soldering+crafts project, but before you begin, please review the following prerequisite guides:
Vector designs by Dano Wall. Vice photo by John de Cristofaro.
Parts list:
- GEMMA v2 or GEMMA M0 wearable microcontroller
- NeoPixel ring
- single FLORA NeoPixel
- solid-core hookup wire
- JST extension cable
- 3xAAA battery pack with batteries
- 2x laser-cut/etched acrylic in clear or white (files on Thingiverse)
- elastic
- safety pin or velcro
- E6000 craft glue or hot melt glue
- needle and thread
- tracing/printer paper
Tools:
Page last edited September 26, 2013
Laser it
Our settings, using a 60 Watt Epilog:
Raster speed 50%, raster power 50%, vector speed 40%, vector power 100%, vector frequency 5000
Have fun!
Page last edited September 26, 2013
Circuit Diagram
GEMMA D1 -> NeoPixel Ring Data IN
GEMMA GND -> NeoPixel Ring Gnd and single FLORA pixel -
NeoPixel Ring Data OUT -> single FLORA pixel inward-facing arrow
Page last edited September 26, 2013
Build Circuit
This center pixel will sit back in space more than the pixel ring, adding a bit more space for diffusion behind the faceplate.
Page last edited September 26, 2013
Arduino Code
If this is your first time using GEMMA, work through the Introducing GEMMA (original) or Introducing Gemma M0 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:
NeoPixel Überguide: Arduino Library Installation
Plug in your circuit via USB and test that all LEDs are functioning properly with the NeoPixel example sketch 'strandtest.' Please refer to Introducing GEMMA and the NeoPixel Überguide if you haven't before.
Once you've verified your wiring is correct, load your desired color code or the sketch below that gently pulses the LEDs blue.
// SPDX-FileCopyrightText: 2017 Tony Sherwood for Adafruit Industries
//
// SPDX-License-Identifier: MIT
//Superhero Power Plant
//fades all pixels subtly
//code by Tony Sherwood for Adafruit Industries
#include <Adafruit_NeoPixel.h>
#define PIN 1
// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(17, PIN, NEO_GRB + NEO_KHZ800);
int alpha; // Current value of the pixels
int dir = 1; // Direction of the pixels... 1 = getting brighter, 0 = getting dimmer
int flip; // Randomly flip the direction every once in a while
int minAlpha = 25; // Min value of brightness
int maxAlpha = 100; // Max value of brightness
int alphaDelta = 5; // Delta of brightness between times through the loop
void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
flip = random(32);
if(flip > 20) {
dir = 1 - dir;
}
// Some example procedures showing how to display to the pixels:
if (dir == 1) {
alpha += alphaDelta;
}
if (dir == 0) {
alpha -= alphaDelta;
}
if (alpha < minAlpha) {
alpha = minAlpha;
dir = 1;
}
if (alpha > maxAlpha) {
alpha = maxAlpha;
dir = 0;
}
// Change the line below to alter the color of the lights
// The numbers represent the Red, Green, and Blue values
// of the lights, as a value between 0(off) and 1(max brightness)
//
// EX:
// colorWipe(strip.Color(alpha, 0, alpha/2)); // Pink
colorWipe(strip.Color(0, 0, alpha)); // Blue
}
// Fill the dots one after the other with a color
void colorWipe(uint32_t c) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
}
}
Page last edited September 26, 2013
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 to 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 “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, see notes at the bottom of this page).
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 Phillip Burgess for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import board
import neopixel
try:
import urandom as random # for v1.0 API support
except ImportError:
import random
num_pix = 17 # Number of NeoPixels
pix_pin = board.D1 # Pin where NeoPixels are connected
strip = neopixel.NeoPixel(pix_pin, num_pix)
min_alpha = 0.1 # Minimum brightness
max_alpha = 0.4 # Maximum brightness
alpha = (min_alpha + max_alpha) / 2 # Start in middle
alpha_delta = 0.01 # Amount to change brightness each time through loop
alpha_up = True # If True, brightness increasing, else decreasing
strip.fill([0, 0, 255]) # Fill blue, or change to R,G,B of your liking
while True: # Loop forever...
if random.randint(1, 5) == 5: # 1-in-5 random chance
alpha_up = not alpha_up # of reversing direction
if alpha_up: # Increasing brightness?
alpha += alpha_delta # Add some amount
if alpha >= max_alpha: # At or above max?
alpha = max_alpha # Limit to max
alpha_up = False # and switch direction
else: # Else decreasing brightness
alpha -= alpha_delta # Subtract some amount
if alpha <= min_alpha: # At or below min?
alpha = min_alpha # Limit to min
alpha_up = True # and switch direction
strip.brightness = alpha # Set brightness to 0.0 to 1.0
strip.write() # and issue data to LED strip
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.
Page last edited September 26, 2013
Affix Faceplate
Page last edited September 26, 2013
Wear it!
To keep it from obscuring the center pixel, cinch the elastic in one spot with a few stitches, then align that spot with the circuit.
Use a safety pin or velcro to secure the strap.
Page last edited September 26, 2013