Page 1 of 1

PWM problems

Posted: Sun Jan 01, 2012 4:12 pm
by SCStephens
I have had the reef angel for a long time and programmed it once and left it alone since I got it. I have recently purchased LEDs with 48p drivers. I cant get the LEDs to function and the only source of problem that I can find is the pwm output on the controller. The LEDs will flash when the drivers are unplugged but will not light. Any help would be much appreciated

Re: PWM problems

Posted: Sun Jan 01, 2012 4:14 pm
by rimai
How lond ago was your purchase?
Did you purchase the PWM Booster with your order?

Re: PWM problems

Posted: Sun Jan 01, 2012 4:19 pm
by SCStephens
It was a long time ago and I remember having to purchase a pwm add on. From images I saw I do have a 2nd gen unit. Thanks for the super quick reply!

Re: PWM problems

Posted: Sun Jan 01, 2012 4:19 pm
by rimai
Can you post your code?

Re: PWM problems

Posted: Sun Jan 01, 2012 4:21 pm
by SCStephens
// Autogenerated file by RAGen (v1.1.0.126), (01/01/2012 16:07)
// RA_010112_1607.pde
//
// This version designed for v0.8.5 Beta 17 or later

/* The following features are enabled for this PDE File: 
#define DisplayImages
#define WavemakerSetup
#define DateTimeSetup
#define DisplayLEDPWM
#define StandardLightSetup
#define PWMEXPANSION
*/


#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>


void setup()
{
    ReefAngel.Init();  //Initialize controller

    ReefAngel.WaterChangePorts = B11011000;
    ReefAngel.OverheatShutoffPorts = B00001100;
    ReefAngel.LightsOnPorts = B00000011;

    // Ports that are always on
    ReefAngel.Relay.On(Port7);
    ReefAngel.Relay.On(Port8);
}

void loop()
{
    // Specific functions
    ReefAngel.StandardLights(Port1);
    ReefAngel.StandardLights(Port2);
    ReefAngel.StandardHeater(Port3);
    ReefAngel.StandardHeater(Port4);
    ReefAngel.Wavemaker1(Port5);
    ReefAngel.Wavemaker2(Port6);

ReefAngel.ShowInterface();
}


Re: PWM problems

Posted: Sun Jan 01, 2012 4:25 pm
by rimai
Ok, we need to place the code for your PWM output to work.
How would you like them to work?
Sunrise/sunset effect or straight full on/off?
Should they follow the same time schedule as your Port1 and Port2 sockets?

Re: PWM problems

Posted: Sun Jan 01, 2012 4:29 pm
by SCStephens
I am terrible with all aspects of coding: I would like a sunrise/sunset. I don't know what the current time settings are, but matching them up would be fine if that gets me going . I am planning on using Port 1 to run my LEDs. Can I split 1 output to 4 drivers?

Re: PWM problems

Posted: Sun Jan 01, 2012 4:39 pm
by rimai
Yes, but I would highly advise not to plug all 4 into the same socket.
The inrush current will degrade the relay and fusing it eventually.
The prefered way would be each driver in its own socket, but that may be too much for some. Try not to go with more than 2 in the same socket.
Try this code:

Code: Select all

// Autogenerated file by RAGen (v1.1.0.126), (01/01/2012 16:07)
// RA_010112_1607.pde
//
// This version designed for v0.8.5 Beta 17 or later

/* The following features are enabled for this PDE File: 
#define DisplayImages
#define WavemakerSetup
#define DateTimeSetup
#define DisplayLEDPWM
#define StandardLightSetup
#define PWMEXPANSION
*/


#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>


void setup()
{
    ReefAngel.Init();  //Initialize controller

    ReefAngel.WaterChangePorts = B11011000;
    ReefAngel.OverheatShutoffPorts = B00001100;
    ReefAngel.LightsOnPorts = B00000011;

    // Ports that are always on
    ReefAngel.Relay.On(Port7);
    ReefAngel.Relay.On(Port8);
}

void loop()
{
    // Specific functions
    ReefAngel.StandardLights(Port1);
    ReefAngel.StandardLights(Port2);
    ReefAngel.StandardHeater(Port3);
    ReefAngel.StandardHeater(Port4);
    ReefAngel.Wavemaker1(Port5);
    ReefAngel.Wavemaker2(Port6);
    ReefAngel.PWM.SetActinic(PWMSlope(InternalMemory.StdLightsOnHour_read(),InternalMemory.StdLightsOnMinute_read(),InternalMemory.StdLightsOffHour_read(),InternalMemory.StdLightsOffMinute_read(),15,100,60,0));
    ReefAngel.PWM.SetDaylight(PWMSlope(InternalMemory.StdLightsOnHour_read(),InternalMemory.StdLightsOnMinute_read(),InternalMemory.StdLightsOffHour_read(),InternalMemory.StdLightsOffMinute_read(),15,100,60,0));

ReefAngel.ShowInterface();
}
It's ramping up both channels from 15% to 100% within 1 hour and the same thing on the opposite end.

Re: PWM problems

Posted: Sun Jan 01, 2012 4:41 pm
by SCStephens
Awesome, I will give it a shot. You were instrumental the first time I got it working and your help is always greatly appreciated :-)

Re: PWM problems

Posted: Sun Jan 01, 2012 5:06 pm
by SCStephens
Still a no go, anything Else I could be missing?
edit:
Does it matter which output I use on the RA?
Does polarity matter and if so which side is which? (I have tried both ways)

I feel like Clark Griswold on Christmas

Re: PWM problems

Posted: Sun Jan 01, 2012 5:08 pm
by rimai
Did it compile and got uploaded properly?
On your RA screen, do you see AP and DP?
What do they say?

Re: PWM problems

Posted: Sun Jan 01, 2012 6:16 pm
by SCStephens
Everything compiled/loaded fine. AP/DP both 100%

Re: PWM problems

Posted: Sun Jan 01, 2012 7:32 pm
by SCStephens
Got it, Im an idiot, thanks :-)

Re: PWM problems

Posted: Thu Jan 05, 2012 9:16 pm
by SCStephens
I'm happy to report that I am up and running with my Reefangel controlled LEDs. Thank you very much for your help :). I am having trouble with space constraints and WiFi, do I need the WiFi installed in the controller? I can't seem to make it fit with everything else. Do I need the ragen pwm option if I don't have the expansion module?

Re: PWM problems

Posted: Thu Jan 05, 2012 9:26 pm
by rimai
If you use Simple Menu feature, it will decrease the code size considerably.

Re: PWM problems

Posted: Thu Jan 05, 2012 10:32 pm
by SCStephens
Messing with coding and getting this at the bottom. Compiling never finishes, any ideas?

Exception in thread "Thread-5" java.lang.NoClassDefFoundError: com/oroinc/text/regex/MalformedPatternException
at processing.app.Sketch.preprocess(Unknown Source)
at processing.app.Sketch.build(Unknown Source)
at processing.app.Sketch.build(Unknown Source)
at processing.app.Editor$DefaultRunHandler.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: com.oroinc.text.regex.MalformedPatternException
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 5 more

Re: PWM problems

Posted: Thu Jan 05, 2012 10:33 pm
by rimai
That's an Arduino thing I've seen once in a while too. I don't know what makes it do that, but I just restart the Arduino application.