Lights cycle doubt

Do you have a question on how to do something.
Ask in here.
Post Reply
Bo0sted_Rafi
Posts: 75
Joined: Thu Mar 21, 2013 12:11 pm

Lights cycle doubt

Post by Bo0sted_Rafi »

Hi to all! Just got an idea about the light cycle in my tank and I need to know if its possible to do I'm thinking. I'm running my rapidled DIY led fixture with the boostled arduino UNO controller. It can control 4 channels but for now I just running 2 channels, one for the whites and the other for the actinics. I can connect my fixture to the RA but now I want to change something.


I want to get the actinics on at "xx" hour at 60% and 30 minutes of fade duration. 30 minutes later I want the whites ones on but just at 12% for 2 hours and then ramps up to 45% for 4 hours and then again ramps down to 12% for 2 hours. In that point when these 2 hours finished, I need to get the blue ones for 1:30 hours and then finish the light cycle. That's possible?
Image
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Lights cycle doubt

Post by DrewPalmer04 »

On your UNO or the RA???
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
Bo0sted_Rafi
Posts: 75
Joined: Thu Mar 21, 2013 12:11 pm

Re: Lights cycle doubt

Post by Bo0sted_Rafi »

Well, in the ra I think it would be easier. But If I can do it in the UNO would be perfect because I'm waiting for jebo wp25 and that's let me use the channel for control it.
Image
Bo0sted_Rafi
Posts: 75
Joined: Thu Mar 21, 2013 12:11 pm

Re: Lights cycle doubt

Post by Bo0sted_Rafi »

Im incorrect. The arduino I'm using It is based on the ATMega328P Chip and is fully programmable.

That info I founded in the web.

This link shows the code

https://www.boostled.com/Articles.asp?ID=250

Just want to know the better way to get my lights working like I want
Image
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Lights cycle doubt

Post by DrewPalmer04 »

Copy and paste the PWMParabola and PWMSlope from the Globals.h for the RA. It does the calculations for what you want to do. That simple really :)
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
Bo0sted_Rafi
Posts: 75
Joined: Thu Mar 21, 2013 12:11 pm

Re: Lights cycle doubt

Post by Bo0sted_Rafi »

with my controller im running the slope dimming but now im trying to figure if i can do the custom slope code to work like i want now.

In other words, my white lights cycle start at 5pm. At this i want the lights at 12% for 1:30 hours. then, at 6:30 the slope ramps up to 45% for 4 hours. At 10:30pm again the slope ramps down to 12% and still at that % for 1:30 hour (12am)

Drew, Hope you can understand what im trying to say.
Image
enigma32
Posts: 74
Joined: Fri Apr 26, 2013 11:48 am
Location: Los Angeles and NYC

Re: Lights cycle doubt

Post by enigma32 »

Sounds to me like you need to define a different mathematical function for each time period.
You also need to be more specific about "ramps up" when you specify those functions-- do you mean you want it to ramp linearly?

If you can write a formula to determine the value based on the current time, it's easy to turn it into real code.

Here's a starting point (assuming you're talking about "ramping" linearly):
From 5pm to 6:30pm:
light_level = 12
From 6:30 to 10:30pm:
light_level = 12+(33*(seconds_since_6:30 divided by 4*60*60))
This sets the level as a percentage of how far we've progressed through the four hours, going from 12% to 45% (12+33)

I'm confused after this point, since you said it "ramps up" until 10:30, then ramps down, only to stay at 12% for 1.5 hours, until 12AM. But if it stays at 12% for 1.5 hours until 12AM, that means it was already at 12% at 10:30, so when did it "ramp down"?
Current setup:
60g 24" custom cube (fish and softies right now)
AI Sol Blue, Ecotech MP-10wES
Coralife skimmer
100% customer controller, transitioning to ReefAngel
Bo0sted_Rafi
Posts: 75
Joined: Thu Mar 21, 2013 12:11 pm

Re: Lights cycle doubt

Post by Bo0sted_Rafi »

enigma32 wrote:Sounds to me like you need to define a different mathematical function for each time period.
You also need to be more specific about "ramps up" when you specify those functions-- do you mean you want it to ramp linearly?

If you can write a formula to determine the value based on the current time, it's easy to turn it into real code.

Here's a starting point (assuming you're talking about "ramping" linearly):
From 5pm to 6:30pm:
light_level = 12
From 6:30 to 10:30pm:
light_level = 12+(33*(seconds_since_6:30 divided by 4*60*60))
This sets the level as a percentage of how far we've progressed through the four hours, going from 12% to 45% (12+33)

I'm confused after this point, since you said it "ramps up" until 10:30, then ramps down, only to stay at 12% for 1.5 hours, until 12AM. But if it stays at 12% for 1.5 hours until 12AM, that means it was already at 12% at 10:30, so when did it "ramp down"?


Yes, I'm talking linearly. The same you write, at 6:30pm add 33% more and at 10:30pm get that 33% minus to get 12% again

Like this!!
Image

Sorry for my 1 minute drawing
Image
enigma32
Posts: 74
Joined: Fri Apr 26, 2013 11:48 am
Location: Los Angeles and NYC

Re: Lights cycle doubt

Post by enigma32 »

Ah, that helps a lot!

How long do you want it to take for the transitions? For example, at the transition from 12% to 45% at 6:30PM, how long should it take to go from 12% to 45%? (I'm assuming the same amount of time for each transition)
Current setup:
60g 24" custom cube (fish and softies right now)
AI Sol Blue, Ecotech MP-10wES
Coralife skimmer
100% customer controller, transitioning to ReefAngel
Bo0sted_Rafi
Posts: 75
Joined: Thu Mar 21, 2013 12:11 pm

Re: Lights cycle doubt

Post by Bo0sted_Rafi »

3 minutes its ok. Remember that's only in the white channel. The blue ones use other slope time.
Image
enigma32
Posts: 74
Joined: Fri Apr 26, 2013 11:48 am
Location: Los Angeles and NYC

Re: Lights cycle doubt

Post by enigma32 »

So, mathematically speaking, you're looking for this:

From 5PM to 5:03
white_level = 12*seconds_since_fivepm/180

From 5:03 to 6:30PM
white_level = 12

From 6:30PM to 6:33PM
white_level = 12+(33*seconds_since_sixthirty/180)

From 6:33PM to 10:30PM
white_level = 45

From 10:30PM to 10:33PM
white_level = 45-(33*seconds_since_tenthirty/180)

From 10:33PM to 12AM
white_level = 12

From 12AM to 12:03AM
white_level = 12-(12*seconds_since_midnight/180)

Right? I'll try and whip up some code for you later tonight if somebody else doesn't beat me to it.
Current setup:
60g 24" custom cube (fish and softies right now)
AI Sol Blue, Ecotech MP-10wES
Coralife skimmer
100% customer controller, transitioning to ReefAngel
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Lights cycle doubt

Post by lnevo »

You should be able to do this...

ReefAngel.PWM.SetDaylight(PWMSlope(17,0,0,3,0,12,3,0));
ReefAngel.PWM.SetDaylight(PWMSlope(18,30,22,33,12,45,3,ReefAngel.PWM.GetDaylightValue()));

The first line sets the daylight port to start at 5:00 and end at 12:03am with a 3 minute ramp up and down from 0%-12%. Otherwise value is 0.

The second line overrides the value from 6:30-10:33 with a 3 minute ramp up and down the value from 12%-45%, otherwise the value is what it's already set at.

The write to the pwm port happens during the ShowInterface function at the end of your loop.

This is based on the timing that enigma posted...
Bo0sted_Rafi
Posts: 75
Joined: Thu Mar 21, 2013 12:11 pm

Re: Lights cycle doubt

Post by Bo0sted_Rafi »

I will make the harness to the drivers to test it! I don't understand the arduino sketch of the lamp controller to modify that controller
Image
Bo0sted_Rafi
Posts: 75
Joined: Thu Mar 21, 2013 12:11 pm

Re: Lights cycle doubt

Post by Bo0sted_Rafi »

lnevo wrote:You should be able to do this...

ReefAngel.PWM.SetDaylight(PWMSlope(17,0,0,3,0,12,3,0));
ReefAngel.PWM.SetDaylight(PWMSlope(18,30,22,33,12,45,3,ReefAngel.PWM.GetDaylightValue()));

The first line sets the daylight port to start at 5:00 and end at 12:03am with a 3 minute ramp up and down from 0%-12%. Otherwise value is 0.

The second line overrides the value from 6:30-10:33 with a 3 minute ramp up and down the value from 12%-45%, otherwise the value is what it's already set at.

The write to the pwm port happens during the ShowInterface function at the end of your loop.

This is based on the timing that enigma posted...
I paste that code in my sketch and i will monitoring the light cycle. I need to make the harness to connect the led lamp but i can see if the parameters of the lights change in the portal or the iphone app. i let you know. Thanks to you and for enigma32 too
Image
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Lights cycle doubt

Post by DrewPalmer04 »

What's the purpose of the 3 min transition? You could easily do an if statement hour() > X ReefAngel.SetActinic percentage ...then... if else, if else ...else 0%

No?
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Lights cycle doubt

Post by lnevo »

He wanted a slope...3 minutes was specified..
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Lights cycle doubt

Post by DrewPalmer04 »

Just noticed PAGE 2 of the thread. Lol!!! Duh. Everyone nice work thus far.
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
Bo0sted_Rafi
Posts: 75
Joined: Thu Mar 21, 2013 12:11 pm

Re: Lights cycle doubt

Post by Bo0sted_Rafi »

The 3 minutes slope is for the transition of light as natural as possible. Thanks
Image
Post Reply