Climate Library and Web Service

Requests for new functions or software apps
thekameleon
Posts: 137
Joined: Sat Feb 16, 2013 7:44 am

Climate Library and Web Service

Post by thekameleon »

Hi everyone,
I am new to RA, but like many of you. I do like making cool stuff and I love my tanks. I have seen a lot of great contribution work and well I would like to contribute something to the cause.

First, I would like to put a library together for Weather effects for not only clouds and lightning, but for all things climate (rain, currents, etc...). I want to make the library easy to integrate into RA. With that I will share some ideas I have and I open the floor for other ideas as well. I'll put it on github for others that way to contribute as well.

Second, I want to know what the appetite is for a web based service that can pseudo real-time control the climate conditions of your tank. I wouldn't need a connection to your computer, just the wifi attachment module or potential other Ethernet devices. You would pick a latitude and longitude somewhere in the ocean and what ever weather condition is happening there would also occur in your tank... (Clouds, storm, current, etc... even rain)... Obviously, not everyone lives in the same time zone, so the commands would be delayed for your local time zone. I also want to be able to setup notification services, so you can get immediate notifications sent to your mobile device (via text message or push notification) or emailaddress.

I welcome your feedback.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Climate Library and Web Service

Post by DrewPalmer04 »

How would you get that data for currents etc? How specific does the data get?
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
thekameleon
Posts: 137
Joined: Sat Feb 16, 2013 7:44 am

Re: Climate Library and Web Service

Post by thekameleon »

I would use a weather service like wunderground.com... I am open to other services as well
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Climate Library and Web Service

Post by DrewPalmer04 »

I'd personally love a wizard that allows me to pick weather changes throughout the weeks. If they could be pre-defined weather patterns for 4 weeks then the next month it would shuffle the weeks to keep it random. I think it would be easier than lat/long. I'm a control freak so I'd prefer this method over what the weather would be on the lat/long. I thing I don't like most is that it could be 3 weeks of full sun or 3 weeks of rain. I don't want to look at my tank for 3 weeks in "rain mode." but that's just me...
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
thekameleon
Posts: 137
Joined: Sat Feb 16, 2013 7:44 am

Re: Climate Library and Web Service

Post by thekameleon »

Thanks for the feedback. So you would prefer to define weather for a specified period of time say a week then have those periods randomly shuffle themselves.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Climate Library and Web Service

Post by DrewPalmer04 »

I would. But developement is up to you.
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
thekameleon
Posts: 137
Joined: Sat Feb 16, 2013 7:44 am

Re: Climate Library and Web Service

Post by thekameleon »

Here are some things I am thinking about. First, I want to create a lightweight climate solution that can leverage the Actinic and Daylight pins as well as say two outlets on the Main Relay box for wave makers. This would allow you to create basic weather effects such as clouds and storms (lightning) as well as controlling of wavemaker pumps (On and off through the main relay).

Now for more advanced setups where someone may want to use the PWM Dimmer Expansion modules to control lighting, multiple wave maker pumps and RF. I intend on leveraging a PWM Dimmer module to run the program to offload the controller. This will then have all climate related activities (Sun, moon, clouds, waves, etc...) ran independently of the Main controller, yet still allow the main controller to set the preferences for your climate effects. So you can use the existing tools and wifi attachment
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Climate Library and Web Service

Post by rimai »

Sounds interesting :)
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

I wouldn't mind having tidal information and adjust my vortech speed and potentially other settings based on that...

Roberto, i read on another forum someone using the apex wxm(?) module and switching their pumps from master/anti-sync and vice versa. Do we have any way of changing pump modes from the rf module? Obviously if this is possible then there must be something in the protocol..but again this was hearsay...

So, if we can get that working :) I'd switch my pumps based on the tide in and out :)
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Climate Library and Web Service

Post by rimai »

Not that I'm aware of.
The only way I know of to switch sync/anti-sync/back-of-tank is pressing mode button on the driver itself.
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

Roberto, check out page 8 and 9 and specifically the advanced programming section...

http://www.aquariumspecialty.com/media/ ... Manual.pdf

Seems they are using the sync / anti-sync (non ecosmart) profiles, but able to address each pump individually...

What do you think?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Climate Library and Web Service

Post by rimai »

I created a custom mode that allows you to control them individually too.
I just never found a good use for it.
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

You think this would qualify?
thekameleon
Posts: 137
Joined: Sat Feb 16, 2013 7:44 am

Re: Climate Library and Web Service

Post by thekameleon »

lnevo wrote:I wouldn't mind having tidal information and adjust my vortech speed and potentially other settings based on that...
You mean tidal information from a web service? I think the tides can be simulated based on lat, long, and time. The mass of the earth, sun and moon are static. We can calculate the position of the earth, sun and moon to figure out the rest.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

I'd be fine with it calculated...
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

I looked up how this can be calculated....and no, it would be best to use an online source :) so yeah, that'd be cool info to have :D
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Climate Library and Web Service

Post by binder »

Just a quick comment pertaining to the code on github, i would discourage against using references and passing variables by reference simply because of the memory constraints of the system. you can get a lot of unknown errors encountered. i had a terrible time using new and delete for creating variables and code. so you may want to rework your classes to incorporate the variables in them. i can explain and look more later but i wanted to make this comment now when i had a free second from work. and no, i have not looked at all of the code, i just saw a quick spot with an example ino file.
thekameleon
Posts: 137
Joined: Sat Feb 16, 2013 7:44 am

Re: Climate Library and Web Service

Post by thekameleon »

I thought passing in variables by value was a bad practice as it forces a copy of object for that scope it is passed into. My problem was I had issues with passing by value... Since I saw your post, I just figured out what I did wrong and fixed it. However when I compile now my sketch size has gotten larger. So I think when you refer to memory, you are referring to the running process, correct?

By the way, in case you are wondering. I am using VisualMicro with Visual Studio 2012 for is debugging ability, like stepping through code.
Last edited by thekameleon on Fri Feb 22, 2013 2:31 pm, edited 1 time in total.
thekameleon
Posts: 137
Joined: Sat Feb 16, 2013 7:44 am

Re: Climate Library and Web Service

Post by thekameleon »

lnevo wrote:I looked up how this can be calculated....and no, it would be best to use an online source :) so yeah, that'd be cool info to have :D
Do you think it is the complexity or is there some other reason?
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

Way too complex and not simply calculation. A lot of local current factors are taken into account. Everyone who asks gets told to look up off online sources :)
thekameleon
Posts: 137
Joined: Sat Feb 16, 2013 7:44 am

Re: Climate Library and Web Service

Post by thekameleon »

So would you be willing to pay for it? My problem is two fold... First hosting a web service, costs money. Second, I have yet to find a weather service that includes tide info for free. It would be kept low as possible, like say 10 bucks a year.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Climate Library and Web Service

Post by lnevo »

Honest answer... nope. It's just not that important to have another bill. I doubt there'd be enough to pay for any web hosting service. I'd rather come up with a function to simulate it and have it be fake then to start paying money for my fish tank to have legitimate tides :)
thekameleon
Posts: 137
Joined: Sat Feb 16, 2013 7:44 am

Re: Climate Library and Web Service

Post by thekameleon »

Fair enough... back to the calculation then :)
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

I did find some open source software (XTide) that does the calculations...unfortunately it requires harmonic files that are only available for the US. Apparently other countries have pulled this data from the public domain so the author does not maintain international data...
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Climate Library and Web Service

Post by binder »

thekameleon wrote:I thought passing in variables by value was a bad practice as it forces a copy of object for that scope it is passed into. My problem was I had issues with passing by value... Since I saw your post, I just figured out what I did wrong and fixed it. However when I compile now my sketch size has gotten larger. So I think when you refer to memory, you are referring to the running process, correct?

By the way, in case you are wondering. I am using VisualMicro with Visual Studio 2012 for is debugging ability, like stepping through code.
Yes, passing variables in by value does copy the entire variable for the function to use. So it is bad practice to copy large variables (memory locations) around. It is better to pass a reference / pointer to them. However, I have noticed in the past that by doing that, arduino and the libraries get "messed up" at times (yes, I know, very technical wording). It would lose it's pointer and start referencing null memory.

Yes, with memory I'm referring to the RAM and the actual code compile size.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Climate Library and Web Service

Post by lnevo »

So, there are definitely free sites out there that have tidal information... I'm going to look at some data here for some info to build a faux schedule..

http://www.toptides.com/HI/2013/march/H ... awaii.html

I'll probably start a new thread to focus on a tidal program for setting wavemakers for those that are interested, but once that's set it could easily hook to realitime data if we had that functionality..

Random question, does anyone know why our MoonPhase() function peaks at 78%? I'm considering multiplying the value *1.28 to get full 0-100 dimming for my moonlights and for this option.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Climate Library and Web Service

Post by rimai »

lnevo wrote:Random question, does anyone know why our MoonPhase() function peaks at 78%? I'm considering multiplying the value *1.28 to get full 0-100 dimming for my moonlights and for this option.
Bug :(
This is from the MoonPhase function:

Code: Select all

	PWMvalue = 4*abs(50-V);  // 5.12=100%    4=~80%
As you can see, multiplying by 4 gives a range of 0-80%....
Anyway, revisiting the function, I noticed some calculations that don't really need to be there.
The function should be this:

Code: Select all

byte MoonPhase()
{
	int m,d,y;
	int yy,mm;
	long K1,K2,K3,J,V;
	m = month();
	d = day();
	y = year();
	yy = y-((12-m)/10);
	mm = m+9;
	if (mm>=12) mm -= 12;
	K1 = 365.25*(yy+4712);
	K2 = 30.6*mm+.5;
	K3 = int(int((yy/100)+49)*.75)-38;
	J = K1+K2+d+58-K3;
	V = (J-2451550.1)/0.29530588853;
	V -= int(V/100)*100;
	V = abs(V-50);
	return (byte)(2*abs(50-V));
}
I'll update it in the next libraries patch... Thanks for finding it out :)

https://github.com/reefangel/Libraries/issues/63
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

So now that'll be 0-100%

How about MoonphaseLabel()? Will that match?

Thanks!!
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Climate Library and Web Service

Post by rimai »

The label has always been right all along. It uses different math at the end.
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Climate Library and Web Service

Post by lnevo »

Cool.
Post Reply