Analog Dimming & MOONPHASE ?

New members questions
CASPAR
Posts: 48
Joined: Wed May 09, 2012 12:24 pm

Analog Dimming & MOONPHASE ?

Post by CASPAR »

I have the RA + Analog and wish to have my moonlights dim or say work with moonphase this is my code could someone check it, it shows PWM just would like to run moonlights on the Actinic dimming side and overheat buzzer off of Daylight side created this code in Wizard mode in Arduino 1.0 here is code:

#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 <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <ReefAngel.h>

// Initialize Buzzer variables
byte buzzer=0;
byte overheatflag=0;

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


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


void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit;
// 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 = Port5Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 800 );


// Ports that are always on
ReefAngel.Relay.On( Port1 );
ReefAngel.Relay.On( Port2 );
ReefAngel.Relay.On( Port7 );

////// Place additional initialization code below here


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

void loop()
{
ReefAngel.StandardLights( Port3,11,0,19,0 );
ReefAngel.StandardLights( Port4,13,0,17,0 );
ReefAngel.StandardHeater( Port5,782,785 );
ReefAngel.StandardFan( Port6,780,785 );
ReefAngel.StandardLights( Port8,19,0,11,0 );
ReefAngel.PWM.SetActinic( MoonPhase() );
overheatflag = InternalMemory.read( Overheat_Exceed_Flag );
buzzer = overheatflag;
if ( buzzer > 1 ) buzzer = 100;
ReefAngel.PWM.SetDaylight( buzzer );

////// Place your custom code below here


////// Place your custom code above here

// This should always be the last line
ReefAngel.Portal( "CASPAR" );
ReefAngel.ShowInterface();
}
Image
CASPAR
Posts: 48
Joined: Wed May 09, 2012 12:24 pm

Re: Analog Dimming & MOONPHASE ?

Post by CASPAR »

Ok moonlight seems to be working plugged into actinic side but can not get buzzer to work off of daylight side for over heat alarm..........Any ideas?
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Analog Dimming & MOONPHASE ?

Post by rimai »

Let me check on that later today.
Roberto.
CASPAR
Posts: 48
Joined: Wed May 09, 2012 12:24 pm

Re: Analog Dimming & MOONPHASE ?

Post by CASPAR »

Ok thanks and noticed when using moonphase webpage portal shows actinic at 32% anything lower than that and moonlight goes completly out change dates on pc then change date on RA to match and moonlight seems to increase with phase of moon as should, but when their is say a quarter moon led moonlight goes totally out when actinic side is saying say 30% And buzzer side set up on daylight side shows hardly no voltage output to even power the buzzer at a known high temp.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Analog Dimming & MOONPHASE ?

Post by rimai »

You just found the first bug on the Wizard :)
For the buzzer to work, replace this:

Code: Select all

if ( buzzer > 1 ) buzzer = 100;
With this:

Code: Select all

if ( buzzer >= 1 ) buzzer = 100;
I'll update the Wizard to fix this bug.

The moonlights were designed to dim properly on the PWM signal.
On analog, there is a cut off point that you are experiencing.
It looks like you don't really need the analog signal. If you are interested on exchanging it for a PWM signal, simply PM me.
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

How would I do a moon phase when my two dimming channels are already used for analog meanwell drivers? I don't need fancy just a possibility to have some LEDs that follow the moon cycle. ATO ports on head unit impossible to use? I assume they don't dim. Only switch? Options?
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 »

It is possible, but the ATO port is not boosted and will only output 5VDC.
The other option would be a dimming expansion module.
Roberto.
Blawson
Posts: 37
Joined: Sat Apr 14, 2012 10:02 pm

Analog Dimming & MOONPHASE ?

Post by Blawson »

With that said about the ato port, does that mean plugging in an ai nano will never get 100%
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Analog Dimming & MOONPHASE ?

Post by rimai »

AI uses different technology.
Those fixtures use serial communication and they have an independent controller inside the fixture.
That's why you can control all 3 channels with just a pair of wires.
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 code needed to make the ATO ports to go 0-5v with moon phase? That would suit me.
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 »

You can use the low ATO port.
What you need is this:

Code: Select all

  pinMode(lowATOPin,OUTPUT); 
  analogWrite(lowATOPin,(int)MoonPhase()*2.55); 
That will make the low ATO port to output 0-5V according to the moon cycle.
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

Thanks Roberto...now just to order more dimmer connectors. :( lol AND temp probes...andddd....never ending
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 »

where should this code be placed? After I placed in the software and uploaded my PWM values are even...and that's not how I have it programmed.

Code: Select all

// Autogenerated file by RAGen (v1.2.2.171), (05/29/2012 16:15)
// RA_052912_1615.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define WDT
#define SIMPLE_MENU
*/


#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
    pinMode(lowATOPin,OUTPUT); 
    analogWrite(lowATOPin,(int)MoonPhase()*2.55); 
    

    ////// 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) );
    

    ////// Place your custom code below here
    

    ////// 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();
}
Last edited by DrewPalmer04 on Wed May 30, 2012 11:56 am, edited 1 time in total.
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 »

It needs to go into the loop() section instead of setup()
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

Better?

Code: Select all

// Autogenerated file by RAGen (v1.2.2.171), (05/29/2012 16:15)
// RA_052912_1615.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define WDT
#define SIMPLE_MENU
*/


#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) );
    

    ////// 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 »

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

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

THANKS!

Will I need to deal with polarity? Which is (+)?
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, you need to watch polarity.
They have the same polarity as the standard PWM channels.
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

got it thanks!
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 »

I've got the moonlights wired in. I'm experiencing a pulse every 5-8 seconds? It's a millisecond probably, but this is a weird thing that is happening?

Ideas?
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 »

Are you using StandardATO? or SingleATO that uses the low port?
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

Please clarify?

I have a string of LEDs on the low port with proper polarity. I single connector going ONLY to the low ATO port.
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 meant if in your code you are using any ATO function.
Can you paste the code?
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've not modified anything related to ATO. I would assume its standardATO
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 »

That's probably the reason.
The StandardATO is querying that port to check for the float switch and interfering with the dimming.
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

Makes perfect sense. How do I change that code? Also how do I view my existing code without saving my custom code and uploading the total code again?
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 »

There is no way to reverse back what you have inside the RA already.
The best practice is to save the code with a filename that is easy for you to remember and open the file when you need to make changes.
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

Ok that's what I've been doing. That's good. So how do I go from standard to singleATO?
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 »

Instead of using StandardATO, you need to use SingleATOHigh
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Analog Dimming & MOONPHASE ?

Post by DrewPalmer04 »

Thanks. I'm sure I'll figure it out
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
Post Reply