Page 1 of 2

Re: LED Lightning Storm Simuation

Posted: Thu Jun 16, 2011 4:16 pm
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 :)

Re: LED Lightning Storm Simuation

Posted: Thu Jun 16, 2011 4:44 pm
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?

Re: LED Lightning Storm Simuation

Posted: Thu Jun 16, 2011 10:24 pm
by alexwbush
ok, step 1: random number generator

Re: LED Lightning Storm Simuation

Posted: Fri Jun 17, 2011 9:13 am
by rimai

Re: LED Lightning Storm Simuation

Posted: Thu Jun 23, 2011 8:21 pm
by bmhair03
Roberto,
How many drivers do you need to have to run these feature? 6 ?

Re: LED Lightning Storm Simuation

Posted: Thu Jun 23, 2011 8:23 pm
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).

Re: LED Lightning Storm Simuation

Posted: Thu Jun 23, 2011 8:33 pm
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.

Re: LED Lightning Storm Simuation

Posted: Thu Jun 23, 2011 9:42 pm
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);
}

Re: LED Lightning Storm Simuation

Posted: Fri Jun 24, 2011 12:14 am
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);
}

Re: LED Lightning Storm Simuation

Posted: Fri Jun 24, 2011 8:01 am
by rimai
You got it :)
Now, go test and make us a video :mrgreen:

Re: LED Lightning Storm Simuation

Posted: Fri Jun 24, 2011 8:23 pm
by bmhair03
Very nice . will try it tomorrow and film it :)

Re: LED Lightning Storm Simulation

Posted: Fri Jun 24, 2011 8:33 pm
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.

Re: LED Lightning Storm Simuation

Posted: Fri Jun 24, 2011 8:54 pm
by rimai
Although it is possible to mod it, you would have to send it to me. It's not as simple.

Re: LED Lightning Storm Simuation

Posted: Sat Jun 25, 2011 4:12 pm
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.

Re: LED Lightning Storm Simuation

Posted: Sat Jun 25, 2011 4:41 pm
by bmhair03
When i add the above code All that happens is my daylights start pulsing rapidly

Re: LED Lightning Storm Simuation

Posted: Sat Jun 25, 2011 4:57 pm
by bmhair03
Here is t the .pde

Re: LED Lightning Storm Simuation

Posted: Sat Jun 25, 2011 5:14 pm
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?

Re: LED Lightning Storm Simuation

Posted: Sat Jun 25, 2011 9:14 pm
by bmhair03
yes i can make a video. It didnt stop for me just kept strobing .

Re: LED Lightning Storm Simuation

Posted: Sat Jun 25, 2011 10:02 pm
by rimai
Let me test it then.

Re: LED Lightning Storm Simuation

Posted: Sun Jun 26, 2011 4:29 pm
by bmhair03
sounds go you know what your doing unlike me.:)

Re: LED Lightning Storm Simuation

Posted: Sun Jun 26, 2011 4:42 pm
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.

Re: LED Lightning Storm Simuation

Posted: Sun Jun 26, 2011 4:52 pm
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

Re: LED Lightning Storm Simuation

Posted: Sun Jun 26, 2011 5:23 pm
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.

Re: LED Lightning Storm Simuation

Posted: Sun Jun 26, 2011 5:26 pm
by rimai
Cool.
Does it look good?

Re: LED Lightning Storm Simuation

Posted: Sun Jun 26, 2011 7:50 pm
by bmhair03
Yes it looks really nice. still working on the upload.

Re: LED Lightning Storm Simuation

Posted: Mon Jun 27, 2011 9:26 am
by bmhair03
Heres the video remember very bad quaity but you can see the effect
http://www.youtube.com/watch?v=ivWYJ6j-6lM

Re: LED Lightning Storm Simuation

Posted: Mon Jun 27, 2011 9:28 am
by bmhair03
Is it possible to make the lighting faster or sharper? Or is that the drivers

Re: LED Lightning Storm Simuation

Posted: Mon Jun 27, 2011 9:40 am
by rimai
Nice.
Agreed. Needs more contrast between between peeks.
Let me work on it.

Re: LED Lightning Storm Simuation

Posted: Mon Jun 27, 2011 11:27 am
by bmhair03
You the Man Roberto! Thanks for the help.

Re: LED Lightning Storm Simuation

Posted: Mon Jun 27, 2011 12:09 pm
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.