Analog Dimming & MOONPHASE ?

New members questions
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

Will this do the trick? I was getting an error. So I added a time-out value

Code: Select all

#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
     ReefAngel.FeedingModePorts = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 860 );
    

    // Ports that are always on
    ReefAngel.Relay.On(Port3);
    ReefAngel.Relay.On(Port4);
    ReefAngel.Relay.On(Port7);
    ReefAngel.Relay.On(Port8);
    ////// Place additional initialization code below here
    
    

    ////// Place additional initialization code above here
}

void loop()
{
    // Specific functions that use Internal Memory values
    ReefAngel.StandardLights( Port1,19,0,6,30 );
    ReefAngel.StandardHeater( Port4,740,770 );
    ReefAngel.StandardLights( Port7,6,0,20,0 );
    ReefAngel.StandardLights( Port8,7,0,19,0 );
    ReefAngel.Wavemaker1(Port5);
    ReefAngel.Wavemaker2(Port6);
    ReefAngel.PWM.SetDaylight( PWMParabola(7,5,19,0,0,85,0) );
    ReefAngel.PWM.SetActinic( PWMParabola(6,5,21,0,0,85,0) );
    ReefAngel.SingleATOHigh(60);
    

    ////// Place your custom code below here
    pinMode(lowATOPin,OUTPUT); 
    analogWrite(lowATOPin,(int)MoonPhase()*2.55);
    
    

    ////// Place your custom code above here
    // This sends all the data to the portal
    // Do not add any custom code that changes any relay status after this line
    // The only code after this line should be the ShowInterface function
    ReefAngel.Portal("DrewPalmer04", ********");

    // This should always be the last line
    ReefAngel.ShowInterface();
}
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Analog Dimming & MOONPHASE ?

Post by rimai »

I just saw you have all settings in the code, so it is easier for you to use this instead then:

Code: Select all

ReefAngel.SingleATO( false,Port2,60,0 );
You can change the Port2 to whatever port you have your ATO pump plugged into.
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

Great got it uploaded...this should allow ATOlow to dim with the moonphase now? between 0-5VDC?
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Analog Dimming & MOONPHASE ?

Post by rimai »

yeah :)
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

I'm still getting that flash...i wonder why? The moon being 89% right now (Waxing Gibbous) I'm not sure how to tell if it's dimmed or not (I guess Voltimeter)...

Another thing..I have the LEDs plugged in now...is there anyway to set a schedule for on/off phrams? Or should I just leave them on all the time?
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Analog Dimming & MOONPHASE ?

Post by rimai »

Yes, a meter works.
I think you already have it setup to turn on/off:

Code: Select all

    ReefAngel.StandardLights( Port7,6,0,20,0 );
    ReefAngel.StandardLights( Port8,7,0,19,0 );
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

The moon lights are powered by ony the 0-5vdc output of that low ATO port. I guess there is no way to tell it to follow 0-5v moon phase but reach 0 at a certain time of the day?

What I mean is I'm not using a dimmable driver for the LEDs...just resistors for the inflow of the 0-5VDC power. ;)
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

Solved the flashing issue: This way the pin lowATO is set up as output...then loops moonphase

Code: Select all

#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
     ReefAngel.FeedingModePorts = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 860 );
    pinMode(lowATOPin,OUTPUT); 
    

    // Ports that are always on
    ReefAngel.Relay.On(Port3);
    ReefAngel.Relay.On(Port4);
    ReefAngel.Relay.On(Port7);
    ReefAngel.Relay.On(Port8);
    ////// Place additional initialization code below here
    
    

    ////// Place additional initialization code above here
}

void loop()
{
    // Specific functions that use Internal Memory values
    ReefAngel.StandardLights( Port1,19,0,6,30 );
    ReefAngel.StandardHeater( Port4,740,770 );
    ReefAngel.StandardLights( Port7,6,0,20,0 );
    ReefAngel.StandardLights( Port8,7,0,19,0 );
    ReefAngel.Wavemaker1(Port5);
    ReefAngel.Wavemaker2(Port6);
    ReefAngel.PWM.SetDaylight( PWMParabola(7,5,19,0,0,85,0) );
    ReefAngel.PWM.SetActinic( PWMParabola(6,5,21,0,0,85,0) );
    ReefAngel.SingleATO( false,Port2,60,0 );

    
    ////// Place your custom code below here
    analogWrite(lowATOPin,(int)MoonPhase()*2.55);
    

    ////// Place your custom code above here
    // This sends all the data to the portal
    // Do not add any custom code that changes any relay status after this line
    // The only code after this line should be the ShowInterface function
    ReefAngel.Portal("DrewPalmer04", "********");

    // This should always be the last line
    ReefAngel.ShowInterface();
}
Would still like to figure out how to make them turn off at 0600 until 2100 from the output pin of lowATO
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Analog Dimming & MOONPHASE ?

Post by rimai »

Try this:

Code: Select all

if (hour>=21 || hour()<6)
    analogWrite(lowATOPin,0);
else
    analogWrite(lowATOPin,(int)MoonPhase()*2.55);
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

RA_052912_1615custom2.cpp: In function 'void loop()':
RA_052912_1615custom2:88: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator>='
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Analog Dimming & MOONPHASE ?

Post by rimai »

Typo :( Sorry

Code: Select all

if (hour()>=21 || hour()<6)
    analogWrite(lowATOPin,0);
else
    analogWrite(lowATOPin,(int)MoonPhase()*2.55);
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

This one did it! :)

Code: Select all

if (hour()>=2100 || hour()<0600)
    analogWrite(lowATOPin,0);
    else
    analogWrite(lowATOPin,(int)MoonPhase()*2.55);
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

Roberto. Sorry but still no out put from the lowATO. I have the code you posted above. Any idea?
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Analog Dimming & MOONPHASE ?

Post by rimai »

Sorry, the code you posted is wrong.
You will never get hour to be 2100.
We only have 24 hours.
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

What I meant to say was I returned to your code at the top of this page. Nothing happens.

I'm going to try to use a if else command to just use my meanwell drivers to use Pwm parabola until 8pm to 6am then "else" to moon phase ? Possible?
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

Fixed..working perfect...confirmed:

Code: Select all

if (hour()>=21 && hour()<6)
    analogWrite(lowATOPin,0);
else
    analogWrite(lowATOPin,(int)MoonPhase()*2.55);
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
Post Reply