Moon rise/set implementation

Share you PDE file with our community
User avatar
Posts: 5362
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Tue Jan 28, 2014 5:09 am
The moon library only provides the times based on a gps coordinate.

First unzip the package into your libraries folder. The in your INO you need to put this in the top

#include <Moon.h>

You the have to initialize the library with your coordinates

moon_init(21,-73);

That will populate the Moon rise/set variables. Here's a sample to set the daylight channel based on the moon rise/set

ReefAngel.PWM.SetDaylight(PWMSlope(Moon.riseH,Moon.riseM,Moon.setH,Moon.setM, 0,MoonPhase(),30,0));

It's not exact I think because of the lack of time zone support and that arduino thinks it's in GMT. I have not had time or care to get it to line up, but the key is that it creates a great lunar simulation with changing rise/set times.

Enjoy!
User avatar
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL
PostPosted: Wed Mar 12, 2014 12:42 pm
Trying to understand how to set this up.
My Lunar Hub and lights should be arriving tomorrow.

I take the moon.h file and put it in my RA libraries folder.
Then add #include <Moon.h> to the top section of my code.
In the loop() function, add this

moon_init(21,-73); // pass it lat / lon - it uses ints for the caclulation...

ReefAngel.PWM.SetChannel(5, PWMSlope(Moon.riseH,Moon.riseM,Moon.setH,Moon.setM, 0,MoonPhase(),30,0));

I'm putting this on channel 5 of the dimming module.

According to a table I found online the Moonrise for tonight is 4:13 PM and the Moonset is 4:47 AM with the Meridian Passing time at 10:51 PM (is the the peak or azimuth).

Do I need to do anything with the numbers I made red aare those variables that can be adjusted?
ReefAngel.PWM.SetChannel(5, PWMSlope(Moon.riseH,Moon.riseM,Moon.setH,Moon.setM, 0,MoonPhase(),30,0));

Also if my Actinic lights come on at Noon and go off at 10pm will there be a period of time where no lights are on like 4:47am to 12pm, what will be happening there?
User avatar
Posts: 5362
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Mar 12, 2014 1:03 pm
0 is the starting point for the slope. 30 is the slope duration. The last 0 os the default when the moon is not out.

As i said before i think timezone may skew when the ra calculates rise/set since ra does not use timezones.

Also you are comparing your rise/set but the gps coordinates i think were mine which is somewhere in the carribean...i guess close enough to you ;)

If you want set Moon.riseH etc to a custom variable or display it on a custom screen to see what times are calculated...
User avatar
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL
PostPosted: Wed Mar 12, 2014 1:31 pm
Yes you did mention the offset because of the time zones.
If I wanted to be more accurate with GPS coordinates I would put in moon_init(20,-80); // pass it lat / lon - it uses ints for the caclulation...

I got those from http://www.gps-coordinates.net/ for my address.

This works with Parabola too, correct?
User avatar
Posts: 5362
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Mar 12, 2014 2:09 pm
Your just getting the rise and set time. You can use it for whatever function you want.

You could even add a check to see if moon is up and run your jaebos at a different mode or speed :)

moon_init just loads up the variables and then you can use them for whatever you want.
User avatar
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL
PostPosted: Wed Mar 12, 2014 2:29 pm
I don't want to get too complicated right now.
I just want to set up a realistic Moon cycle.

I want to try to set this up on my own and not have to get others involved like I did on the de-nitrification system.

Posts: 12327
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Wed Mar 12, 2014 2:42 pm
Do you want to just know what % of full moon today is or you need to know the time of moon rise/set??
I use just the % of the full moon and it works just fine :)
New moon, the tank is super dark and full moon the tank has a nice shine at night.
Roberto.
User avatar
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL
PostPosted: Wed Mar 12, 2014 3:08 pm
I think what I want to do is use % of the moon, but set it to my on and off time.
For example my lights go out at 10pm so I would want the moon to be fully up by 10pm and then set at 12noon when my lights come back on.

My LED's are not set up yet so I'm just using my old Power PC's as an on/off.

When I get the LEDS running I will probably want to do a more realistic sunrise/sunset & moon rise/moon set.
User avatar
Posts: 5362
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Mar 12, 2014 3:15 pm
So you just need the MoonPhase() function thats built into the libraries
User avatar
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL
PostPosted: Wed Mar 12, 2014 4:03 pm
That will do % of the full moon?

Sent from my HTC One VX using Tapatalk
Previous

Return to My PDE/INO file

Who is online

Users browsing this forum: No registered users and 0 guests

cron