LED Lightning Storm Simuation

Do you have a question on how to do something.
Ask in here.
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

LED Lightning Storm Simuation

Post by alexwbush »

So, I know this may be a new idea here, but I was watching videos and reading about the Aqua Illuminations (AI) LED allows you to program lightning storms and thought it was pretty cool. I picked up a dimmable DIY LED set (currently being shipped) and would love to see this feature.

I propose something very similar to how the AI controller handles this, but for those of us with DIY LED sets. You should be able to change the setting on the headunit. The two settings:
1. Number of storms possible per day
2. Percentage you would like storms to occur

This would mean 1 storm, 100% would give you 1 storm per day. 1 storm, 50% gives you a 50% possibility of that 1 storm happening per day and it's just randomized from there. It doesn't need to remember the day of the week or do set things per day, but that may be a future option. In addition, and I know people would love this... but it could maybe model after a current or set weather pattern programmed in (i.e. you could download a table, or .h or .c file with a set period mapped out and it would model the "weather" after that) so that effectively you could pick an area you want your weather to be like, and it would do it.

Now I know this may be more of a parlor/party trick, but it might keep things interesting and the ability to turn it on and off from the controller would be awesome in the case that you decide you're sick of it or want to bring it back. It's been argued on many forums whether is beneficial or a detriment to fish and coral, but we'll leave that argument for another day.

[youtube]http://www.youtube.com/watch?v=s__XwPhXhe0[/youtube]

Thoughts?

As soon as I get my controller, I'm going to jump into the coding more. I'm betting at least one of you has thought of this, even if you thought it was a stupid idea :lol:
NanoTrevor
Posts: 69
Joined: Thu Jun 02, 2011 1:58 pm

Re: LED Lightning Storm Simuation

Post by NanoTrevor »

hey alex, i bought the pwm expansion from roberto and he sent me this pde along with it, im still trying to somehow implement the clouds and storms into my pde...maybe you can work something with this code and let me know

Code: Select all

//Library headers. Necessary if you are using Reef Angel Controller
#include <Wire.h>
#include <EEPROM.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <NokiaLCD.h>
#include <ReefAngel.h>

//Expander I/O bits 
#define Sump                8
#define Heater              7
#define WM1                 6
#define SumpLight           5
#define Daylight            4
#define Actinic             3
#define Moonlight           2
#define AutoTopOff          1

#include <avr/pgmspace.h>
prog_char menu0_label[] PROGMEM = "Fast Cloud";
prog_char menu1_label[] PROGMEM = "Slow Cloud";
prog_char menu2_label[] PROGMEM = "Thunderstorm 1";
prog_char menu3_label[] PROGMEM = "Thunderstorm 2";
prog_char menu4_label[] PROGMEM = "All 0%";
prog_char menu5_label[] PROGMEM = "All 10%";
prog_char menu6_label[] PROGMEM = "All 50%";
prog_char menu7_label[] PROGMEM = "All 100%";
PROGMEM const char *menu_items[] = {
  menu0_label, menu1_label, menu2_label, menu3_label, menu4_label, menu5_label, menu6_label, menu7_label};

// setup function runs only once at start-up
void setup()
{
  ReefAngel.Init();  //Initialize controller
  ReefAngel.LCD.SetContrast(60);  // Set contrast to 60
  ReefAngel.LoadMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));  // Load Menu items from above

  //All channels 100%
  for(int a=0;a<6;a++)
  {
    PWMExpansion(a,50); //Send cmd a and data 255 
  }
}

// loop function keeps running forever after start-up
void loop()
{
  ReefAngel.StandardGUI();  //Draw the Standard GUI
  if (ReefAngel.SelectedMenu==0)  // Fast Cloud
  {
    PWMExpansion(6,1); //Send cmd 6 and data 1 
    ReefAngel.ReturnMenuFunction();  // Return from menu function;
  }
  if (ReefAngel.SelectedMenu==1)  // Slow Cloud
  {
    PWMExpansion(6,15); //Send cmd 6 and data 15 
    ReefAngel.ReturnMenuFunction();  // Return from menu function;
  }
  if (ReefAngel.SelectedMenu==2)  //Thunderstorm 1
  {
    PWMExpansion(7,0); //Send cmd 7 and data 0 
    ReefAngel.ReturnMenuFunction();  // Return from menu function;
  }
  if (ReefAngel.SelectedMenu==3)  //Thunderstorm 2
  {
    PWMExpansion(8,0); //Send cmd 8 and data 0 
    ReefAngel.ReturnMenuFunction();  // Return from menu function;
  }  
  if (ReefAngel.SelectedMenu==4)  //All 0%
  {
    for(int a=0;a<6;a++)
    {
      PWMExpansion(a,0); //Send cmd a and data 0 
    }
    ReefAngel.ReturnMenuFunction();  // Return from menu function;
  }
  if (ReefAngel.SelectedMenu==5)  //All 10%
  {
    for(int a=0;a<6;a++)
    {
      PWMExpansion(a,25); //Send cmd a and data 25 
    }
    ReefAngel.ReturnMenuFunction();  // Return from menu function;
  }
  if (ReefAngel.SelectedMenu==6)  //All 50%
  {
    for(int a=0;a<6;a++)
    {
      PWMExpansion(a,128); //Send cmd a and data 128 
    }
    ReefAngel.ReturnMenuFunction();  // Return from menu function;
  }
  if (ReefAngel.SelectedMenu==7)  //All 100%
  {
    for(int a=0;a<6;a++)
    {
      PWMExpansion(a,255); //Send cmd a and data 255 
    }
    ReefAngel.ReturnMenuFunction();  // Return from menu function;
  }

}

void PWMExpansion(byte cmd, byte data)
{
    Wire.beginTransmission(8); // transmit to device #2
    Wire.send('$');              // sends $ 
    Wire.send('$');              // sends $ 
    Wire.send('$');              // sends $ 
    Wire.send(cmd);              // sends a value 
    Wire.send(data);              // sends 255 
    Wire.endTransmission();    // stop transmitting
}
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: LED Lightning Storm Simuation

Post by rimai »

The PWM expansion module has the thunderstorm effects built-in.
Two actually. One is preset and will be always the same pattern across all 6 channels and one that is totally random. :)
Then you can program your PDE to call those effects whenever you want. :)
Roberto.
NanoTrevor
Posts: 69
Joined: Thu Jun 02, 2011 1:58 pm

Re: LED Lightning Storm Simuation

Post by NanoTrevor »

hey roberto...i didn't know that, thought i had to code the stuff, how do i call them? what about the channels on the relay? can those be integrated into the storms/clouds?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: LED Lightning Storm Simuation

Post by rimai »

For Fast Cloud

Code: Select all

PWMExpansion(6,1);
For Slow Cloud

Code: Select all

PWMExpansion(6,15);
For Thunderstorm 1 (preset pattern)

Code: Select all

PWMExpansion(7,0);
For Thunderstorm 2 (random pattern)

Code: Select all

PWMExpansion(8,0);
Roberto.
astralmind
Posts: 99
Joined: Fri Apr 01, 2011 10:53 am

Re: LED Lightning Storm Simuation

Post by astralmind »

Really nifty stuff there nice ! Too bad I don't have any LEDs at this time, makes me almost regret grabbing that used T5 fixture....
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: LED Lightning Storm Simuation

Post by alexwbush »

haha, now you tell me Roberto! After I ordered the chip to fix my relay for LEDs! Oh well, I guess I'll need to do some programming. Since we know the PWM expansion already has it and those folks are set... lets work with the normal PWMs on the standard kit first.
Ace25
Posts: 20
Joined: Sat May 21, 2011 10:22 am
Location: Lompoc, California

Re: LED Lightning Storm Simuation

Post by Ace25 »

Not a fan of the "lightning effect" I have seen others use, but the storm feature is cool. I also have the PWM module but have yet to use it.

After storms.. then you can think about incorporating "rain" as your ATO like this tank. ;)

http://www.advancedaquarist.com/blog/ri ... fs-display

http://www.youtube.com/watch?v=TuDYCCaVIKo
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: LED Lightning Storm Simuation

Post by alexwbush »

Ace25 wrote:Not a fan of the "lightning effect" I have seen others use, but the storm feature is cool. I also have the PWM module but have yet to use it.

After storms.. then you can think about incorporating "rain" as your ATO like this tank. ;)

http://www.advancedaquarist.com/blog/ri ... fs-display

http://www.youtube.com/watch?v=TuDYCCaVIKo
storm feature is an excellent idea! I guess it would be a combination of dimming since most people don't have each row setup on a different driver to simulate clouds moving across. Oh and I wonder if they use saltwater or ATO. Either way you'd be splashing salt, but I suppose you could have it wait to top off until that point in the day and do it all at once. But again, with the splashing salt, I'm sure most wouldn't want to simulate rain.
Ace25
Posts: 20
Joined: Sat May 21, 2011 10:22 am
Location: Lompoc, California

Re: LED Lightning Storm Simuation

Post by Ace25 »

They use RO/DI / ATO water for the rain because saltwater would clog up the rain system after just one use. I thought about using saltwater myself as a rain effect but after testing it one time on a small scale and finding out the salt clogs the drippers after just one cycle I gave up. My tank isn't big enough to allow me to use RO as rain for more than a few seconds a day on my tank.
rimai
Posts: 12881
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: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: LED Lightning Storm Simuation

Post by rimai »

Roberto.
bmhair03
Posts: 166
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: 12881
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: 12881
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: 12881
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: 166
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: 166
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: 12881
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: 166
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: 166
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: 166
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 456 times
rimai
Posts: 12881
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: 166
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: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: LED Lightning Storm Simuation

Post by rimai »

Let me test it then.
Roberto.
bmhair03
Posts: 166
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.:)
Post Reply