Halloween Blinky Eyes

I thought I’d share my first completely independent Particle Core project: Blinky Eyes!

This is an LED strip animation which is supposed to resemble pairs of glowing eyes that appear, blink a few times, then disappear again. The idea is that the lights could be hidden in shrubbery, under a porch, behind a dark window, etc, to give the impression of sinister monsters watching from the shadows!

I just got the code working about an hour ago, so it still needs some features and adjustments, but I was just so darned happy to figure out how to pass a pointer to my NeoPixel variable into my animation class, that I had to go ahead and share. Note that I’m currently using my Message Torch setup for testing, but the final idea is to string the lights out.

Here’s my quick test video:

A couple of notes:

  • The eyes are supposed to slowly fade in, blink, then slowly fade out. For some reason, the fade is stuttering. Looking into that.

  • The number of blinks is random, 2-5 times. The blink timing is also randomized.

  • After fading out, the eyes will wait a random amount of time before appearing again.

  • After I fix some things and clean the code up, I’ll share.

6 Likes

That’s awesome! Perfect for Halloween

1 Like

I fixed my stuttering fade issue. It turned out that I accidentally declared a parameter to the function that calculates the fade as a uint8_t, but it was taking in a millis() value, so it should have been uint32_t (or similar 32-bit int).

This evening, I tested using a 2600mAh USB battery pack for power. After about 2.5 hours (roughly), it was still running, but only red LEDs were lighting up. I guess the voltage dropped too low to power the green and blue LEDs. After about another 30-45 minutes, it was exhibiting other odd behavior, such as the “eyes” shining steadily with no blinking, and all turning off at the same time. So I finally unplugged it.

After I play with my code a little more, I might experiment with low power modes and brightness levels. I was instantiating 14 pairs of eyes on 2 meters of 60 LED/m strips. That’s probably a lot more dense than I’ll use in the final version, which will probably have about half that.

I’ll be putting the code up on Github soon, and I’ll do a new video when I have a chance.

1 Like

The code is now up on GitHub!

Any critiques or suggestions are welcome, as are pull requests. Hopefully I can do a new test run video soon to show it in the proper context.

I committed some updates to my code a little while ago. I added some more comments, more logging (all of the state machine transitions are logged now), and fixed a bug that caused the eyes to all turn on at once at the beginning, rather than fading in smoothly, one at a time, at random times.

The next thing I will probably do is re-organize the file structure into a Library that can be added to the Particle Build system.

Feedback and suggestions are welcome!

EDIT: Forgot to add – new video coming soon.

Here’s a new video. This is after I got the code behaving better, with smooth fades. I reduced the number of instances running so that things weren’t so crowded. This was filmed late at night in my family room, with the 2 meters of LED strips stretched out across a loveseat. You can sometimes see a reflection in the windows behind them. I think it’s looking pretty good. :smile:

1 Like

cool…

Is each instance a fixed location or can you have it randomly appear along the strip?

or, I suppose you could just create/destroy instances with a random location any time in the code…

My demo code is just using static locations, but you can change the position. In fact, you could even animate the position, and have eyes slide back and forth along the strip, if you wanted! In fact, you can change pretty much any attributes on-the-fly. You could even fade between different colors, if you wanted. Though, currently, the timing for blinks is random, internally, so you probably couldn’t smoothly fade color completely from start to finish. I’m thinking about refactoring that, though, so that the animation has a set duration, and so the blink randomization is constrained to within that time block.

I’m hoping to find time to write an enhanced demo that will dynamically place the instances, according to where space is available, and programable minimum distance requirements.

I did a new battery life test yesterday. With 8 pairs of eyes (so a possible max of 16 LEDs simultaneously), at 25% brightness (64 out of 255), and no WiFi (MANUAL mode), my 2600 mAh USB battery lasted just short of 8 hours! So, yeah, I’m good to go for Halloween night. :smile:

1 Like

@dougal, Thanks for the project share and inspiration!

My wife and kids cut out a bunch of bats made out of construction paper. They all have googly eyes. I made my own version with two 10mm NeoPixels. The Photon is hidden at the top of the blinds, and the bat hangs with 3 magnet wires. I might add a photoresistor to sense when to turn on the eyes, and I may borrow your code for some blinky-blinky timing and action. :smile:

1 Like