Spooky Halloween ? Creepy Eyes ? Arduino & RGB LED Strip

Halloween Creepy Eyes Test using Adafruit Arduino FastLED WS2812B Led Strip

Halloween Creepy Eyes Test using Adafruit Arduino FastLED WS2812B Led Strip

With Halloween only a few weeks away, I just had to get started on some related Maker projects! I recently purchased an Adafruit Metro (which is similar to an Arduino Metro) for the purposes of reloading the bootloader onto a corrupt Nano(for another project).

*Disclaimer: Most if not all links on this page will be Affiliate Links. This helps pay for things like website hosting and more bits & gadgets to write about.

Now that the Metro was freed of its bootloader rescue duties, it needed another function. I read about the Blinking Halloween Eye LEDStrip effect project on Tweaking4All which also has other great LED projects, that uses either the FASTled library or the Adafruit Neopixel library.

Having some extra WS2812B Led strips left over from another project (Arduino GPS OLED Speedometer controlling LED Strips for bicycles, etc, which I will hopefully finish soon), this was a perfect match!

Halloween Creepy Eyes using Adafruit Arduino FastLED WS2812B Led Strip setup for testing

I set up an Arduino Sketch with the Tweaking4All code and quickly had some creepy eyes which you can see demoed here:

This was a good start…but with close to 12 feet of LEDs we wanted more Creepy Eyes! #NeedMoreCreepyEyes

We modified the code a little to add more eyes. This was fairly easy to do, mainly because Tweaking4All did a great job of documentation! Please read through their post here: http://www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/#halloween_eyes

This is what we wound up with after tweaking the code:

Full Parts List:

Adafruit Metro – $19.95

(You can also use an Arduino Uno, Nano, etc..)

4 Meters of WS2812B 5V 60Leds/Meter RGB LED Strip Waterproof – ~$33 on Amazon

AmazonBasics Portable Power Bank – 5,600 mAh – $19.99

3 Jumper Wires

(As always I provide Amazon Affiliate Links, but you are free to purchase from anywhere you like!)

wiring-for-halloween-creepy-eyes-using-adafruit-arduino-fastled-ws2812b-led-strip

Only a few LEDs are on simultaneously so you can probably get away powering the LED strip directly from the Arduino, but to be safe I run mine off the USB Battery pack this way:

Wiring Alt for Halloween Creepy Eyes using Adafruit Arduino FastLED WS2812B Led Strip

Adafruit has an excellent guide on wiring up NeoPixel LEDs and I suggest you read that before you wire up you own!

https://learn.adafruit.com/adafruit-neopixel-uberguide/basic-connections

Not the best outside pic, but you get the idea. It seems to work better if you keep them near the same height.

Outside Halloween Creepy Eyes using Adafruit Arduino FastLED WS2812B Led Strip

Arduino Code

You’ll need the FASTLed Library for this project. You can install it either by going to:

Sketch -> Include Library -> Manage Libraries

And then searching for FastLed..or you can install the latest version as a zip from Github: https://github.com/FastLED/FastLED/releases

Screenshot of Add FastLED Library to Arduino IDE

Feel free to change the random time ranges and colors!

The only issue I have is sometimes the eyes overlap, but hey monsters can have 3 or 4 eyes!

If you get the following message when compiling it is just a warning, it will still work.

In file included from /Users/richplakas/Documents/Arduino/Halloween_Blinky_Eyes_Deux/Halloween_Blinky_Eyes_Deux.ino:2:0: /Users/richplakas/Documents/Arduino/libraries/FastLED/FastLED.h:17:21: note: #pragma message: FastLED version 3.001.003 # pragma message “FastLED version 3.001.003”

Sketch:

// FastLed
#include "FastLED.h"

#define DATA_PIN    6
#define LED_TYPE    WS2812B
#define COLOR_ORDER GRB
#define NUM_LEDS    240 // Number of leds you are using
CRGB leds[NUM_LEDS];
#define BRIGHTNESS          96
unsigned long lastLEDUpdate = 0;

void setup() 
{

  // tell FastLED about the LED strip configuration
  FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
  // set master brightness control
  FastLED.setBrightness(BRIGHTNESS);
}

//Credit to Tweaking4ALL for original blinky eye code: http://www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/#halloween_eyes

void loop() {
  // Fixed:
  // HalloweenEyes(0xff, 0x00, 0x00, 1,4, true, 10, 80, 3000);
  // or Random:
  HalloweenEyes(0xff, 0xdf, 0x0d, //Primary Color 1 That Fades
                0xff, 0x00, 0x00, //Primary Color 2 that Does Not fade
                1, random(2,4), 
                true, random(5,50), random(50,150), 
                random(500, 3000));
  HalloweenEyes(0xb7, 0x00, 0xFe, //Secondary Color 1 That Fades
                0xff, 0x00, 0x00, //Secondary Color 2 That Does Not Fade
                1, random(1,4), 
                true, random(15,75), random(100,250), 
                random(500, 3000));
  unsigned long now = millis();
  if ( now - lastLEDUpdate > 10000 ) {
    setAll(0,0,0); // Set all black every 10 seconds
  lastLEDUpdate = now;
  }
  
}

void HalloweenEyes(byte red, byte green, byte blue,
                   byte red2, byte green2, byte blue2,  
                   int EyeWidth, int EyeSpace, 
                   boolean Fade, int Steps, int FadeDelay,
                   int EndPause){
  randomSeed(analogRead(0));
  
  int i;
  int StartPoint  = random( 0, NUM_LEDS - (2*EyeWidth) - EyeSpace );
  int Start2ndEye = StartPoint + EyeWidth + EyeSpace;
  int StartPoint2  = random( 0, NUM_LEDS - (2*EyeWidth) - EyeSpace );
  int Start2ndEye2 = StartPoint2 + EyeWidth + EyeSpace;
  
  for(i = 0; i < EyeWidth; i++) {
    setPixel(StartPoint + i, red, green, blue);
    setPixel(Start2ndEye + i, red, green, blue);
    setPixel(StartPoint2 + i, red2, green2, blue2);
    setPixel(Start2ndEye2 + i, red2, green2, blue2);
  }
  
  showStrip();
  
  if(Fade==true) {
    float r, g, b;
  
    for(int j = Steps; j >= 0; j--) {
      r = j*(red/Steps);
      g = j*(green/Steps);
      b = j*(blue/Steps);
      
      for(i = 0; i < EyeWidth; i++) {
        setPixel(StartPoint + i, r, g, b);
        setPixel(Start2ndEye + i, r, g, b);
      }
      
      showStrip();
      delay(FadeDelay);
    }
  }
  
  //setAll(0,0,0); // Set all black
  
  delay(EndPause);
}


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();
}


1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
Loading...

Reminder, some links in the post might be affiliate links, so I’ll make some coffee/beer/gadget money if you buy anything. You get it at the normal price, though!

Scroll to Top