NeoPixel Gas Mask

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
The_lone1
 
Posts: 6
Joined: Tue Nov 05, 2013 5:31 pm

NeoPixel Gas Mask

Post by The_lone1 »

I'm currently starting a new build, inspired by the 3D printed NeoPixel Gas Mask, and I'm looking for some advice.

I've yet to receive any of the electronic gubbinz, but I have made sure to read the Über guide, and browsed all the code I could find on Learn. I have come up with a circuit layout shown in the attached image.
The circuit will consist of a Gemma, 4 NeoPixel Rings (2x24, 2x16) chained together from D0, a mic on D2, and a LiPo with a switch on the positive line (the switch will always be 'off' when connecting/disconnecting the battery) .
I'd like a sanity/fact check on a few things:

First, am I right in thinking the rings already have a resistor in series with the input terminal, and thus I don't need to include one on the D0 line?

Second, from what I understand about programming in C/C++ and the Arduino IDE, chaining the four rings together and declaring a single object should be more efficient space-wise (less overhead), and time-wise (only one object to update), than using two pins and two objects.

Third, would a reasonable capacity LiPo (single cell, 3.7-4.2V) connected through the JST be able to supply enough current through the Vout pin on the Gemma (I'm looking at 80 pixels, for a theoretical maximum draw of 4.8A, but probably around 500mA)?

Fourth, the ground pin on the Gemma has a direct connection to the JST, and thus the placement of the power switch means GND is always connected first when I make sure the switch is 'off'.

Fifth, I understand the outer dimension of the 24-pixel ring is 66mm/2.6", which I assume is the diameter of the circuit board. What is the clearance between the edge of the pixels, and the edge of the board?

Sixth, for the audio reactive element, I was planning to initially just use the raw ADC values (scaled appropriately) to control either the brightness or perhaps the number of pixels on at a given moment. If I later want to do more fancy stuff, such as reacting to the frequency content, would the recommended FFT library fit on/work with the Gemma, or would I need to cobble together my own code?

Finally, is the placement of the power rails on the rings (one line to each pair) sufficient, or would each ring need its own line?

I'd also appreciate any other guidance you can offer.
Sorry for the mix of questions and statements :/

Stay tuned for my (possibly misguided) code :B
Attachments
Gemma_Neo_rings_bb.png
Gemma_Neo_rings_bb.png (213.99 KiB) Viewed 394 times

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: NeoPixel Gas Mask

Post by adafruit_support_bill »

Taken in order:

You do not need a termination resistor as one already exists on the rings.

If the rings will be operated more-or-less synchronously, coding them as a single object is somewhat more efficient. If they need to operate independently, it could end up being grossly less efficient.

The 1300mAh cell in your diagram is rated for up to a 1/2C discharge rate or 650mA.

Your switch wiring is good.

Not sure offhand, you should be able to find that here: https://github.com/adafruit/Adafruit-NeoPixel-Ring

I don't think you could squeeze an FFT into a Gemma - especially with half the SRAM already occupied by pixel data.

Power rails look fine. If you were driving them to the max on a regular basis I'd recommend separate feeds, but then you would need a bigger battery too.

The_lone1
 
Posts: 6
Joined: Tue Nov 05, 2013 5:31 pm

Re: NeoPixel Gas Mask

Post by The_lone1 »

Thanks for the info Bill.

In regards to the battery, the one I picked was the first one I found in Fritzing, meant to be illustrative of the set-up. However, it seems I may need to invest in one around that size.

As for the program, I was planning simple spinning circles, so there'd be no more than 8 on in the larger rings, and 4 in the smaller (for a total of 24 on at any given moment), and scaling the brightness based on the analogue input, between some min/max values (no more than half brightness to save the battery). This gives an estimate of around 720mA for half-bright-white (I'll probably pick some shade of green or red, or possibly have a slow colour cycle).

I was wondering if you had any recommendations on where to read up about program size, and where everything goes. I'm going to take a look at the ATTiny docs, but I'd welcome suggestions for further reading.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: NeoPixel Gas Mask

Post by adafruit_support_bill »

Using primary colors such as red, green or blue cuts your current requirements by 2/3. And on most wearable projects, the leds can be run at considerably less than full-intensity with good effect.

This tutorial describes the memory usage in an Arduino. Most of it is also applicable to the ATTiny - just less of everything is available.
http://learn.adafruit.com/memories-of-an-arduino

The_lone1
 
Posts: 6
Joined: Tue Nov 05, 2013 5:31 pm

Re: NeoPixel Gas Mask

Post by The_lone1 »

All the bits have arrived (a little sooner than I was expecting :)), and I've successfully uploaded the 'Blink' program to my Gemma. I did notice however, that I still get one line of the "expected 4, got -5" error (but not hundreds). Is this normal?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: NeoPixel Gas Mask

Post by adafruit_support_bill »

Yes, that does happen sometimes. As long as the code uploads and executes, you can ignore the error message.

The_lone1
 
Posts: 6
Joined: Tue Nov 05, 2013 5:31 pm

Re: NeoPixel Gas Mask

Post by The_lone1 »

[EDIT] The code works fine. I need to tweak colour/brightness/timings, but other than that, it's great[/EDIT]

Ok, so here's the first draft of the code (as you can see in the info section, it's shamelessly ripped from the kaleidoscope eyes code).

You'll notice a fair few constants commented out; at first I was going to use them, then I didn't. I left them in partly as reminders, but also incase I implement fancy effects at a later time.
I've yet to test the code itself (I'm still making the hardware to fit it all in the mask, and once it's soldered together, it's not coming apart without unsoldering it), so I have no idea at this time if the code works, but in the mean-time, I'd appreciate any pointers, or indeed any fixes to silly mistakes I missed.
The code compiles, and only takes up about half the flash (so far), and my guess is that it'll take up about 200 or so bytes of the SRAM, mostly for the pixels.

Code: Select all

// neoGaskMask
// NeoPixel rings in a half-mask respirator
// Uses Gemma, 2x24 rings, 2x16 rings

// Code Shamelessly stolen from Phillip Burgess'
// Kaleidoscope Eyes https://learn.adafruit.com/kaleidoscope-eyes-neopixel-led-goggles-trinket-gemma/software
// Modified by Greg Milway

// TO DO:  1) Add in sound reactive awesomeness
//         2) Hack together some horrible kludge to fake FFT like stuff for more advanced bits
//         3) Build the damned thing! (should probably be number 1 on this list)

#include <Adafruit_NeoPixel.h>
#include <avr/power.h>

#define PIN 1

Adafruit_NeoPixel rings = Adafruit_NeoPixel(80, PIN);

uint8_t  //L_O    = 0,  //Left outer start
         //L_I    = 24, //Left inner start
         //R_O    = 40, //Right outer start
         //R_I    = 64, //Right inner start
         //lenI   = 15, //inner ring 'length' 
         //lenO   = 23, //outer ring 'length'
         offset = 0; //offset for spinny ring effect
uint32_t colour = 0xC000D0; //Nice purple colour

void setup() {
 #ifdef __AVR_ATtiny85__ // Trinket, Gemma, etc.
  if(F_CPU == 16000000) clock_prescale_set(clock_div_1);
 #endif
  rings.begin();
  rings.setBrightness(85); // 1/3 brightness
  rings.show();
}

void loop() {
  uint8_t i;
  
  //setup outer rings
  for(i=0; i<24; i++) {
    uint32_t c = 0;
    if(((offset+i) %12) <3) c = colour; // %12 <3 = 6/24 pixels on
    rings.setPixelColor( 0 + i, c); //left outer ring, forward
    rings.setPixelColor(63 - i, c); //right outer ring, reverse
  }
  for(i=0; i<16; i++) {
    uint32_t c = 0;
    if(((offset+i) %8) <2) c = colour; // %8 <2 = 4/16 pixels on
    rings.setPixelColor(39 - i, c); //left inner ring, reverse
    rings.setPixelColor(64 + i, c); //right inner ring, forward
  }
  rings.show();
  offset++;
  delay(50);
}

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”