Weather Simulation for Dimming expansion module

Share you PDE file with our community
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Weather Simulation for Dimming expansion module

Post by lnevo »

Sure.
rufessor
Posts: 293
Joined: Tue Oct 25, 2011 7:39 am

Re: Weather Simulation for Dimming expansion module

Post by rufessor »

So I was looking at the sunlocation library- I was originally thinking about trying to stream line this and use just what Kurt did in pulling the rise set calculations I did on top of the SWFLTEK library so that the weather package (thats what I am calling it) would use that pre existing library, but your running your offsets all in one, where as I have it set up to allow individual strings to accept different offsets. I think this will not resolve easily... so I think I will probably move to using the new moon library but otherwise were going to have to implement another instance of the rise and set calculations with my offset calculation in this new class. No big deal since the underlying code base from SWFLTEK is compact and people will not be running both weather and sunlocation- Maybe take a look at if its possible to condense this into a single universal class but its going to be probably beyond me to deal with this level of abstraction- I am confused enough dealing with my own code :mrgreen:

This will make more sense when you guys get code... but don't look for it today..
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Weather Simulation for Dimming expansion module

Post by lnevo »

I Think there would be overlap between users using both weather and sun location. Which offsets are you referring? We can easily break it up as needed, i can definitely help with that. We can also abstract offset stuff without having to make one big class also. I've been thinking now that my git is working to submit a pull request with sun/moon/tide. Weather would be a great one to have inside. So after you send the code we can go over what might be required! Sounds like you've made some good progress :)
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Weather Simulation for Dimming expansion module

Post by lnevo »

Another option would be to abstract out the swfltk libraries so both classes use them independently. Again, willing to help however I can :)
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Weather Simulation for Dimming expansion module

Post by binder »

yeah, all of that stuff can be easily abstracted. we just need a good solid foundation of how things will work and we can go from there. piece of cake. that was one of my specialties when i was a software engineer. :)
avionixx
Posts: 20
Joined: Thu Apr 25, 2013 10:12 pm

Re: Weather Simulation for Dimming expansion module

Post by avionixx »

I'm trying to upload this to my PWM expansion but for some reason the upload is always timing out. Do I need to make any changes to my upload settings to get it to finish?

I'm plugged in directly to the PWM module using the RA upload cable
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Weather Simulation for Dimming expansion module

Post by rimai »

Make sure you choose Reef Angel w/ optiboot as board
Roberto.
avionixx
Posts: 20
Joined: Thu Apr 25, 2013 10:12 pm

Re: Weather Simulation for Dimming expansion module

Post by avionixx »

Haha, that was the only option I didn't try. Thanks Roberto!
avionixx
Posts: 20
Joined: Thu Apr 25, 2013 10:12 pm

Re: Weather Simulation for Dimming expansion module

Post by avionixx »

Ok, so I got it up and running on my PWM module and everything looks like it's working except I notice that when clouds pass over, the dimming is choppy; it almost takes on a flickering type of quality. I'm not sure if this is normal or not, I was expecting it to be a bit smoother than what I'm experiencing. Any thoughts?
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: Weather Simulation for Dimming expansion module

Post by jjdezek »

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?
Image
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
Post Reply