Particle Christmas Tree - More LED Animations?

Picture is from @nrobinson2000

I received Particles really cool Wifi Christmas Tree Ornament last week and we really love it!

Thanks, @mohit @will @zachary @zach @BDub @Dave and whole rest of the :spark: Team :slight_smile:

I’ve figured out how to add more music to it but adding more Dotstar LED animations is taking more time as I learn how to swap Neopixel code to control the Dotstars.

I found some other LED patterns being used on this Christmas tree on the web and was hoping maybe that code was available somewhere to be used with the tree also?

The Dotstar LED’s are small but still super bright and colorful. Never seen 2020 Dotstar’s before but these are impressive!

If you don’t have your Particle Christmas Tree Ornament you can pick them up here:

https://store.particle.io/products/holiday-tree-pcb

10 Likes

DotStar (aka AP102) protocol is simple. You can have a look here

1 Like

Check this PR for how to add a new animation and this PR for how to add a new song.

4 Likes

@jvanier Just loaded your new Tree Code and where you added the Redgreen amination the green shows up Blue.

I changed the RGB value to what you see below and now the LED’s show RED and Green vs RED and Blue.

void redGreen(uint8_t wait)
{
    uint16_t j = 0;
    while(true) {

        if (changeAnimation)
            return;

        for (uint16_t i = 0; i < leds.numPixels(); i++) {
            leds.setPixelColor(i, (i + j) % 3 == 0 ? leds.Color(255,0,0) : leds.Color(0,0,255));
        }
        j = (j + 1) % 3;

        leds.show();
        delayAnimation(wait);
    }
}

There’s another line in the PR to fix the color ordering :grin:

Adafruit_DotStar leds = Adafruit_DotStar(TOTAL_LED, PIN_LED_DATA, PIN_LED_CLOCK, DOTSTAR_BGR);

Is it possible to have the tree start with no animation and no music by default?

Looking at using the cheerlights as the default animation.

Yes, you just need to change the state machine code for the startup state.

It is almost time to pull out the Particle Tree isn’t it!

Specifically can you point me to what change needs to happen. In the code I find the int currentState = STATE_NONE but don’t find any other location for a machine start up state.

Sean Monaghen

Found it.

Way at end of code. Changed playAnimation(“0”)

To

stopAnimation(“”)

Sean Monaghen

1 Like

Nice!

I just pulled out my Particle Tree and am about to load the code onto it

:spark: :christmas_tree: :particle:

I made a few different versions of the cheerlights display.

This one shows the current and previous 24 colors alternating down the sides of the tree.

This one is mostly green with the branch tips being the last six colors. The top is current color.

Last is this one that does the current and previous two colors as a layer cake.

–Edited–

Additional history style tree. Top LED (12) is current color. History starts lower left (0) and rotates around the tree clockwise. I have two LEDs (11 and 13) off to make the current color have some isolation.

1 Like

I tried the first 2 examples you provided on Photon running firmware 2.0 and it causes a instant RED SOS message. Not sure why.

After 2 of my Photons updated to the 2.0 Firmware the Christmas Tree code no longer runs, it’s just flashes RED SOS as soon as it connects to the internet.

Anybody else have their Particle Christmas Tree up and running on firmware 2.0??

@jvanier @mohit @peekay123 not sure who all has these trees :spark: :christmas_tree: :spark:

One change in 2.0.0 was that you will now get a SOS panic when any function declared to return a value fails to actually return such value in any code path of the function. Before you just got random return values but now you get an SOS panic crash.

e.g. here

3 Likes

Thanks!

That explains it!

I just downgraded to 1.5.4 and all is good again.

No time to mess with the code right now but this is good to know.

I too had to force my trees to use 1.5.4 otherwise the instant SOS.

It should be an easy fix.
Just add return strtol(color, NULL, 0); at the end of playLED() and you should be set for 2.0.0 too.

Thank you the return strtol(color, NULL, 0); does eliminate the instant SOS

1 Like

I tried your animations but they on power up they just start but do not animate.

I assume they need something sent from Thingspeak?

I don’t use Thingspeak so is there a easy way to make them run without needing to setup things speak?

Sure would like some new animations to play.

Mine are not animations. They show the current cheerlights colors. The history ones take time to fill as they only add as people tweet new colors.

Sean Monaghen