Cloud and Lightning Code

Do you have a question on how to do something.
Ask in here.
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Cloud and Lightning Code

Post by cosmith71 »

Awesome! I've always thought that the best way to learn something was to do it. I'm sure I'll have questions.

--Colin
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Cloud and Lightning Code

Post by rimai »

The lightning will have to be incorporated in the slave side. The cloud should be fine.
The RANet bandwidth is not fast enough.
It sends data every 100ms.
Roberto.
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Cloud and Lightning Code

Post by cosmith71 »

rimai wrote:The lightning will have to be incorporated in the slave side. The cloud should be fine.
The RANet bandwidth is not fast enough.
It sends data every 100ms.
Slave side? Esplain please.

--Colin
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Cloud and Lightning Code

Post by rimai »

Every RANet-Ready Wireless Module has a microcontroller in it to receive and process the wireless data.
The current firmware can only process data for relays and dimming channels.
We will need to create a firmware that can accept commands, so you can trigger remotely.
For example, a command to trigger the lightning effect on the dimming module.
You are not the only one that will want this.
The person using the dimmable LED driver wants this too.
I just need to find some time to put something together, but I'd like to release the next libs first.
The RANet requires some changes on the core libraries released from Arduino, specifically the SoftwareSerial library and I'd like to have at least the base communication working and released before we start adding functionality to it.
We have been getting some help from Sacohen, lnevo, AlanM, binder and others to see if any other minor bug is found.
Hopefully, we get a release soon.
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Cloud and Lightning Code

Post by rimai »

I updated the previous post.
I meant to say RANet-Ready Wireless Module and not RANet-Add On.
Roberto.
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Cloud and Lightning Code

Post by cosmith71 »

Ah, I see. Load the sequence and then trigger when needed. I understand.

--Colin
jegillis
Posts: 86
Joined: Sat Jan 04, 2014 10:26 am

Re: Cloud and Lightning Code

Post by jegillis »

And I thought that just coding this for the dimming expansion would work. I don't know how to code much of anything but would be happy to test anything you come up with.
Image
TheMikey
Posts: 4
Joined: Wed Sep 25, 2013 9:15 am

Re: Cloud and Lightning Code

Post by TheMikey »

I feel like a bit of an idiot, but I can't seem to find this line:

byte LightningModes[] = { Slow, Fast, Mega };

To even start this programming. Is there an updated full code I need to find somewhere before attempting to customize this?
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Cloud and Lightning Code

Post by cosmith71 »

The updated code is in the first post.

Do a search for this:

Code: Select all

 byte LightningModes[] = { Mega, Mega, Mega2, Calm, Calm };
And change it to your liking.

--Colin
TheMikey
Posts: 4
Joined: Wed Sep 25, 2013 9:15 am

Re: Cloud and Lightning Code

Post by TheMikey »

Found it! Thanks!
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Cloud and Lightning Code

Post by TanksNStuff »

Has anyone had any luck modifying this code to work on the dimmer expansion module yet?

I'm getting ready to redo my entire coding for my tank upgrade and was hoping to incorporate clouds/lightning.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Cloud and Lightning Code

Post by lnevo »

Not yet
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Cloud and Lightning Code

Post by cosmith71 »

Is there a way to write values directly to the dimming expansion? That's key. Otherwise it won't be fast enough for the right effect.

--Colin
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Cloud and Lightning Code

Post by rimai »

Actually the wired dimming has a fast enough connection. The wireless one is the one that doesn't.
Roberto.
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Cloud and Lightning Code

Post by TanksNStuff »

Lee, is that because you haven't had time to try or because you ran into issues/errors that still need to be worked out? If it's simply a matter of changing just the PMWValue variables, maybe I'll try to take a stab at it.

In fact, I'll take a look at it now and see if I can figure it out. I'll report back here if I get it working.

I have wired connection dimmer expansion, so I should be good to go.
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Cloud and Lightning Code

Post by cosmith71 »

The obstacle is here, in the analogWrite statement. That bypasses the RA libraries to write directly to the daylight pin. It's the only way to get fast enough flashes.

Code: Select all

 int a=random(1,5);    // Pick a number of consecutive flashes from 1 to 4.  
          for (int i=0; i<a; i++)
          {
            analogWrite(daylightPWMPin,random(DaylightPWMValue*2.55,255));    // Flash on
            int randy=random(20,80);    // Random number for a delay
            if (randy>71) randy=((randy-70)/2)*100;    // Small chance of a longer delay
            delay(randy);                // Wait from 20 to 69 ms, or 100-400 ms
            analogWrite(daylightPWMPin,DaylightPWMValue*2.55);      // Flash off
            delay(random(30,50));                // Wait from 30 to 49 ms 
            wdt_reset();
          }
If you want to convert it, you'd need to find an equivalent way to write to the expansion module.

--Colin
JTMBTech
Posts: 6
Joined: Fri Feb 28, 2014 9:11 am

Re: Cloud and Lightning Code

Post by JTMBTech »

Sorry if this is a dumb question. Can i use this code to add lightning and cloud to my main white and actinic channels with the output from the relay box dimming ports, and then use the channels 0-3 on dimming expansion (using 4-5 for dc pumps) with the wizard generated code for the my other colored leds, green red uv and 2700k white? i have a diy led with steves led drivers and 6 different color leds over my 180 currently controlled by a typhoon. or would it not get the same effect because the other channels won't have the effect. I was hoping this might work because the main number of leds is white and actinic leds. i didnt realize when i ordered the dimming module and plus upgrade last week that the custom lighting codes had not been written for dimming module because the design had changed. I have very high hopes with the dimming module and just want to use my leds to their full potential! or is the code getting close to be finished for the new dimming module?
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Cloud and Lightning Code

Post by Sacohen »

From what I understand this code only works on the relay dimming channels, it hasn't be ported over to the dimming hub yet. So I will work on your white and actinic lights only.
The dimming channel 1-3 will be normal dimming only.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Cloud and Lightning Code

Post by rimai »

Colin has already ported and made it even better when used with the dimming module.
Let's have him pitch in
Roberto.
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Cloud and Lightning Code

Post by cosmith71 »

It's ported to the RANet Dimming Expansion, but that code could be adapted. The issue noted a few posts above has been solved. It's just a matter of putting it all together.

I don't have a standard dimming expansion, so there may be some trial and error. I'll see if I can come up with something over the next week or so.

--Colin
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Cloud and Lightning Code

Post by cosmith71 »

Roberto, is the address of the standard dimming expansion 0x40? I'm guessing it's the same dimming unit used in the RANet version?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Cloud and Lightning Code

Post by rimai »

Yeap.
Exactly same thing
Roberto.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Cloud and Lightning Code

Post by Sacohen »

cosmith71 wrote:It's ported to the RANet Dimming Expansion, but that code could be adapted. The issue noted a few posts above has been solved. It's just a matter of putting it all together.

I don't have a standard dimming expansion, so there may be some trial and error. I'll see if I can come up with something over the next week or so.

--Colin
That awesome. :)
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Cloud and Lightning Code

Post by cosmith71 »

JTMBTech:

Do you want the Daylight channel, and expansion channels 0-3 to flash? Actinic doesn't flash.

--Colin
User avatar
Rodasphoto
Posts: 187
Joined: Wed Apr 10, 2013 2:48 pm
Location: Athens, Ga
Contact:

Re: Cloud and Lightning Code

Post by Rodasphoto »

Anyone have noise to accompany the flash?
Image
JTMBTech
Posts: 6
Joined: Fri Feb 28, 2014 9:11 am

Re: Cloud and Lightning Code

Post by JTMBTech »

If the code only effects the white I would want to put my 2700 k white on one chanel, I was thinking 2700k white on relay box and 6300k white either on the same chanel or one of the chanels on the dimming expansion my other led chanels I can put on the remaining dimming expansion chanels, and the actinic chanel. Is the white normally the only chanel that flashes/changes? I just wanted to know if it was possible to use the relay box white output on storm and the expansion dimming ports on standard, however if the code has been ported to the dimming ex pansies I am sure it will work.
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Cloud and Lightning Code

Post by cosmith71 »

Normally it's just the white that flashes, but that's just personal preference. We can make any channels you like flash.
MDB1029
Posts: 178
Joined: Wed Nov 12, 2014 3:10 pm
Location: An Oklahoman in Ohio

Re: Cloud and Lightning Code

Post by MDB1029 »

So this code only works from the relay dimming ports, which are 0-10v, but you can only get the quick lightning flashes using LDD type drivers, 0-5v. Am i missing something here?
Image
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Cloud and Lightning Code

Post by cosmith71 »

If you have a modified relay box you can get 0-5v from the dimming ports. I thought the dimming module version had been sorted out. I'll look into it.

--Colin
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Cloud and Lightning Code

Post by cosmith71 »

Officially adapted for the 6 channel Dimming Expansion Module.

http://forum.reefangel.com/viewtopic.php?f=12&t=5460

--Colin
Post Reply