neopixel "animation" library ideas?

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
aaronaverill
 
Posts: 84
Joined: Sun Jun 03, 2018 10:45 am

neopixel "animation" library ideas?

Post by aaronaverill »

I'm building quite a lot of props that use neopixel strips, mostly laid out linearly. Imagine a vertical clear PVC light pole with a 5 meter neopixel strip running thru it. Some are in matrixes, although not regular X by Y arrays.

Generally I want to run an animation for 5-30 seconds or so, then switch to another, then another. Ideally there will be dozens... maybe as much as 100 different animations. Switches and other things might trigger particular animations. All the animations loop while active.

So far, all the examples I've seen for neopixels are using code to set the pixels. Are there libraries or examples I can use where this is more data driven? Perhaps using python to load a file for an animation that loops, then go to the next one? With the feather express I've got 256kb of flash I can store animations on.

I would also need a program to generate these animations and store them as binary files I guess. Does such a thing exist, or do I need to invent it?

The ideal scenario would be to load an animated GIF file 1 pixel tall that I create using normal software, and just "play" it on the neopixels.

Thoughts?

User avatar
aaronaverill
 
Posts: 84
Joined: Sun Jun 03, 2018 10:45 am

Re: neopixel "animation" library ideas?

Post by aaronaverill »

Update. So I did found this:

https://github.com/pixelmatix/AnimatedGIFs

Which is arduino based and C++ not python (shudder). I would REALLY like a circuit python solution because it's so easy. :)

I suppose I could BANNED this code and port it to micropython?

User avatar
tannewt
 
Posts: 3315
Joined: Thu Oct 06, 2016 8:48 pm

Re: neopixel "animation" library ideas?

Post by tannewt »

Sounds like a cool idea! I'd suggest hopping into the Discord and the #circuitpython channel. (https://adafru.it/discord) Roy there is doing NeoPixel optimizations and would likely want to collaborate on animation libraries.

~Scott

User avatar
aaronaverill
 
Posts: 84
Joined: Sun Jun 03, 2018 10:45 am

Re: neopixel "animation" library ideas?

Post by aaronaverill »

So I took it upon myself to write a python class that loads a BMP file which can be used as a sprite for animation. It was a good python learning experience.

The main loop increments a pixel offset into the image in each loop iteration and refreshes the neopixels. It's about 100 lines of code and works perfectly for the low-fi stuff I'm doing. I can use an any image editing program to create and save the sprite files (including paint!), and see all the frames in one big strip. It is trivial to load a new animation file from the flash drive, or get a directory of animations and loop thru them every 30 seconds.

I'm using it on a 4x8 neopixel feather wing, works great. Got a 150 pixel neopixel strip coming next week I can see how it responds.

If anyone comes across this and wants to give it a whack I'll need some assistance on git project layout and standards and such like. Precompiling it to an mpy would be useful too I think. I'll try connect with Roy

User avatar
aaronaverill
 
Posts: 84
Joined: Sun Jun 03, 2018 10:45 am

Re: neopixel "animation" library ideas?

Post by aaronaverill »

Ok, well, this is done now. Feel free to use it. The source includes sample code and animated sprites in 24, 8 and 4 bit BMPs.

https://github.com/aaronaverill/CircuitPython_NeoSprite

User avatar
aaronaverill
 
Posts: 84
Joined: Sun Jun 03, 2018 10:45 am

Re: neopixel "animation" library ideas?

Post by aaronaverill »

A few videos of the project (in progress) that I'm building with the animation library.

https://www.youtube.com/watch?v=XaCqrlE20PE

https://www.youtube.com/watch?v=IeuKjV6uMBE

User avatar
gallaugher
 
Posts: 267
Joined: Tue Aug 14, 2018 12:42 pm

Re: neopixel "animation" library ideas?

Post by gallaugher »

These look great! Have you done a tutorial? Especially like the first one with arrows animated on the tube. Thanks for sharing.

User avatar
aaronaverill
 
Posts: 84
Joined: Sun Jun 03, 2018 10:45 am

Re: neopixel "animation" library ideas?

Post by aaronaverill »

Oh, like an instructable, no I never did one :)

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

Return to “Adafruit CircuitPython”