PWM and Steve's LED Help
Posted: Sun Mar 24, 2013 5:08 am
Hey Guys,
So recently upgraded tank and thought I'd upgrade my code to go with it.
I got some Steve's LED double drivers which are supposedly RA compatible (although I'm beginning to doubt it) and I'm having some real trouble getting the LEDs to work using the PWM output.
I've tested that the PWM is giving voltage, I've made sure its not the cables and on the driver output to the LEDs I get a voltage reading. I read a voltage of 23.8 so PWM dimming or not the lights should switch on but they dont!
When using the pot and having set the drivers to 'manual', the lights work fine.
Any ideas? I'm mailing the guys from Steve's LEDs today.
Another issue I'm having is that no matter what my % dimming is, my moonlight always seems to show the same brightness; currently running it off my PWM expansion module.
On the board, I bridged the SDA, SCL as per the expansion module manual and the RST was already bridged.
The ICSP has no bridges.
Is that all correct?
I also used RA wizard to generate a basic set up for me while I made sure everything worked and is all below:
#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 <PH.h>
#include <WaterLevel.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
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit;
// 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;
// Ports that are always on
ReefAngel.Relay.On( Port1 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardFan( Port2 );
ReefAngel.StandardHeater( Port3 );
ReefAngel.DayLights( Port4 );
ReefAngel.DosingPumpRepeat1( Port5 );
ReefAngel.DosingPumpRepeat2( Port6 );
ReefAngel.ActinicLights( Port7 );
ReefAngel.DayLights( Port8 );
ReefAngel.PWM.DaylightPWMParabola();
ReefAngel.PWM.ActinicPWMParabola();
ReefAngel.PWM.Channel0PWMParabola();
ReefAngel.PWM.Channel1PWMParabola();
ReefAngel.PWM.Channel2PWMParabola();
ReefAngel.PWM.Channel3PWMParabola();
ReefAngel.PWM.Channel4PWMParabola();
ReefAngel.PWM.SetChannel( 5, MoonPhase() );
////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "ReeferSteve" );
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
int x,y;
char text[10];
// Dimming Expansion
x = 15;
y = 2;
for ( int a=0;a<6;a++ )
{
if ( a>2 ) x = 75;
if ( a==3 ) y = 2;
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
y += 10;
}
pingSerial();
// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 39, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 39, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
// pH Expansion
ReefAngel.LCD.DrawText( COLOR_MEDIUMSEAGREEN,DefaultBGColor,15,76, "PHE:" );
ReefAngel.LCD.DrawText( COLOR_MEDIUMSEAGREEN,DefaultBGColor,39,76, ReefAngel.Params.PHExp );
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 93, TempRelay );
pingSerial();
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
}
Any problems with code generated? I haven't programmed with this for ages so not familiar with the syntax anymore.
I tried connecting the moonlight to different channels with different PWM readings but there was no difference in brightness (or noticeable difference in brightness) even though sometimes the PWM difference was >50%.
I'm using RA Plus Main Unit 2.0.
Thanks!
Steve
So recently upgraded tank and thought I'd upgrade my code to go with it.
I got some Steve's LED double drivers which are supposedly RA compatible (although I'm beginning to doubt it) and I'm having some real trouble getting the LEDs to work using the PWM output.
I've tested that the PWM is giving voltage, I've made sure its not the cables and on the driver output to the LEDs I get a voltage reading. I read a voltage of 23.8 so PWM dimming or not the lights should switch on but they dont!
When using the pot and having set the drivers to 'manual', the lights work fine.
Any ideas? I'm mailing the guys from Steve's LEDs today.
Another issue I'm having is that no matter what my % dimming is, my moonlight always seems to show the same brightness; currently running it off my PWM expansion module.
On the board, I bridged the SDA, SCL as per the expansion module manual and the RST was already bridged.
The ICSP has no bridges.
Is that all correct?
I also used RA wizard to generate a basic set up for me while I made sure everything worked and is all below:
#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 <PH.h>
#include <WaterLevel.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
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit;
// 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;
// Ports that are always on
ReefAngel.Relay.On( Port1 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardFan( Port2 );
ReefAngel.StandardHeater( Port3 );
ReefAngel.DayLights( Port4 );
ReefAngel.DosingPumpRepeat1( Port5 );
ReefAngel.DosingPumpRepeat2( Port6 );
ReefAngel.ActinicLights( Port7 );
ReefAngel.DayLights( Port8 );
ReefAngel.PWM.DaylightPWMParabola();
ReefAngel.PWM.ActinicPWMParabola();
ReefAngel.PWM.Channel0PWMParabola();
ReefAngel.PWM.Channel1PWMParabola();
ReefAngel.PWM.Channel2PWMParabola();
ReefAngel.PWM.Channel3PWMParabola();
ReefAngel.PWM.Channel4PWMParabola();
ReefAngel.PWM.SetChannel( 5, MoonPhase() );
////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "ReeferSteve" );
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
int x,y;
char text[10];
// Dimming Expansion
x = 15;
y = 2;
for ( int a=0;a<6;a++ )
{
if ( a>2 ) x = 75;
if ( a==3 ) y = 2;
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
y += 10;
}
pingSerial();
// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 39, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 39, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
// pH Expansion
ReefAngel.LCD.DrawText( COLOR_MEDIUMSEAGREEN,DefaultBGColor,15,76, "PHE:" );
ReefAngel.LCD.DrawText( COLOR_MEDIUMSEAGREEN,DefaultBGColor,39,76, ReefAngel.Params.PHExp );
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 93, TempRelay );
pingSerial();
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
}
Any problems with code generated? I haven't programmed with this for ages so not familiar with the syntax anymore.
I tried connecting the moonlight to different channels with different PWM readings but there was no difference in brightness (or noticeable difference in brightness) even though sometimes the PWM difference was >50%.
I'm using RA Plus Main Unit 2.0.
Thanks!
Steve