Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!



Help with Meteor Ra...
 
Share:
Notifications
Clear all

[Solved] Help with Meteor Rain

3 Posts
2 Users
0 Reactions
1,353 Views
(@Anonymous)
Joined: 1 second ago
Posts: 0
Topic starter  

Hi all

First I want to say what an amazing website have you created, really helpfull.

My partner and I are creating a giant bat puppet show to take to festivals in UK and hopefully around Europe in the future. We wanted from the begining of the project to have a nice LED effect on the wings so during night time shows it will be extra interesting.

I was the one who put myself in the position of learning how to make it work (without knowing what of a ridiculous amount of information I will need to read and learn to achieve our goal, as just learnt a bit of programming when I was in university). After a few weeks of reading, doing some practice code and learning how different codes work, I'm still not capable to reach the kind of effect we want. Now we have only 2 weeks until we film a promotional video and I'm getting a bit nervious in case I can not achieve something good enougth. I have seen how you have been helping other people and wonder if you can give me a hand, which will be much appreciated. 

My partner really likes your Meteor Rain effect, but we want to achieve something a bit more complex. 

We are using an Arduino Nano, with 8 LED strips, 4 on each wing. They are conected to pins 2, 3, 4, 5, 7, 8, 9 and 10. The first four are part of one wing and the rest of the other wing. Each of the strips are 57 LEDs long, with a density of 60 per meter.

I'm using the FastLed library because it looks like it is the one with smaller code to compose to achieve the same and also reading around internet, it seems to be easier to learn.

The effect I'm trying to achieve is :

The meteor is going through the LED strips (all of them as the same time) and instead of going back to black I want them to go into a palette of colors that change gradually, until the next meteor comes. Some waves/twinkle in the colors to get a textured gradient would be great. 

Any help or advice that you can give me to be able to reach that kind of effect would be much appreciated.

Thanks


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
 

Let me see if I can help ... it looks like a sizable project 😉 
Note: FastLED is indeed your best choice here - more mature/advanced and faster than the alternatives like NeoPixel.

I guess the first question is: these 8 strips are allowed to run the same effect at the same time? Meaning: the look and behave identical?
If so, then you can make life easier by connecting all 8 strips to one and the same pin - instead of 8 individual pins.
Ideally when all strips are the same length, and if not: set NUM_LEDS to length of the longest strip.

Running 8 effects in parallel can really quickly become a pain if they need to be "different".

Next challenge is fading to a palette of colors. I have never done this, so my initial approach would be to write a function that replaces the fadeToBlackBy function.

In the meteor rain function, we call something like this to fade to black:

    // fade brightness all LEDs one step
    for(int j=0; j<NUM_LEDS; j++) {
      if( (!meteorRandomDecay) || (random(10)>5) ) {
        fadeToBlack(j, meteorTrailDecay );        
      }
    }

 

Now the functions basically grabs the existing LED color and slowly shifts to the color we want (black). So in your case you'd need to make that shift to the color in your palette.

// used by meteorrain
void fadeToBlack(int ledNo, byte fadeValue) {
   // read current LED color
   // shift color to palette color
   // to replace this:
   leds[ledNo].fadeToBlackBy( fadeValue );
}

 

FastLED has a few functions that could be helpful with this: fadeUsingColor() and blend() where blend() is the one you may be looking for (from what I found online). In all fairness, I have never had a use for these, so I'm not an expert 😉 

I suspect it works something like this:

leds[j] = blend(leds[j], CRGB::Orange, speed);

 

Where CRGB::Orange is your target color (I just picked one), and "speed" a number used to define the increments.
You may have to play with this to see if you get it to work to your liking.

Now we theoretically have something that fades to orange but you were looking to use a palette of colors.

Ideally, I'd make a palette with colors (a CRGB array) with an index like we see with the "leds" CRGB array. I hope that makes a little sense.
Kind-a like a second LED array, just with fixed color numbers in it (your palette).

As an alternative, FastLED does have some palette specific functions that may be helpful.
Check out Paletteknife and this FastLED example.

I have not yet worked with palette's ... it's on my to-do list 😁 


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
 

Forgot to mention: Wokwi can be helpful when testing. For example this palette example code.


   
ReplyQuote
Share: