Thursday, December 15, 2016

Christmas Star Ornament made using Arduino and WS2812b Strips.

Fifteen years ago I build DIY Christmas Star Ornament using 4060, LEDs and simple square wave generator based on 4011. Below you can find photo of it. Last year I made 3D printed case for it to look even more attractive.
Today I build different version of it using Arduino and WS2812b Strips. Of course it is too big to put it on Christmas Tree but will work well for house decoration.



I get star template from internet, scale it up and transfer it to the thick flat Styrofoam coffer ceiling tile. I made border using masking wooden strips. I cut them step by step going around the star. I painted wooden strips using red mordant. I use some ribbon, bauble, and small silver stars to decorate it.

When star was ready I started to work on electronics. I get 5 WS2812b led strips and Arduino Pro Mini. I connected all strips in parallel and connect 5V power source to led strips and Arduino. All data lines I connected to Arduino digital pin 2 and that's all folks.
To program some effects I use Arduino Light Animation (ALA) library.


#include <Ala.h>
#include <AlaLed.h>
#include <AlaLedRgb.h>
#include <ExtNeoPixel.h>
#include <ExtTlc5940.h>
#include <ExtTlc5940Config.h>

#include "AlaLedRgb.h"

#define DELAY_TIME 5000

AlaLedRgb rgbStrip;
int animation = 0;
int palette = 0;
long startTime;

int animList[12] = {
  ALA_SPARKLE,
  ALA_PIXELSHIFTRIGHT,
  ALA_PIXELSMOOTHSHIFTRIGHT,
  ALA_MOVINGBARS,
  ALA_COMET,
  ALA_COMETCOL,
  ALA_GLOW,
  ALA_CYCLECOLORS,
  ALA_FADECOLORS,
  ALA_FIRE,
  ALA_BOUNCINGBALLS,
  ALA_BUBBLES
};

AlaPalette paletteList[5] = {
  alaPalRainbow,
  alaPalRainbowStripe,
  alaPalParty,
  alaPalHeat,
  alaPalFire,
};

void setup()
{
  startTime = millis();
  rgbStrip.initWS2812(10, 2);
  updateAnimation();
}

void loop()
{
  // time action
  if (millis() - startTime > DELAY_TIME)
  {
   startTime = millis();
   animation++;
   palette++;
   updateAnimation();
  }

  rgbStrip.runAnimation();

}

void updateAnimation()
{
  rgbStrip.setAnimation(animList[animation % 12], DELAY_TIME / 2, animList[animation % 12] == ALA_FIRE ? alaPalFire : paletteList[palette % 5]);
}
Hip Hop Christmas by Twin Musicom is licensed under a Creative Commons Attribution license
https://creativecommons.org/licenses/by/4.0/ Artist: http://www.twinmusicom.org/