PWM dimming using standard lights & low ATO - seeking advice
Posted: Tue Jan 19, 2016 2:19 am
Hi guys,
I would really appreciate it if one of the gurus on this forum could take a look at my code and see if makes sense and whether there's anything wrong/missing...
Context - Additional features
* I want to control and dim 3 strings of LED lights with my RA+, using the standard Actinic and Daylight ports as well as the Low ATO port. My LED strings are:
1) Meanwell LDD 5 volt [using Actinic port]
2) Meanwell LDD 5 volt [using Daylight port]
3) Meanwell ELN-P 10 volt [using LowATO port]
* I also want to control the fan on my light unit via Temperature probe 1, where the fan will be plugged into port 8 and activated when the Temp probe reads a temperature of, say 40 degree Celsius. I have not yet added this into the code...
* Also, I would like to add the lightning and cloud features such as those amazing ones added to this forum
I have not yet added this into the code...
* And then, finally, I would like a really graphic (screen) to show the current lighting status/percentage per channel (for e.g. rename the LowATO port to "XMLs" so that it will display on the RA screen as "XML: 20%", or something like that! I have not yet added this into the code...
I'm not currently using expansion modules or WiFi (yet!).
Here is the code I came up with so far:
#include <ReefAngel_Features.h>
#include <Globals.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 <AI.h>
#include <DCPump.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.SetTemperatureUnit( Celsius ); // set to Celsius Temperature
ReefAngel.AddStandardMenu(); // Add Standard Menu
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit;
// 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( 30 );
// Ports that are always on
ReefAngel.Relay.On( Port1 );
ReefAngel.Relay.On( Port7 );
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
pinMode(lowATOPin,OUTPUT);
analogWrite(lowATOPin,PWMSlope(8,0,18,0,5,50,60,5));
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.SingleATO( false,Port2,360,0 );
ReefAngel.DosingPumpRepeat( Port3,0,60,20 );
ReefAngel.DosingPumpRepeat( Port4,0,240,10 );
ReefAngel.DosingPumpRepeat( Port5,0,300,10 );
ReefAngel.Wavemaker( Port6,60 );
ReefAngel.PWM.SetDaylight( PWMSlope(8,0,18,0,5,50,60,5) );
ReefAngel.PWM.SetActinic( PWMSlope(5,0,19,30,5,60,30,5) );
////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line
ReefAngel.ShowInterface();
}
Thank so much guys.
I would really appreciate it if one of the gurus on this forum could take a look at my code and see if makes sense and whether there's anything wrong/missing...
Context - Additional features
* I want to control and dim 3 strings of LED lights with my RA+, using the standard Actinic and Daylight ports as well as the Low ATO port. My LED strings are:
1) Meanwell LDD 5 volt [using Actinic port]
2) Meanwell LDD 5 volt [using Daylight port]
3) Meanwell ELN-P 10 volt [using LowATO port]
* I also want to control the fan on my light unit via Temperature probe 1, where the fan will be plugged into port 8 and activated when the Temp probe reads a temperature of, say 40 degree Celsius. I have not yet added this into the code...
* Also, I would like to add the lightning and cloud features such as those amazing ones added to this forum

* And then, finally, I would like a really graphic (screen) to show the current lighting status/percentage per channel (for e.g. rename the LowATO port to "XMLs" so that it will display on the RA screen as "XML: 20%", or something like that! I have not yet added this into the code...
I'm not currently using expansion modules or WiFi (yet!).
Here is the code I came up with so far:
#include <ReefAngel_Features.h>
#include <Globals.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 <AI.h>
#include <DCPump.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.SetTemperatureUnit( Celsius ); // set to Celsius Temperature
ReefAngel.AddStandardMenu(); // Add Standard Menu
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit;
// 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( 30 );
// Ports that are always on
ReefAngel.Relay.On( Port1 );
ReefAngel.Relay.On( Port7 );
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
pinMode(lowATOPin,OUTPUT);
analogWrite(lowATOPin,PWMSlope(8,0,18,0,5,50,60,5));
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.SingleATO( false,Port2,360,0 );
ReefAngel.DosingPumpRepeat( Port3,0,60,20 );
ReefAngel.DosingPumpRepeat( Port4,0,240,10 );
ReefAngel.DosingPumpRepeat( Port5,0,300,10 );
ReefAngel.Wavemaker( Port6,60 );
ReefAngel.PWM.SetDaylight( PWMSlope(8,0,18,0,5,50,60,5) );
ReefAngel.PWM.SetActinic( PWMSlope(5,0,19,30,5,60,30,5) );
////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line
ReefAngel.ShowInterface();
}
Thank so much guys.