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 most likely no translated for the post!





Light box powered b...
 
Share:
Notifications
Clear all

Light box powered by Arduino Uno using WS2812B leds and FastLED library


 lino
(@lino)
Active Member
Joined: 4 months ago
Posts: 10
Topic starter  

Hi to all

 

I'm new to the arduino platform, and following Hans's advice I managed to make a lamp with a RGB led strip. While browsing the internet, I came across this video, and the effects are beautiful. Help me with the program to have the same sequence! Thanks in advance to those who will help me.

 

 


ReplyQuote
Topic Tags
 Hans
(@hans)
Noble Member Admin
Joined: 8 years ago
Posts: 1767
 

Hi lino!

It looks like quite a few effects can be found in my articles.

One important note:
George used the (what I like to call) the "Toilet paper effect" - by adding a frosted piece of glass or plexiglass before the LEDs.
Which gives it this nice diffuse effect.

I guess now the question is: what are you looking for?
The LED Effects articles (the first LED Effects article, the All-in-One LED Effects article, and the initial Controlling LEDs with Arduino article) cover most of it.

What do you have in mind? Matching the exact thing George did?


ReplyQuote
 lino
(@lino)
Active Member
Joined: 4 months ago
Posts: 10
Topic starter  

Hi Hans

Yes, I would like to reproduce George's sketch exactly. I first tried with the "Pacifica" effect found in the Fastled library examples. But it seems to me very different from that of the video (at 2:00) not only for the colors. Is it possible that it's all about the toilet paper effect? Also I don't understand how to sketch from scratch and paste the various effects, as each effect has variable declarations in the void setup () section. How you do it? Please help me. Thank you!


ReplyQuote
 Hans
(@hans)
Noble Member Admin
Joined: 8 years ago
Posts: 1767
 

Hi Iino,

reproducing the sketch of another person will take quite a bit of work, so my first recommendation would be to contact George (who posted the video on YouTube) since he actually has the sketch 😉 
From what I could read with the video, George is not willing to share to sketch due to being code shy (I totally get that, I have that at times as well).

The toilet paper effect just diffuses the light, making it much nicer to look at. So it may very well be that this makes the difference.
Compare the videos here to see what the impact could be.

If you want to continue then we'd first have to make a list of the effects his video is showing, so we can see where to get them.
As I understand, some came from my sketches, so those wouldn't be too hard to get.
My effects have the bouncing ball as well. So I'm sure most are covered in my sketch.

Try and see if you can find all the effects in the all-in-one article.
If so, then we just have to modify that sketch to run the effects in the sequence George used.


ReplyQuote
 lino
(@lino)
Active Member
Joined: 4 months ago
Posts: 10
Topic starter  

I have found some effect used by George (Confetti and Sinelon) in Demoreel sketch ( https://github.com/FastLED/FastLED/blob/master/examples/DemoReel100/DemoReel100.ino )

Ok I'll try to make a list of the effects and then let's try to combine them all together. 


ReplyQuote



 lino
(@lino)
Active Member
Joined: 4 months ago
Posts: 10
Topic starter  

Effect list of George: (i think...)

Confetti                                   (from Demoreel)

Bouncing Balls                        (Hans)

Multi Color bouncing balls      (Hans)

Rainbow Cicle                         (Hans)

Juggle                                     (from Demoreel)

Sinelon                                    (from Demoreel) 

Fire                                          (Hans)

Rainbow Cicle  again               (Hans)

 

loop

 


ReplyQuote
 Hans
(@hans)
Noble Member Admin
Joined: 8 years ago
Posts: 1767
 

At first glance, Confetti, Juggle  and Sinelon are relatively easy functions to merge into existing code.
Assuming you'll be using the FastLED library, since they use FastLED specific functions, like random16, beatsin16 , CHSV and fadeToBlack.

void confetti() 
{
  // random colored speckles that blink in and fade smoothly
  fadeToBlackBy( leds, NUM_LEDS, 10);
  int pos = random16(NUM_LEDS);
  leds[pos] += CHSV( gHue + random8(64), 200, 255);
}

void sinelon()
{
  // a colored dot sweeping back and forth, with fading trails
  fadeToBlackBy( leds, NUM_LEDS, 20);
  int pos = beatsin16( 13, 0, NUM_LEDS-1 );
  leds[pos] += CHSV( gHue, 255, 192);
}

void juggle() {
  // eight colored dots, weaving in and out of sync with each other
  fadeToBlackBy( leds, NUM_LEDS, 20);
  byte dothue = 0;
  for( int i = 0; i < 8; i++) {
    leds[beatsin16( i+7, 0, NUM_LEDS-1 )] |= CHSV(dothue, 200, 255);
    dothue += 32;
  }
}

 

However, these functions have been written with loops in mind so after each call of a function one will need to do this to make it visible:

FastLED.show(); 

 Additionally a global variable is being used called gHue:

uint8_t gHue = 0;

 

The code in DemoReel100 uses nicely the EVERY_N_MILLISECONDS and EVERY_N_SECONDS macros, and the option to pass a value to FastLED.show().
For beginners this may be a little bit daunting, and personally I do not use these options too often because of that.

So instead of using EVERY_N_MILLISECONDS you could try something like this, for example for confetti:

...

uint8_t
gHue = 0;

...

void setup() {
...
}

void loop() {
confetti(); // Do a step for Confetti
FastLED.show(); // show the current step
delay(20); // wait 20 milliseconds before doing the next step in Confetti
gHue++;
}

This will do a confetti step, show the step result (leds change color), wait 20 milliseconds, increase hue, and do it all again since the loop will keep repeating itself.
It would almost be the same as using the EVERY_N_MILLISECONDS.
EVERY_N_MILLISECONDS however is a macro which may result in better timing - but I found that with effects, timing isn't always (!) that critical.

The DemoReel changes effect every 10 seconds (EVERY_N_SECONDS), but we can do this "manually" as well.

For example: You could put that in a loop, so that it does for example Confetti 100 times, so it can do the next effect after competing that. For example:

void loop() {
  for(int i=0; i<100; i++) { // 100 times confetti
confetti(); // Do a step for confetti FastLED.show(); // show the current step delay(20); // wait 20 milliseconds before doing the next step in confetti
gHue++;
}

for(int i=0; i<100; i++) { // 100 times sinelon
sinelon(); // Do a step for sinelon
FastLED.show(); // show the current step
delay(20); // wait 20 milliseconds before doing the next step in sinelon
gHue++;
} }

The same way you can add Juggle.

Play with it and see how it does 😀 


ReplyQuote
 lino
(@lino)
Active Member
Joined: 4 months ago
Posts: 10
Topic starter  

I tried to put confetti and sinelon to try. But it seems that the 2 effects overlap


ReplyQuote
 lino
(@lino)
Active Member
Joined: 4 months ago
Posts: 10
Topic starter  

after countless tests... I made it!!

😊 😋 

Thanks for help!

 

P.S: Is there a system to turn off the led on the board?


ReplyQuote
 Hans
(@hans)
Noble Member Admin
Joined: 8 years ago
Posts: 1767
 

That looks great! And ... most of it you did yourself - well done 😁 👍 

As far as I know, the power LED is hardwired, so the only way to turn it off is by unplugging the power (not what you'd want), by removing the LED (really cannot recommend that), or by putting some black electrical tape over it (note perfect, but pretty safe). 

p.s. would you mind mentioning Tweaking4all under your YouTube video? I can always use some extra reference to my website 😉 


ReplyQuote



 lino
(@lino)
Active Member
Joined: 4 months ago
Posts: 10
Topic starter  

Of course, I link you in the video description.


ReplyQuote
 Hans
(@hans)
Noble Member Admin
Joined: 8 years ago
Posts: 1767
 

Awesome ! Thank you - it is very much appreciated! 😊 

 


ReplyQuote
 lino
(@lino)
Active Member
Joined: 4 months ago
Posts: 10
Topic starter  

I made another lamp with chinese bamboo chargers. The height is 90 cm x diameter 12 cm (like CD ROM :P)

Same sketch, but looks more beautiful.

 

 


murad liked
ReplyQuote
 Hans
(@hans)
Noble Member Admin
Joined: 8 years ago
Posts: 1767
 

Very nice!!!! 👍 

I've been thinking about something like that as well, by using plastic/plexiglass matte tubes. Only to find out that those are available, but not exactly cheap.
So I'll wait until I find a source to get those.
One idea I had was to use the fire effect as VU meters ... responding to sound/music.


murad liked
ReplyQuote

Like what you see and you'd like to help out? 

The best way to help is of course by assisting others with their questions here in the forum, but you can also help us out in other ways:

- Do your shopping at Amazon, it will not cost you anything extra but may generate a small commission for us,
- send a cup of coffee through PayPal ($5, $10, $20, or custom amount),
- become a Patreon,
- donate BitCoin (BTC), or BitCoinCash (BCH).

Share: