PWM dimming using standard lights & low ATO - seeking advice

Do you have a question on how to do something.
Ask in here.
Post Reply
JimJim
Posts: 6
Joined: Mon Sep 08, 2014 11:44 pm

PWM dimming using standard lights & low ATO - seeking advice

Post by JimJim »

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.
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: PWM dimming using standard lights & low ATO - seeking ad

Post by cosmith71 »

The actinic and daylight ports are 10v, unless you do some hardware modification. The ATO ports are 5v only.

The simpler way would be to use a dimming expansion, which can do 5v or 10v. That would also activate the built in screen for the dimming channels. We'd just have to figure out how to change the labels.

--Colin
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: PWM dimming using standard lights & low ATO - seeking ad

Post by binder »

changing labels would most likely be done inside the libraries (not hard at all to do). you would just have to remember you did it because each time you upgrade the libraries, that change would be reset.

Sent from my XT1585 using Tapatalk
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: PWM dimming using standard lights & low ATO - seeking ad

Post by cosmith71 »

I wonder if there is a way to change them via ReefAngel.CustomLabels[]. I tried looking in the libraries but I couldn't figure it out.

--Colin
JimJim
Posts: 6
Joined: Mon Sep 08, 2014 11:44 pm

Re: PWM dimming using standard lights & low ATO - seeking ad

Post by JimJim »

Thanks very much for the advice. I'm going to look into getting a Dimming Expansion (they cost almost as much as the whole RA+ unit and standard accessories, over here in South Africa due to our weak currency!).

Would either of you guys know why I get flickering when I connect my Meanwell LDD driver to the RA (to the ATO port as the meanwell requires 5v for PWM)? Is this a compatibility issue?

Thanks again.
Post Reply