Weather Simulation for Dimming expansion module

Share you PDE file with our community
avionixx
Posts: 20
Joined: Thu Apr 25, 2013 10:12 pm

Re: Weather Simulation for Dimming expansion module

Post by avionixx »

jjdezek wrote:ok im interesting in doing this code but im new to the coding and dont know what the channel max and flicker is? i know i my lights dont kick on until they hit 10 and they peak at 35 for whites and 40 for blue. where do you get the 31 number and the 200's from?

Channel max is basically the max intensity you want your lights to be (from 0-255) and channel flicker is how low your lights can be dimmed before they start to flicker. Keep in mind that both values must add up to 255 or less, any more and the lights won't turn on.

What I ended up doing was using percentages to calculate the values; I keep all of my lights at 60% max so I multiplied 255 x .6 and got 153 for channel max. As for the channel flicker, my drivers can dim to 0 without flickering so I put it as 1. If you have drivers that can't dim to 0, you'll have to do some trial and error to see how low they can go without flickering.
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

so my max is 40% on blues so i take 255 x .4=102 so i would put 102 in the channels that are for blue? whites peak at 35% so i would put 89?
Image
avionixx
Posts: 20
Joined: Thu Apr 25, 2013 10:12 pm

Re: Weather Simulation for Dimming expansion module

Post by avionixx »

jjdezek wrote:so my max is 40% on blues so i take 255 x .4=102 so i would put 102 in the channels that are for blue? whites peak at 35% so i would put 89?
Yup, you got it!
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

ok i went through the code and changed things to my liking and what not. i tried loading it and it came back with error invalid digit "9" in octal contstrant
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

do you paste the code into the regular sketch or is there someplace else you put it? i tried the standard code without modifying it and it gave me the same error? what are the steps to load this code?
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Weather Simulation for Dimming expansion module

Post by lnevo »

Sounds like a syntax error, can you post the full code and the compiler error msg.
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

i tried but it said im only allowed 60000 files too big.....im a noob and not sure how to do all this posting codes on forum
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

The following features were automatically added:
Watchdog Timer
Version Menu

The following features were detected:
Simple Menu
sketch_jun02b.cpp:41:19: error: invalid digit "9" in octal constant
sketch_jun02b.cpp:41:27: error: invalid digit "9" in octal constant
sketch_jun02b.cpp:41:35: error: invalid digit "9" in octal constant
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Weather Simulation for Dimming expansion module

Post by lnevo »

Awesome so those errors are telling you which lines have errors in them. Sometimes its above or below depending on the errors. Can you post the full code?
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

i tried it said the code was too big to upload...i went back to original code and redid it now its scanning fine. before i load this into my dimmer expansion i have one question. i put the lat and long for hawaii but im in ga if i understand it correctly it will still come on in the morning here not there right?
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

The following features were automatically added:
Watchdog Timer
Version Menu

The following features were detected:
Simple Menu
Binary sketch size: 20,366 bytes (of a 258,048 byte maximum)
C:\Program Files (x86)\Reef Angel Controller\hardware/tools/avr/bin/avrdude -CC:\Program Files (x86)\Reef Angel Controller\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cstk500v2 -P\\.\COM3 -b115200 -D -Uflash:w:C:\Users\CHRIST~1\AppData\Local\Temp\build1339424212411784875.tmp\sketch_jun02b.cpp.hex:i

avrdude: Version 6.0, compiled on Apr 6 2012 at 19:29:19
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch

System wide configuration file is "C:\Program Files (x86)\Reef Angel Controller\hardware/tools/avr/etc/avrdude.conf"

Using Port : \\.\COM3
Using Programmer : stk500v2
Overriding Baud Rate : 115200
Rebooting Reef Angel Controller
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

avrdude done. Thank you.
tried loading and got this error
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Weather Simulation for Dimming expansion module

Post by lnevo »

If its from the original code it will assume that you are in GMT. So that makes things a but tricky.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Weather Simulation for Dimming expansion module

Post by lnevo »

That error usually needs cable reseated or even a reboot required (issues with serial port)
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

how do you reboot? also how would i set it to my time zone?
Image
avionixx
Posts: 20
Joined: Thu Apr 25, 2013 10:12 pm

Re: Weather Simulation for Dimming expansion module

Post by avionixx »

Make sure you set the controller to Reef Angel w/optiboot. Got timeout errors too when I tried to upload until Roberto said to set it to that option.

And yes, regardless of the coordinates you enter, it should adjust it to match your timezone.
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

ok cool thanks will give it another go
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

and presto it loaded without errors....now we will see if everything works as it should.....AWESOME!!!
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

ok so i loaded the program and lights were on for a few mins then they just completly shut off, my whites are at 8% and lights should kick off at 10% but my blues are showing at 16% so they should still be on. i also staggard my lights to go at different times left should be 30mins before middle and middle 30 mins before right. the only thing i would think that would cause that is the flicker settings? anyone agree or disagree?
YOU MUST READ EVERY WORD IN THIS SECTION IN ORDER TO APPROPRIATELY CONFIGURE THIS PROGERAM- READ EVERY LINE BELOW///
byte ChMax[]={102,89,102,89,102,89,0,0};//Incremental value (Max-flicker) above flicker you want as max intensity (!!!!!!! Light Set Point is ChMax PLUS Flicker !!!!!!)
byte flicker[]={29,29,29,29,29,29,0,0};//need to input actual values here for flicker point on all channels in PWM expansion box

also do i need to change anything with my original light schedual, will that interfere with this coding? reason i ask is since i loaded the new coding it should off set my lefts by 30 mins each from the way i set them up but all whites are reading same percent and all blues are reading same percent almost like my wizard set up for lights is interfering with this code?
Image
avionixx
Posts: 20
Joined: Thu Apr 25, 2013 10:12 pm

Re: Weather Simulation for Dimming expansion module

Post by avionixx »

Did you modify the ChOffset settings? Those are what will determine how much (if any) delay and advance is configured for sunset and sunrise.

As far as I know, any settings you coded into your RA module with the wizard should have no effect, since the Weather Sim code takes over the PWM dimming completely.
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

yes i set the offset by 2hrs

//THESE values are the number of seconds that a particular channel will be offset from the rise/set time, i.e. negative to rise earlier/set earlier
int Choffset[]={
-7200,7200,-7200,7200,-6600,6600,-6600,6600,-6000,6000,-6000,6000,0,0,0,0};
now when i woke up this morning my lights look like there on full power but my RA display and the portal are showing that my blues are at 4%. so it seems the wizard is still working the display but the coding is working the expansion. only question i have is why is it so bright this early in the morning? is it going to get brighter? how do i tell what % its really at?
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

anyone?
Image
avionixx
Posts: 20
Joined: Thu Apr 25, 2013 10:12 pm

Re: Weather Simulation for Dimming expansion module

Post by avionixx »

According to the tutorial text, the lights should hit ChMax around noon time so they shouldn't have been at max brightness that early in the morning. As for getting the % value to output to the controller display, we'd have to wait for rufessor to wander back in here for assistance.
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

well its now 2:43 and the lights havent gotten any brighter they may have dimed a little hard to tell. I did get some cloud action kinda freaked me out at first thought something was going crazy and burning up the way it was going dim bright dim bright but then it went bright and stayed. i dont know if i put something in the code wrong, most likely did. if anyone can see anything here is the parts i changed in the code
byte ChMax[]={102,89,102,89,102,89,0,0};//Incremental value (Max-flicker) above flicker you want as max intensity (!!!!!!! Light Set Point is ChMax PLUS Flicker !!!!!!)
byte flicker[]={29,29,29,29,29,29,0,0};//need to input actual values here for flicker point on all channels in PWM expansion box
boolean Wchannel[]={0,1,0,1,0,1,0,0}

byte DimOrder[]={0,0,1,1,0,0,0,0};
//set all channel positions that you would like to use for the lightning strike effect to 1 (0-5 are PWM channels 6,7 are Main PWM outs)- and channels with a 0 are not used in strike
byte StrikeChannel[]={0,0,0,1,0,0,0,0};
byte MoonCh[]={0,0,0,0,0,0,0,0};/

int Choffset[]={
-7200,7200,-7200,7200,-6600,6600,-6600,6600,-6000,6000,-6000,6000,0,0,0,0};
// NOW SET YOUR LATIDTUDE AND LONGITUDE COORDINATES as Degrees, Minutes, Seconds of Lat and Lon
//If Your NORTH of the equator your LONGITUDE must START with a NEGATIVE number (the rest are positive) e.g. All of North America, Europe, Russia etc are negative
//If Your EAST of the Prime Meridian your LATITUDE must START with a NEGATIVE number (the rest are positive), e.g. Most of Europe, All of China, India, Austraila, Russia etc are negative
latitude=dmsToSeconds(20,54,00);//United States of America- Salt Lake City, local time is -7 hours GMT
longitude=dmsToSeconds(-155,35,00);

that LAT and LONG is Hawaii and im in Georgia. While sitting here typing this two more clouds passed. they seem to go really fast.
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

heres a video of the clouds on my set up. kinda hard to see but its more noticable in person. I think the iphone auto adjusted when the lights changed.
http://s1302.photobucket.com/user/jjdez ... 4.mp4.html
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

Well I think I figured out what I did. In the time offset I wanted the lights to come on later and turn off later. I put a negative infront of the on time so instead of them turning on later there turning on earlier. Whooopsy
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Weather Simulation for Dimming expansion module

Post by lnevo »

Awesome!
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

Yeah the wife had to get up at 5:30 and said lights were on that's when I put two and two together. Might still have to play with it to get it to come on at the right time. Thanks for everyone's help. I will post a video of the lightening when I can catch it
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

Here is a thunderstorm on my lights. I'm using meanwell ELN60-48D drivers so I think the lights stay on for a sec longer then they should.
Image
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

is there anyway to code this so that the light percent will display on the lcd, portal, and apps?
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

ok got another question on this, i read through the cloud dimming part and it says to pair the lights you want to dim together with 0's and 1's. I have three different lights that go from left to right on my tank i put the left lights (blues and whites) as 0 then put the center lights (blues and white) as 1 then the right lights (whites and blues) i put as 0. does that make them dim with the left lights? if so is there a way to make them dim as a third set, so it would go left lights center lights then right lights? could i plug the number 2 in there or would that mess the code up? any help would be greatly appreciated.
Image
Post Reply