Close
0%
0%

Starbucks Arduino Neopixel Name Badge

Pedagogue

Similar projects worth following

...for a friend.

Notation(s)

1. First build utilized (2) 3V coin cells which ran the (8) Neopixels for approximately 2 hours before stalling the code for roughly (4) hours: https://www.reddit.com/r/starbucks/comments/d54fus/im_a_robotics_engineering_teacher_in_addition_to/

2. Shd an ATTiny85, Micro or Trinket magically appear dot dot dot a Nano is what was on hand.

3. Testing 3.7 (720mAh) LiPo life span now -- so far 7+ hours...

bux_badge_housing_1.skp

Components Housing Template

SSEYO Koan Play File - 370.18 kB - 09/21/2019 at 23:45

Download

bux_badge_name_1.skp

Name Badge (Top) Template

SSEYO Koan Play File - 282.69 kB - 09/21/2019 at 04:31

Download

  • 1 × Arduino Nano (or ATTiny85)
  • 1 × Neopixel Strip (8 LEDs)
  • 1 × Toggle Switch
  • 1 × 150ohm Resistor
  • 1 × 10uf Capacitor

View all 8 components

View all 3 project logs

  • 1
    Mocha Capcodeino

    Slight modification from FastLED's Demo100 code...

    #include <FastLED.h>
    
    FASTLED_USING_NAMESPACE
    
    #define DATA_PIN    5
    #define LED_TYPE    WS2812B
    #define COLOR_ORDER GRB
    #define NUM_LEDS    8
    CRGB leds[NUM_LEDS];
    
    #define BRIGHTNESS          50
    #define FRAMES_PER_SECOND  100
    
    void setup() {
      delay(1000);
      FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
      FastLED.setBrightness(BRIGHTNESS);
    }
    
    typedef void (*SimplePatternList[])();
    SimplePatternList gPatterns = { rainbowWithGlitter, confetti, sinelon, juggle, sparkle_go};
    
    uint8_t gCurrentPatternNumber = 0;
    uint8_t gHue = 0;
    
    void loop()
    {
      gPatterns[gCurrentPatternNumber]();
      FastLED.show();
      FastLED.delay(1000 / FRAMES_PER_SECOND);
      EVERY_N_MILLISECONDS( 20 ) {
        gHue++;
      }
      EVERY_N_SECONDS( 10 ) {
        nextPattern();
      }
    }
    
    #define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
    
    void nextPattern() {
      gCurrentPatternNumber = (gCurrentPatternNumber + 1) % ARRAY_SIZE( gPatterns);
    }
    
    void rainbow() 
    {
      fill_rainbow( leds, NUM_LEDS, gHue, 7);
    }
    
    void rainbowWithGlitter() {
      rainbow();
      addGlitter(80);
    }
    
    void addGlitter( fract8 chanceOfGlitter) {
      if ( random8() < chanceOfGlitter) {
        leds[ random16(NUM_LEDS) ] += CRGB::White;
      }
    }
    
    void confetti() {
      fadeToBlackBy( leds, NUM_LEDS, 10);
      int pos = random16(NUM_LEDS);
      leds[pos] += CHSV( gHue + random8(64), 200, 255);
    }
    
    void sinelon() {
      fadeToBlackBy( leds, NUM_LEDS, 20);
      int pos = beatsin16( 13, 0, NUM_LEDS - 1 );
      leds[pos] += CHSV( gHue, 255, 192);
    }
    
    void juggle() {
      fadeToBlackBy( leds, NUM_LEDS, 20);
      byte dothue = 0;
      for ( int i = 0; i < 8; i++) {
        leds[beatsin16( i + 7, 0, NUM_LEDS - 1 )] |= CHSV(dothue, 200, 255);
        dothue += 32;
      }
    }
    
    void sparkle_go() {
      Sparkle(0x00, 0x00, 0xff, 10);
    }
    
    void Sparkle(byte red, byte green, byte blue, int SpeedDelay) {
      for (int i = 0; i < 20; i++) {
        int Pixel = random(NUM_LEDS);
        setPixel(Pixel, red, green, blue);
        showStrip();
        delay(SpeedDelay);
        setPixel(Pixel, 0, 0, 0);
      }
    }
    
    void fadeToBlack(int ledNo, byte fadeValue) {
    #ifdef ADAFRUIT_NEOPIXEL_H
      // NeoPixel
      uint32_t oldColor;
      uint8_t r, g, b;
      int value;
    
      oldColor = strip.getPixelColor(ledNo);
      r = (oldColor & 0x00ff0000UL) >> 16;
      g = (oldColor & 0x0000ff00UL) >> 8;
      b = (oldColor & 0x000000ffUL);
    
      r = (r <= 10) ? 0 : (int) r - (r * fadeValue / 256);
      g = (g <= 10) ? 0 : (int) g - (g * fadeValue / 256);
      b = (b <= 10) ? 0 : (int) b - (b * fadeValue / 256);
    
      strip.setPixelColor(ledNo, r, g, b);
    #endif
    #ifndef ADAFRUIT_NEOPIXEL_H
      // FastLED
      leds[ledNo].fadeToBlackBy( fadeValue );
    #endif
    }
    
    void showStrip() {
     #ifdef ADAFRUIT_NEOPIXEL_H
       // NeoPixel
       strip.show();
     #endif
     #ifndef ADAFRUIT_NEOPIXEL_H
       // FastLED
       FastLED.show();
     #endif
    }
    
    void setPixel(int Pixel, byte red, byte green, byte blue) {
     #ifdef ADAFRUIT_NEOPIXEL_H
       // NeoPixel
       strip.setPixelColor(Pixel, strip.Color(red, green, blue));
     #endif
     #ifndef ADAFRUIT_NEOPIXEL_H
       // FastLED
       leds[Pixel].r = red;
       leds[Pixel].g = green;
       leds[Pixel].b = blue;
     #endif
    }
    
    void setAll(byte red, byte green, byte blue) {
      for(int i = 0; i < NUM_LEDS; i++ ) {
        setPixel(i, red, green, blue);
      }
      showStrip();
    }

View all instructions

Enjoy this project?

Share

Discussions

Dan Maloney wrote 09/23/2019 at 15:30 point

Next up: Vije builds a robot to automate the creation of froth art, or whatever you call that stuff they do on the top of the foam.

  Are you sure? yes | no

Vije Miller wrote 09/23/2019 at 18:07 point

No no ... aye think they mastered that one to its inevitable extreme already https://www.drinkripples.com/

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates