LED Lightning Storm Simuation

Do you have a question on how to do something.
Ask in here.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: LED Lightning Storm Simuation

Post by rimai »

You could always do it with saltwater and then turn off and just rinse with freshwater at the end.
Easy to do that with RA :)
Roberto.
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: LED Lightning Storm Simuation

Post by alexwbush »

very true. My concern would be with salt splashing. Most see that already in their sump... nasty stuff.

But, back on topic of programming, I should have LEDs Monday and then let the fun begin!

Roberto, how did you code the PWM expansion for cloud modes? Is it hard coded? Or is there another .h or .cpp file?
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: LED Lightning Storm Simuation

Post by alexwbush »

ok, step 1: random number generator
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: LED Lightning Storm Simuation

Post by rimai »

Roberto.
bmhair03
Posts: 159
Joined: Sun Mar 20, 2011 1:22 pm

Re: LED Lightning Storm Simuation

Post by bmhair03 »

Roberto,
How many drivers do you need to have to run these feature? 6 ?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: LED Lightning Storm Simuation

Post by rimai »

You can do storm with just one driver, but you won't get much cloud effect from just 1.
You can achieve a dim down and up, but it won't appear as a passing cloud (to the human eyes).
Roberto.
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: LED Lightning Storm Simuation

Post by alexwbush »

thats one reason I was thinking lightning storm or just cloud cover. Most people have 22 drivers (one blue, one white). But running different drivers for different rows would be pretty cool for effects.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: LED Lightning Storm Simuation

Post by rimai »

For those who want to try this with the standard PWM channels, all you have to do is set different values of PWM randomly.

Something like this:

Code: Select all

#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>

void setup()
{
    ReefAngel.Init();  //Initialize controller
    randomSeed(analogRead(0));
}

void loop()
{
    ReefAngel.ShowInterface();
    if (second(now())==0) StandardThunderstorm(); else ReefAngel.PWM.SetDaylight(0);
}

void StandardThunderstorm()
{
  byte value=random(255);
  ReefAngel.PWM.SetDaylight(value);
}
Roberto.
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: LED Lightning Storm Simuation

Post by alexwbush »

sounds good! but doesn't the code above return a value between 0 and 255 for the LED percentage? Shouldn't it be 0-100 or 15-100 for us meanwell driver folks?

For meanwells, maybe something like:

Code: Select all

#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>

void setup()
{
    ReefAngel.Init();  //Initialize controller
    randomSeed(analogRead(0));
}

void loop()
{
    ReefAngel.ShowInterface();
    if (second(now())==0) StandardThunderstorm(); else ReefAngel.PWM.SetDaylight(0);
}

void StandardThunderstorm()
{
  //for meanwells 15%-100%
  byte value=random(85); 
  if (value  > 0) value = value+15;
  ReefAngel.PWM.SetDaylight(value);
}
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: LED Lightning Storm Simuation

Post by rimai »

You got it :)
Now, go test and make us a video :mrgreen:
Roberto.
bmhair03
Posts: 159
Joined: Sun Mar 20, 2011 1:22 pm

Re: LED Lightning Storm Simuation

Post by bmhair03 »

Very nice . will try it tomorrow and film it :)
bmhair03
Posts: 159
Joined: Sun Mar 20, 2011 1:22 pm

Re: LED Lightning Storm Simulation

Post by bmhair03 »

if i wanted to try the cloud since i have 2 drivers what is the code for that . Now i might even break my 24 LEDS into 3 strand and add a third driver . Roberto can u PM me availability of the PWM expansion. And is it possible to mod Gen 1 boxes to work with it.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: LED Lightning Storm Simuation

Post by rimai »

Although it is possible to mod it, you would have to send it to me. It's not as simple.
Roberto.
bmhair03
Posts: 159
Joined: Sun Mar 20, 2011 1:22 pm

Re: LED Lightning Storm Simuation

Post by bmhair03 »

I have the code uploaded .What are the item that I put values in .Just the random (85) spot and what dose the % represent. will this just control 1 channel or both.
bmhair03
Posts: 159
Joined: Sun Mar 20, 2011 1:22 pm

Re: LED Lightning Storm Simuation

Post by bmhair03 »

When i add the above code All that happens is my daylights start pulsing rapidly
bmhair03
Posts: 159
Joined: Sun Mar 20, 2011 1:22 pm

Re: LED Lightning Storm Simuation

Post by bmhair03 »

Here is t the .pde
Attachments
Main_Tank_1_Thunderstorm.pde
(1.8 KiB) Downloaded 526 times
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: LED Lightning Storm Simuation

Post by rimai »

It should pulse for just one second though.
The code will pulse everytime you have a whole minute for 1 second.
I'm curious to see a video. Can you create one?
Roberto.
bmhair03
Posts: 159
Joined: Sun Mar 20, 2011 1:22 pm

Re: LED Lightning Storm Simuation

Post by bmhair03 »

yes i can make a video. It didnt stop for me just kept strobing .
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: LED Lightning Storm Simuation

Post by rimai »

Let me test it then.
Roberto.
bmhair03
Posts: 159
Joined: Sun Mar 20, 2011 1:22 pm

Re: LED Lightning Storm Simuation

Post by bmhair03 »

sounds go you know what your doing unlike me.:)
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: LED Lightning Storm Simuation

Post by rimai »

I think it's got to do with the following line:

Code: Select all

    ReefAngel.PWM.SetDaylight(PWMSlope(10,30,19,30,15,65,60,ReefAngel.PWM.GetDaylightValue()));
Try removing it.
I'll only be able to test tomorrow. I have LED string to test at the office.
Roberto.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: LED Lightning Storm Simuation

Post by binder »

rimai wrote:I think it's got to do with the following line:

Code: Select all

    ReefAngel.PWM.SetDaylight(PWMSlope(10,30,19,30,15,65,60,ReefAngel.PWM.GetDaylightValue()));
Try removing it.
I'll only be able to test tomorrow. I have LED string to test at the office.
I would think that having the PWMSlope function in use would affect the PWM output with the selection of the Cloud cover or Thunderstorm since it continually sets the PWM values.

curt
bmhair03
Posts: 159
Joined: Sun Mar 20, 2011 1:22 pm

Re: LED Lightning Storm Simuation

Post by bmhair03 »

Got it working by commenting out a redondit line. Stays in storm mode dosen't reset to the before PWM values. Will post the video when I figure out how.
Last edited by bmhair03 on Sun Jun 26, 2011 7:51 pm, edited 1 time in total.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: LED Lightning Storm Simuation

Post by rimai »

Cool.
Does it look good?
Roberto.
bmhair03
Posts: 159
Joined: Sun Mar 20, 2011 1:22 pm

Re: LED Lightning Storm Simuation

Post by bmhair03 »

Yes it looks really nice. still working on the upload.
bmhair03
Posts: 159
Joined: Sun Mar 20, 2011 1:22 pm

Re: LED Lightning Storm Simuation

Post by bmhair03 »

Heres the video remember very bad quaity but you can see the effect
http://www.youtube.com/watch?v=ivWYJ6j-6lM
bmhair03
Posts: 159
Joined: Sun Mar 20, 2011 1:22 pm

Re: LED Lightning Storm Simuation

Post by bmhair03 »

Is it possible to make the lighting faster or sharper? Or is that the drivers
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: LED Lightning Storm Simuation

Post by rimai »

Nice.
Agreed. Needs more contrast between between peeks.
Let me work on it.
Roberto.
bmhair03
Posts: 159
Joined: Sun Mar 20, 2011 1:22 pm

Re: LED Lightning Storm Simuation

Post by bmhair03 »

You the Man Roberto! Thanks for the help.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: LED Lightning Storm Simuation

Post by rimai »

I changed to this:

Code: Select all

void StandardThunderstorm()
{
  byte value=random(100);
  if (value>60) ReefAngel.PWM.SetDaylight(50); else ReefAngel.PWM.SetDaylight(0);
}
It looks much better :)
To make it trigger faster than every whole minute, use this instead:

Code: Select all

  if ((second(now())%10)<=3) StandardThunderstorm(); else ReefAngel.PWM.SetDaylight(0);
This code will actually make it last 3s every 10s, so you can have see the effect faster.
3s duration seems to give better result than just 1 second.
Roberto.
Post Reply