Overview
This simplicity could be illustrated with a scrolling LED wall sign that works with your phone or tablet…and it’s easy enough to link up a few 8x8 NeoPixel matrices.…but we’re a little more zany than that. And we’ve got a thing for wearable electronics. So…
A hat! A dapper top hat! Most exemplary! Rather than flat matrices, we’ll use flexible NeoPixel strip. To save a lot of cutting and soldering, let’s keep the whole strip intact and coil it around the hat. The project takes its name from the Solomon R. Guggenheim museum, with its landmark spiral gallery.
To make this project fun and easy to update, we use a Bluefruit LE module to allow text and color updates to be wirelessly controlled from any iOS (all iPhone/iPads) or Android 4.3+ device (check that your Android device has BLE as some older devices do not!)
Page last edited April 23, 2014
Text editor powered by tinymce.
Tools and Supplies
You’ll need a smartphone or tablet that supports Bluetooth 4.0 LE in the hardware and operating system. Recent versions of the iPhone and iPad both work, as well as the latest round of Android phones and tablets. Some laptops may work too!
If you’re not sure, it’s easy to test for this: download and try one of the Bluetooth apps mentioned on the “Use It!” page of this guide. Older devices and OS versions (not supporting Bluetooth 4.0 LE) aren’t compatible, and the software will simply refuse to work.
Most top hats are slightly tapered one way or another. It’s unlikely you’ll find one with exactly straight sides, but try to find something as close to straight as possible, so the circumference is fairly uniform (we’ll tweak this later). The cheap paper Pilgrim hats at the party store are much too tapered, don’t use these!
Make sure the sides of the hat are tall enough, 4 inches (10 cm) minimum. You don’t need to go all Lincoln stovepipe unless that’s the look you’re after.
The Bluetooth library and all those NeoPixels require a lot of RAM, and most mainstream ATmega-based boards (Uno, Boarduino, etc.) won’t work. The Arduino Micro’s 32U4 processor has an extra 512 bytes of RAM that turn out to be critical to this project!
Cutting-edge boards like the Arduino Due, Netduino or Teensy 3 are unlikely to work here — though powerful, they’re based on different processors and only “mostly” Arduino compatible. Trinket and Gemma lack enough RAM, and an Arduino Mega is just overkill.
- Three AA alkaline cells (4.5V total) — cheap and easy, this is what we’ll use for ours!
- Four AA NiMH rechargeables (4.8V total)
- A slim lithium-polymer battery (3.7V, 1200 mAh or larger)
-
Adafruit Bluefruit LE nRF8001 breakout
- 4 meters (1 reel) of 60 NeoPixel LED strip
- Snap-Action 5-Wire Block Connector (pack of 3)
Page last edited April 23, 2014
Text editor powered by tinymce.
Test the NeoPixel Strip
If you’re not already using the Adafruit_NeoPixel library for Arduino, download and install this first. We have a guide for proper library installation.
DO NOT use the NeoPixel “strandtest” example for this test! It lights all the LEDs at once — more power than USB can handle. The code below is designed to light only a few LEDs at a time, so we can use the Arduino’s 5V or VIN pins.
If you have an Arduino Uno (or similar) around, use that for NeoPixel testing. Not mandatory, but the headers make for easy jumper wire connections.
// Simple NeoPixel test. Lights just a few pixels at a time so a
// long strip can safely be powered from Arduino 5V pin. Arduino
// may nonetheless hiccup when LEDs are first connected and not
// accept code. So upload code first, unplug USB, connect pixels
// to GND FIRST, then +5V and digital pin 6, then re-plug USB.
// A working strip will show a few pixels moving down the line,
// cycling between red, green and blue. If you get no response,
// might be connected to wrong end of strip -- look for the data
// direction arrows printed on the strip.
#include <Adafruit_NeoPixel.h>
#define PIN 6
#define N_LEDS 240 // 4 meter reel
Adafruit_NeoPixel strip = Adafruit_NeoPixel(N_LEDS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
}
void loop() {
chase(strip.Color(255, 0, 0)); // Red
chase(strip.Color(0, 255, 0)); // Green
chase(strip.Color(0, 0, 255)); // Blue
}
static void chase(uint32_t c) {
for(uint16_t i=0; i<strip.numPixels()+4; i++) {
strip.setPixelColor(i , c); // Draw new pixel
strip.setPixelColor(i-4, 0); // Erase pixel a few steps back
strip.show();
delay(25);
}
}
-
GND from Arduino to GND or – on strip, usually a black wire (always connect GND first).
-
VIN from Arduino to +5V or + on strip (usually a red wire).
-
Pin 6 from Arduino to DIN (or unmarked input) on strip (usually a white wire).
Lay the strip out flat so you can see the entire thing, then re-connect the USB cable. After a few seconds, you should see a few LEDs chasing down the length of the strip, cycling between red, green and blue. Watch carefully, noting any skipped or off-color pixels.
- If the computer reports a USB device is drawing too much power, unplug the Arduino immediately.
- Make sure the extra wires at either end of the strip are not touching each other or anything conductive.
- Confirm the three connections between the strip and Arduino: GND, +5V and pin 6.
- If using an Arduino Leonardo or Mini, it takes about 10 seconds when USB is connected before the sketch actually runs. Be patient.
- If you soldered any connections, make sure there’s no cold joints or solder bridges between adjacent pads.
- Make sure you’re connected to the INPUT end of the strip.
- Check the USB cable is properly seated between the Arduino and computer or powered USB hub.
Page last edited April 23, 2014
Text editor powered by tinymce.
Prepare NeoPixel Strip
If you have color-coded wire available, make two red and two black. If not, that’s okay, just need to be extra careful later when making connections.
Be super extra special careful that you’re indeed cutting the output plug. Look for the tiny arrows printed on the strip.
Later we’ll solder this plug to the Arduino, to make a removable connector for the input end.
Page last edited April 23, 2014
Text editor powered by tinymce.
Hat Hacking
We’d like for — no, we need — the pixels to form a fairly uniform grid, so we can draw legible text.
As previously mentioned, the hat is not a perfect cylinder…it’s tapered. If we simply coil the NeoPixel strip around it, the circumference of each loop is slightly different, and everything will be a jumble rather than a neat grid. Even if you do find a straight-sided hat, the circumference is very unlikely to be a precise multiple of the pixel spacing along the strip.
To address this, we’ll build a sleeve that slips over the hat. This will give us straight sides and an ideal circumference.
Card stock or poster board are reasonable last-ditch substitutes, but something plastic is much preferred. Not expecting anyone to wear this in a downpour…but sometimes one is caught off-guard by a little drizzle or fog, and paper would just go pulpy and fall apart.
This almost worked, but the material seemed just a bit too thick, and all those cable ties added a lot of ugly nubblyness.
If you have the patience to do this with actual hand sewing instead of the cable ties, I wouldn’t rule it out as a possibility! Read on regardless, there’s still the matter of sizing and assembly…
Ideally, the material would be affordable and easily found in a local “big box” store. There were field trips involved.
Two bottles provided sufficient plastic to fit around the hat and sufficient caffeine to complete the project. Diet soda, though vile, rinses out nicely with no sticky residue.
Coke bottles were unsuitable due to their funny shape; had to be something with straight sides.
The two pieces were joined into a longer strip (overlapping about 1 inch) using packing tape on both sides.
The silicone coating on the NeoPixel strip is wonderful for weatherproofing, but does present a challenge: almost nothing on this planet sticks to silicone!
Fortunately there’s one thing that sticks just well enough…carpet tape. Most hardware stores carry this. It’s a double-sided tape that’s wicked sticky and has a removable waxy paper covering.
Cut and apply four strips of carpet tape to the sleeve, running vertically: one each at the front and back, one on either side. Leave the paper backing in place until the next step.
Page last edited April 23, 2014
Text editor powered by tinymce.
Coiling NeoPixels
The stickiness of the tape, combined with the silicone’s resistance to most adhesives, has a side-effect that’s now quite useful: it has a weak hold like a Post-It® Note, making it possible to reposition the strip as we work through this next sequence.
Identify the LEFT TEMPLE of the hat and press the strip against the carpet tape at the BOTTOM (closest to the hat’s brim) with the WIRES toward the BACK of the hat and the STRIP toward the FRONT.
(In this photo, the front of the hat faces left.)
Once they’re reasonably aligned, make a mark with a Sharpie pen and count the number of NeoPixels between the marks. You’ll need this number later when we program the Arduino.
The rows of strip don’t have to butt right up against each other. I tried to leave a couple millimeters spacing. The Post-It®-like hold of the tape makes it easy to back up and try again repeatedly.
It’s bothersome up close, but at any reasonable distance nobody will notice. Sometimes referred to as the “ten foot rule” in cosplay.
Also, it’s unlikely that the start and end of the strip will be aligned. This too is okay, we’ll simply turn the sleeve to put the most pixels at the front.
My hat has seven rows of NeoPixels in the front, six in the back. Part of the text will be cut off in back, but don’t worry about this…it still gets peoples’ attention, and they’ll come around the front to ask questions about your hat!
If your hat has seven rows in front, one of these joints (at the 2 meter mark along the strip) will now be in the very center. You can use this to align the sleeve with the hat, so it’s facing directly forward.
Page last edited April 23, 2014
Text editor powered by tinymce.
Code
Copy-and-paste the code below into a new Arduino sketch. Select your board type (e.g. Arduino Micro) from the Tools→Board menu, then click the Verify icon (the checkmark at the top left). If all goes well, you can connect the board and upload the code.
See the notes following the code for adjustments you may need to make.
If the code fails to compile, this is usually due to a missing library. This sketch depends on four Arduino libraries, and all of them must be correctly named and installed. We have a guide for proper library installation. You may already have some of these installed, but here are all the links for posterity:
If using an earlier version of the Arduino IDE (prior to 1.8.10), also locate and install Adafruit_BusIO (newer versions will install this dependency automatically if using the Arduino Library Manager).
This sketch uses a ton of RAM and won’t work on the common Arduino Uno. The Arduino Micro (and Leonardo) have an extra 512 bytes that are crucial to making this work.
/*--------------------------------------------------------------------------
GUGGENHAT: a Bluefruit LE-enabled wearable NeoPixel marquee.
Requires:
- Arduino Micro or Leonardo microcontroller board. An Arduino Uno will
NOT work -- Bluetooth plus the large NeoPixel array requires the extra
512 bytes available on the Micro/Leonardo boards.
- Adafruit Bluefruit LE nRF8001 breakout: www.adafruit.com/products/1697
- 4 Meters 60 NeoPixel LED strip: www.adafruit.com/product/1461
- 3xAA alkaline cells, 4xAA NiMH or a beefy (e.g. 1200 mAh) LiPo battery.
- Late-model Android or iOS phone or tablet running nRF UART or
Bluefruit LE Connect app.
- BLE_UART, NeoPixel, NeoMatrix and GFX libraries for Arduino.
Written by Phil Burgess / Paint Your Dragon for Adafruit Industries.
MIT license. All text above must be included in any redistribution.
--------------------------------------------------------------------------*/
#include <SPI.h>
#include <Adafruit_BLE_UART.h>
#include <Adafruit_NeoPixel.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_GFX.h>
// NEOPIXEL STUFF ----------------------------------------------------------
// 4 meters of NeoPixel strip is coiled around a top hat; the result is
// not a perfect grid. My large-ish 61cm circumference hat accommodates
// 37 pixels around...a 240 pixel reel isn't quite enough for 7 rows all
// around, so there's 7 rows at the front, 6 at the back; a smaller hat
// will fare better.
#define NEO_PIN 6 // Arduino pin to NeoPixel data input
#define NEO_WIDTH 37 // Hat circumference in pixels
#define NEO_HEIGHT 7 // Number of pixel rows (round up if not equal)
#define NEO_OFFSET (((NEO_WIDTH * NEO_HEIGHT) - 240) / 2)
// Pixel strip must be coiled counterclockwise, top to bottom, due to
// custom remap function (not a regular grid).
Adafruit_NeoMatrix matrix(NEO_WIDTH, NEO_HEIGHT, NEO_PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_ROWS + NEO_MATRIX_PROGRESSIVE,
NEO_GRB + NEO_KHZ800);
char msg[21] = {0}; // BLE 20 char limit + NUL
uint8_t msgLen = 0; // Empty message
int msgX = matrix.width(); // Start off right edge
unsigned long prevFrameTime = 0L; // For animation timing
#define FPS 20 // Scrolling speed
// BLUEFRUIT LE STUFF-------------------------------------------------------
// CLK, MISO, MOSI connect to hardware SPI. Other pins are configrable:
#define ADAFRUITBLE_REQ 10
#define ADAFRUITBLE_RST 9
#define ADAFRUITBLE_RDY 2 // Must be an interrupt pin
Adafruit_BLE_UART BTLEserial = Adafruit_BLE_UART(
ADAFRUITBLE_REQ, ADAFRUITBLE_RDY, ADAFRUITBLE_RST);
aci_evt_opcode_t prevState = ACI_EVT_DISCONNECTED;
// STATUS LED STUFF --------------------------------------------------------
// The Arduino's onboard LED indicates BTLE status. Fast flash = waiting
// for connection, slow flash = connected, off = disconnected.
#define LED 13 // Onboard LED (not NeoPixel) pin
int LEDperiod = 0; // Time (milliseconds) between LED toggles
boolean LEDstate = LOW; // LED flashing state HIGH/LOW
unsigned long prevLEDtime = 0L; // For LED timing
// UTILITY FUNCTIONS -------------------------------------------------------
// Because the NeoPixel strip is coiled and not a uniform grid, a special
// remapping function is used for the NeoMatrix library. Given an X and Y
// grid position, this returns the corresponding strip pixel number.
// Any off-strip pixels are automatically clipped by the NeoPixel library.
uint16_t remapXY(uint16_t x, uint16_t y) {
return y * NEO_WIDTH + x - NEO_OFFSET;
}
// Given hexadecimal character [0-9,a-f], return decimal value (0 if invalid)
uint8_t unhex(char c) {
return ((c >= '0') && (c <= '9')) ? c - '0' :
((c >= 'a') && (c <= 'f')) ? 10 + c - 'a' :
((c >= 'A') && (c <= 'F')) ? 10 + c - 'A' : 0;
}
// Read from BTLE into buffer, up to maxlen chars (remainder discarded).
// Does NOT append trailing NUL. Returns number of bytes stored.
uint8_t readStr(char dest[], uint8_t maxlen) {
int c;
uint8_t len = 0;
while((c = BTLEserial.read()) >= 0) {
if(len < maxlen) dest[len++] = c;
}
return len;
}
// MEAT, POTATOES ----------------------------------------------------------
void setup() {
matrix.begin();
matrix.setRemapFunction(remapXY);
matrix.setTextWrap(false); // Allow scrolling off left
matrix.setTextColor(0xF800); // Red by default
matrix.setBrightness(31); // Batteries have limited sauce
BTLEserial.begin();
pinMode(LED, OUTPUT);
digitalWrite(LED, LOW);
}
void loop() {
unsigned long t = millis(); // Current elapsed time, milliseconds.
// millis() comparisons are used rather than delay() so that animation
// speed is consistent regardless of message length & other factors.
BTLEserial.pollACI(); // Handle BTLE operations
aci_evt_opcode_t state = BTLEserial.getState();
if(state != prevState) { // BTLE state change?
switch(state) { // Change LED flashing to show state
case ACI_EVT_DEVICE_STARTED: LEDperiod = 1000L / 10; break;
case ACI_EVT_CONNECTED: LEDperiod = 1000L / 2; break;
case ACI_EVT_DISCONNECTED: LEDperiod = 0L; break;
}
prevState = state;
prevLEDtime = t;
LEDstate = LOW; // Any state change resets LED
digitalWrite(LED, LEDstate);
}
if(LEDperiod && ((t - prevLEDtime) >= LEDperiod)) { // Handle LED flash
prevLEDtime = t;
LEDstate = !LEDstate;
digitalWrite(LED, LEDstate);
}
// If connected, check for input from BTLE...
if((state == ACI_EVT_CONNECTED) && BTLEserial.available()) {
if(BTLEserial.peek() == '#') { // Color commands start with '#'
char color[7];
switch(readStr(color, sizeof(color))) {
case 4: // #RGB 4/4/4 RGB
matrix.setTextColor(matrix.Color(
unhex(color[1]) * 17, // Expand to 8/8/8
unhex(color[2]) * 17,
unhex(color[3]) * 17));
break;
case 5: // #XXXX 5/6/5 RGB
matrix.setTextColor(
(unhex(color[1]) << 12) +
(unhex(color[2]) << 8) +
(unhex(color[3]) << 4) +
unhex(color[4]));
break;
case 7: // #RRGGBB 8/8/8 RGB
matrix.setTextColor(matrix.Color(
(unhex(color[1]) << 4) + unhex(color[2]),
(unhex(color[3]) << 4) + unhex(color[4]),
(unhex(color[5]) << 4) + unhex(color[6])));
break;
}
} else { // Not color, must be message string
msgLen = readStr(msg, sizeof(msg)-1);
msg[msgLen] = 0;
msgX = matrix.width(); // Reset scrolling
}
}
if((t - prevFrameTime) >= (1000L / FPS)) { // Handle scrolling
matrix.fillScreen(0);
matrix.setCursor(msgX, 0);
matrix.print(msg);
if(--msgX < (msgLen * -6)) msgX = matrix.width(); // We must repeat!
matrix.show();
prevFrameTime = t;
}
}
Adjustments:
- You’ll almost certainly need to change NEO_WIDTH to match the actual circumference of your hat, in pixels. NEO_HEIGHT will likely stay at 7, unless you have an exceptionally small or large hat.
- Some of the pin numbers might need changing to reflect your particular wiring, if you’ve changed things around.
- If you’ve coiled your strip clockwise rather than counterclockwise, or the strip input starts at the bottom rather than the top, you might be able to tweak the remapXY() function to use the strip as-is and not have to re-coil it.
- If you’re using a longer or shorter LED strip, the number 240 should be changed in the NEO_OFFSET definition.
Page last edited April 23, 2014
Text editor powered by tinymce.
Soldering
The Bluetooth LE module is connected to the Arduino’s SPI bus and a few control pins. This is the same wiring scheme as in the Bluefruit LE tutorial, but adapted for the Arduino Micro’s SPI pin arrangement.
SCK, MISO and MOSI connect to the same pins on the Arduino (the latter two are labeled MI and MO on the Micro). REQ goes to pin 10, RDY to pin 2, and RST to pin 9 (ACT is skipped).
The labels on the Arduino Micro pins are very tiny! It may be easier just to count the pin positions in the diagram above.
The NeoPixel data input is connected to pin 6 on the Arduino. That 2-pin plug we salvaged earlier is now used to make the electronics removable for troubleshooting or modifications.
If you have a few different colors of wire, it makes things a little easier to follow, but it’s not required. Just follow very methodically to be certain you’re making the right connections.
After soldering, trim these wires on the back as you did before.
The WHITE wire connects to Arduino PIN 6. The BLACK wire connects to GND (there’s a second GND connection on this edge of the board).
Cut each of the 6 data wires down to its required length, strip the end and solder to the Arduino. Then trim any excess wire on the back.
Here we’ve started with SCK on the Bluefruit board to SCK on the Arduino Micro.
- SCK to SCK
- MISO to MI
- MOSI to MO
- REQ to 10
- RDY to 2
- RST to 9
Page last edited April 23, 2014
Text editor powered by tinymce.
Dry Run
Insert 3 AA alkaline batteries (or 4 NiMH if you’re using that type). Make sure it’s switched OFF for the time being.
Now take two of the 5-wire block connectors and flip open one lever on each…
They also snap shut quite forcefully, so be careful.
If stranded wire, give the ends a slight twist and then “tin” the wires with a little solder.
Connect the JST plug to join the Arduino and NeoPixels.
Then flick the power switch…
- Did you install fresh batteries in the case? Are they each oriented the correct way?
- Look for electrical shorts; + and – may have inadvertently been crossed somewhere.
- Examine the block connectors closely. Are they biting down on wire, or on insulation?
Are you using an Arduino Micro or Leonardo board? Other boards like the Uno don’t have quite enough RAM, and the code will just hang.
The status LED on the Arduino board will flash quickly while it awaits a Bluetooth connection. Running one of the above apps on your phone or tablet, select “Connect” or “UART Monitor.” You may need to select the Bluetooth device from a list. Once a connection has been established, the LED on the Arduino will flash slowly to indicate that it’s working.
If you’re having trouble establishing a connection, try working though the Getting Started with the nRF8001 guide first. Once that’s working, re-upload the Guggenhat code to the Arduino.
Type “HELLO” and press “Send.” This should scroll the word around the hat, illuminated in red LEDs. Try other messages…anything up to 20 characters max. Later we’ll explain how to change colors.
Edit the Guggenhat sketch and change the WIDTH value to this number. Re-upload to the board.
Page last edited April 23, 2014
Text editor powered by tinymce.
Final Assembly
I decided to stick the battery and Arduino inside the hat, so there’s no protruding bits. Except for weather, there’s nothing wrong with keeping everything on the outside! This makes it easier to show others how it works…and you can further decorate it into a steampunk or cyberpunk aesthetic if you like.
Use the solder joint trick on the “Coiling” page to get it straight!
Using a hobby knife, cut a + shape in the hat, just large enough to push the JST connector through.
I’d previously punched holes through the sleeve for the wires to fit through. Not necessary, just me being OCD-retentive. You can cut a notch or simply pass the wires over the top.
Humans are humid. We all release some amount of water vapor through our skin, even if not damp from exertion. If you’re particularly gifted in this department — nothing wrong with that — you might choose to seal the electronics in a conformal spray coating, rubber spray or even a thick acrylic.
Insert a USB cable and cover the wire ends with tape before doing this. Allow a few hours (or overnight) for the sealant to dry before continuing.
The 3xAA holder now in stock features a push button rather than a switch, in a different corner. You’ll probably want this rotated so the button is out near the perimeter of the hat…less likely to be accidentally toggled by the crown of one’s head.
Here I’ve glued pieces of the “hook” side to the back of the battery cover, the Arduino and Bluetooth module.
Nasty stuff, E6000. Put everything out in the garage and do something else for a couple hours while it dries. Play video games. Go for a walk. Practice your posh accent.
I tacked the wires in a few spots with hot glue, and also used this to hold the block connectors in place. Hot glue usually isn’t favored, but I’m using it here because it’s weak…a dab of rubbing alcohol breaks the bond if needed and the parts and wires can be rearranged and re-glued.
This piece is not glued in place, it’s simply cut a bit larger than the hat and stays in place via friction. It’s easy to peel this back and access the power switch and battery box. And you can replace this if it gets a little funky from sweat, hairspray, etc.
Page last edited April 23, 2014
Text editor powered by tinymce.
Use It!
To reiterate: install either the nRF UART app (available for both Android and iOS) or the Adafruit Bluetooth LE Connect app (iOS only) on a late-model phone or tablet that supports Bluetooth LE.
The status LED on the Arduino board will flash quickly while it awaits a Bluetooth connection. Running one of the above apps on your phone or tablet, select “Connect” or “UART Monitor.” Once a connection has been established, the LED on the Arduino will flash slowly.
Type some text (up to 20 characters maximum) and press “Send” to update the scrolling message.
With seven rows of LEDs, certain lowercase letters like ‘j’ or ‘g’ get clipped. Messages tend to look better typed in ALL CAPS.
To change the text color, type a number sign (#) followed by a hexadecimal color value; each digit is in the range 0-F (where A-F equal 10-15). If you’re familiar with HTML color values, it’s essentially the same format, e.g.:
#00ffff
You can also use three-digit hexadecimal color values. This has a smaller available palette, but the color fidelity of this project is limited anyway (more on that below).
Some common colors include:
#f00 Red #0f0 Green #00f Blue #ff0 Yellow (Red + Green) #0ff Cyan (Green + Blue) #f0f Magenta (Red + Blue) #fff White (Red + Green + Blue)
Primary colors (red, green, blue) will use less power, since only a single color within each RGB pixel is lit. White uses the most power; red, green and blue must all combine for this color.
I’ve successfully run the hat for over four hours using incredibly crappy dollar-store AA cells.
The message will freeze (not turn off) as the batteries approach depletion. This is the Arduino locking up as the voltage dips too low. It’s not harmful, just time to change the batteries.
Page last edited April 23, 2014
Text editor powered by tinymce.
Variations
Different Arduino Code
We’re controlling the LED strip using the Adafruit_NeoMatrix library, so it’s easy to display different graphics. All the drawing functions from the Adafruit_GFX library are available. For example, the blinking eyes from this LED matrix tutorial could be adapted.
There are a couple of limitations to keep in mind: first, you can’t light up all (or even most) of the pixels at once, nor at full brightness…this would drain the battery within minutes! Second, 240 NeoPixels use a lot of RAM…and the Bluetooth library needs some as well, if you continue to use that. So, for example, adding a microphone and displaying an audio VU meter using an FFT algorithm is probably asking too much (both in terms of RAM and power consumption), but some variant on the Ampli-Tie project could probably be created, provided you don’t light too many LEDs at once.
Dynamic Messages
If you’re skilled with Android or iOS programming, it should be feasible to send new text to the hat…for example, weather conditions or live stock quotes pulled from the internet. The Bluetooth connection appears as a serial port. The only “gotcha” is that messages must be 20 characters or less, a limitation of Bluetooth LE.
“Invisible” LEDs
A trick learned from this electronic demon costume: you can hide the LEDs (so it looks like a plain hat when they’re off) by pulling a black nylon stocking over it. This blocks about half the light, so it’s best seen in dark settings, or compensate by increasing the LED brightness (with a corresponding decrease in battery life).
8 LED Rows
With only 7 rows of LEDs, the “coiled” hat cuts off descenders (lowercase letters like ‘g’ and ‘j’)…it’s even more pronounced at the back, where there’s only six rows.
Code Changes
A few modifications to the sketch are needed to use this “grid” hat. First, near the top of the code, change these lines:
#define NEO_WIDTH 30 // Hat circumference in pixels #define NEO_HEIGHT 8 // Number of pixel rows
Adafruit_NeoMatrix matrix(NEO_WIDTH, NEO_HEIGHT, NEO_PIN, NEO_MATRIX_TOP + NEO_MATRIX_LEFT + NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG, NEO_GRB + NEO_KHZ800);
matrix.setRemapFunction(remapXY);
Page last edited April 23, 2014
Text editor powered by tinymce.