Page 4 of 5
Re: Coding Pwm module.
Posted: Tue May 29, 2012 9:37 am
by rimai
I may have screwed up the numbers. They should've represented the time for cloud (C) and ligthtning(L)
Re: Coding Pwm module.
Posted: Tue May 29, 2012 9:48 am
by abhi_123
56:31 may be 2 days 8 hours 31 min? just a wild guess.
Re: Coding Pwm module.
Posted: Tue May 29, 2012 9:08 pm
by abhi_123
now my moonlight which was fixed on actinic is hanging. on portal it is showing 0% but my moonlight is shining brightly.
Re: Coding Pwm module.
Posted: Tue May 29, 2012 9:13 pm
by rimai
What does the controller show on AP?
Re: Coding Pwm module.
Posted: Tue May 29, 2012 9:17 pm
by abhi_123
zero
Re: Coding Pwm module.
Posted: Tue May 29, 2012 9:21 pm
by rimai
Can I see the code?
Re: Coding Pwm module.
Posted: Tue May 29, 2012 9:23 pm
by abhi_123
// Autogenerated file by RAGen (v1.2.2.171), (05/04/2012 21:21)
// RA_050412_2121.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
#define PWMEXPANSION
*/
#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
byte SeasonsVar[]={
0,0,0,0,0,0};
int LastNumMins=0;
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
// Ports that are always on
ReefAngel.Relay.On(Port4);
ReefAngel.Relay.On(Port7);
ReefAngel.Relay.On(Port3);
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
// Specific functions that use Internal Memory values
ReefAngel.SingleATOLow(Port1);
ReefAngel.StandardLights(Port2);
ReefAngel.WavemakerToggle(Port5, Port6, 60);
ReefAngel.StandardHeater(Port8);
// PWMSlope based on Internal Memory values for Standard Lights
if (ReefAngel.Relay.Status(Port2)) ReefAngel.PWM.SetActinic(0); else ReefAngel.PWM.SetActinic(MoonPhase());
////// Place your custom code below here
ReefAngel.PWM.SetChannel(0,PWMParabola(9,0,20,0,0,100,0));
ReefAngel.PWM.SetChannel(1,PWMParabola(9,0,20,0,0,100,0));
ReefAngel.PWM.SetChannel(2,PWMParabola(9,0,20,0,0,100,0));
ReefAngel.PWM.SetChannel(3,PWMParabola(9,0,20,0,0,100,0));
byte Fan1Speed;
Fan1Speed=map(ReefAngel.Params.Temp[1],722,950,30,100); // Calculate Fan 1 speed
Fan1Speed=constrain(Fan1Speed,0,100);
ReefAngel.PWM.SetChannel(4,Fan1Speed);
byte Fan2Speed;
Fan2Speed=map(ReefAngel.Params.Temp[2],722,950,30,100); // Calculate Fan 2 speed
Fan2Speed=constrain(Fan2Speed,0,100);
ReefAngel.PWM.SetChannel(5,Fan2Speed);
Wire.requestFrom(8,6);
for (int a=0;a<6;a++)
{
if (Wire.available()) SeasonsVar[a]=Wire.read();
}
if (LastNumMins!=NumMins(hour(),minute()))
{
LastNumMins=NumMins(hour(),minute());
ReefAngel.LCD.Clear(255,0,120,132,132);
ReefAngel.LCD.DrawText(0,255,5,120,"C");
ReefAngel.LCD.DrawText(0,255,11,120,"00:00");
ReefAngel.LCD.DrawText(0,255,45,120,"L");
ReefAngel.LCD.DrawText(0,255,51,120,"00:00");
if (SeasonsVar[4])
{
int x=0;
if (SeasonsVar[0]>=10) x=11; else x=17;
ReefAngel.LCD.DrawText(0,255,x,120,SeasonsVar[0]);
if (SeasonsVar[1]>=10) x=29; else x=35;
ReefAngel.LCD.DrawText(0,255,x,120,SeasonsVar[1]);
}
if (SeasonsVar[5])
{
int x=0;
if (SeasonsVar[3]>=10) x=51; else x=57;
ReefAngel.LCD.DrawText(0,255,x,120,SeasonsVar[3]);
if (SeasonsVar[4]>=10) x=69; else x=75;
ReefAngel.LCD.DrawText(0,255,x,120,SeasonsVar[4]);
}
}
////// 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("abhi_123","");
// This should always be the last line
ReefAngel.ShowInterface();
}
Re: Coding Pwm module.
Posted: Tue May 29, 2012 9:28 pm
by rimai
What happens if you reboot the controller?
Did it start after you added the last code?
Re: Coding Pwm module.
Posted: Tue May 29, 2012 9:33 pm
by abhi_123
the light is running continously even after unplugging the power cable when i again put the power its start.
Re: Coding Pwm module.
Posted: Tue May 29, 2012 10:09 pm
by rimai
I think I created a bug on the previous libraries release.
Can you use the update utility and upload your code again?
Re: Coding Pwm module.
Posted: Tue May 29, 2012 11:00 pm
by abhi_123
how to use it.
Re: Coding Pwm module.
Posted: Wed May 30, 2012 12:00 am
by abhi_123
I updated my utility to 0.9.9. will upload the code & update here.
Re: Coding Pwm module.
Posted: Wed May 30, 2012 7:53 am
by abhi_123
loaded the code & its working fine for now.
Re: Coding Pwm module.
Posted: Sat Jun 02, 2012 11:00 am
by abhi_123
The code is working fine for now. I want to add sunrise sunset effect as per season variance. So longer days during summer & shorter during winter.
Re: Coding Pwm module.
Posted: Sat Jun 02, 2012 12:02 pm
by rimai
Are you getting the cloud and lightning effects?
Re: Coding Pwm module.
Posted: Sat Jun 02, 2012 8:53 pm
by abhi_123
Yep. So far not bad.
Re: Coding Pwm module.
Posted: Sat Jun 02, 2012 8:57 pm
by rimai
Re: Coding Pwm module.
Posted: Mon Jun 04, 2012 10:14 am
by abhi_123
my led started flashing like crazy dont know wat went wrong.
Re: Coding Pwm module.
Posted: Mon Jun 04, 2012 12:26 pm
by rimai
Was there anything added or removed?
Did you change or update code?
Re: Coding Pwm module.
Posted: Mon Jun 04, 2012 8:12 pm
by rimai
Re: Coding Pwm module.
Posted: Mon Jun 04, 2012 10:07 pm
by abhi_123
That ok but the prob is that i am not overridding the current. i am using aquastyle led which are connected in 2 parallel strings of 12 led each. the maximum forward voltage is 3.6 for each making 43.2 for a string whereas the voltage range for the driver is 28.8 to 48v.
here is the link for the specification of driver i am using.
http://www.meanwell.com/search/LPF-60D/default.htm
Re: Coding Pwm module.
Posted: Mon Jun 04, 2012 10:17 pm
by rimai
So, it was working before with another driver, but it doesn't on this one?
Has it ever worked on this driver?
Did you test the driver?
Re: Coding Pwm module.
Posted: Mon Jun 04, 2012 10:37 pm
by abhi_123
Well i am just going to buy one 10VDC Adaptor to look whether it works with that or not. i think with 10 V they will lit up at 100%
Re: Coding Pwm module.
Posted: Mon Jun 04, 2012 10:47 pm
by abhi_123
Update.
Output voltage of my driver is 49.5v & output for the dimming cable is 10v. my pwm channel output is also as per value shown on portal. dont know where i am messing up

Re: Coding Pwm module.
Posted: Mon Jun 04, 2012 10:56 pm
by rimai
Does it stop flashing if you disconnect the drivers from RA?
What happens when you use a AA battery or a 9V battery instead of RA?
Re: Coding Pwm module.
Posted: Mon Jun 04, 2012 11:07 pm
by abhi_123
when i am using AA battery for single led it is running fine. havnt checked the leds without RA.
Re: Coding Pwm module.
Posted: Mon Jun 04, 2012 11:25 pm
by rimai
What I meant was use the AA battery as dimming signal for the drivers.
Re: Coding Pwm module.
Posted: Mon Jun 04, 2012 11:41 pm
by abhi_123
got it. Will be using 9 volt battery & update here.
Re: Coding Pwm module.
Posted: Mon Jun 04, 2012 11:44 pm
by rimai
1.5V should give you 15%.
On LPF driver, it should be above the threshold.
I head they go all the way down to 3%
Re: Coding Pwm module.
Posted: Tue Jun 05, 2012 4:01 am
by abhi_123
dimming is ok. the prob is with the voltage or current coz of that they are blinking. any idea how to correct it?