lights not coming on

Expansion modules and attachments
Post Reply
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

lights not coming on

Post by jjdezek »

i set up my new light dimming module and the lights arnt coming on. i have anolog controllers and plugged all the bus connectors on the left side. here is my current code.
#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 <Humidity.h>
#include <DCPump.h>
#include <ReefAngel.h>

////// Place global variable code below here
#define NUMBERS_8x16
void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 112);
ReefAngel.LCD.DrawText(COLOR_INDIGO, COLOR_WHITE,25,5, "Jeremy's Reef");
pingSerial();

DrawStatus (20,80);
DrawParams (5,40);
DrawParamsa (0,10);
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
}

////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init(); //Initialize controller
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port5Bit | Port6Bit | Port8Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port3Bit | Port7Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T3_PROBE;
    ReefAngel.OverheatProbe = T3_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 820 );

    // Feeeding and Water Change mode speed
    ReefAngel.DCPump.FeedingSpeed=0;
    ReefAngel.DCPump.WaterChangeSpeed=0;


    // Ports that are always on
    ReefAngel.Relay.On( Port2 );
    ReefAngel.Relay.On( Port4 );
    ReefAngel.Relay.On( Port5 );
    ReefAngel.Relay.On( Port6 );

    ////// Place additional initialization code below here
    

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.StandardATO( Port1,20 );
    ReefAngel.StandardLights( Port3,18,0,10,0 );
    ReefAngel.StandardHeater( Port7);
    ReefAngel.PWM.SetChannel( 0, PWMSlope(7,0,21,0,10,55,180,10) );
    ReefAngel.PWM.SetChannel( 1, PWMSlope(7,5,21,5,10,45,180,10) );
    ReefAngel.PWM.SetChannel( 2, PWMSlope(7,10,21,10,10,55,180,10) );
    ReefAngel.PWM.SetChannel( 3, PWMSlope(7,15,21,15,10,45,180,10) );
    ReefAngel.PWM.SetChannel( 4, PWMSlope(7,20,21,20,10,55,180,10) );
    ReefAngel.DCPump.DaylightChannel = AntiSync;
    ReefAngel.DCPump.ActinicChannel = Sync;
    ReefAngel.DCPump.ExpansionChannel[0] = None;
    ReefAngel.DCPump.ExpansionChannel[1] = None;
    ReefAngel.DCPump.ExpansionChannel[2] = None;
    ReefAngel.DCPump.ExpansionChannel[3] = None;
    ReefAngel.DCPump.ExpansionChannel[4] = None;
    ReefAngel.DCPump.ExpansionChannel[5] = None;
    ////// Place your custom code below here
      if (ReefAngel.DCPump.Mode==Custom)
  {
  ReefAngel.PWM.SetDaylight( ElseMode(70,30,true )); // ElseMode on sync mode, 70 +/- 30%
  ReefAngel.PWM.SetActinic( ElseMode(70,30,false )); // ElseMode on anti-sync mode, 70 +/- 30%
  }


    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "jjdezek" );
    ReefAngel.ShowInterface();
}

void DrawParamsa(int x, int y){
char buf[16];
  ReefAngel.LCD.DrawText(DPColor,DefaultBGColor,x+70,y+10,"WP40L:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(), DPColor, x+108, y+10,1);
ReefAngel.LCD.DrawText(APColor,DefaultBGColor,x+70,y+20,"WP40R:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(),APColor, x+108, y+20,1);

}

void DrawParams(int x, int y) {
  char buf[16];

  ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,x+5,y,"Temp:");
  ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,x+80, y, "PH:");
  // Temp and PH
  y+=10;

  ConvertNumToString(buf, ReefAngel.Params.Temp[T1_PROBE], 10);
  ReefAngel.LCD.DrawLargeText(T1TempColor, DefaultBGColor, x+5, y, buf, Num8x16);
    ConvertNumToString(buf, ReefAngel.Params.Temp[T2_PROBE], 10);
  ReefAngel.LCD.DrawLargeText(T2TempColor, DefaultBGColor, x+5, y+12, buf, Num8x16);
    ConvertNumToString(buf, ReefAngel.Params.Temp[T3_PROBE], 10);
  ReefAngel.LCD.DrawLargeText(T3TempColor, DefaultBGColor, x+40, y+12, buf, Num8x16);
  ConvertNumToString(buf, ReefAngel.Params.PH, 100);
  ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+80, y, buf, Num8x16);
  y+=5;
   ReefAngel.LCD.DrawText( COLOR_DARKKHAKI,DefaultBGColor,10,18, "SAL:" );
    ReefAngel.LCD.DrawSingleMonitor( ReefAngel.Params.Salinity,COLOR_DARKKHAKI,33,18, 10 );
}

void DrawStatus(int x, int y) {
  int t=x;
  
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,15,y,"High",Font8x16);
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,85,y,"Low",Font8x16);
  
  if (ReefAngel.HighATO.IsActive()) {
    ReefAngel.LCD.FillCircle(55,y+3,5,COLOR_GREEN);
  } else {
    ReefAngel.LCD.FillCircle(55,y+3,5,COLOR_RED);
  }
  
  if (ReefAngel.LowATO.IsActive()) {
    ReefAngel.LCD.FillCircle(70,y+3,5,COLOR_GREEN);
  } else {
    ReefAngel.LCD.FillCircle(70,y+3,5,COLOR_RED);
  }
}

void DrawCustomGraph()
{
}

byte ElseMode( byte MidPoint, byte Offset, boolean WaveSync )
{
  // Static's only initialize the first time they are called
  static unsigned long LastChange=millis(); // Set the inital time that the last change occurred
  static int Delay = random( 500, 3000); // Set the initial delay
  static int NewSpeed = MidPoint; // Set the initial speed
  static int AntiSpeed = MidPoint; // Set the initial anti sync speed
  if ((millis()-LastChange) > Delay) // Check if the delay has elapsed
  {
    Delay=random(500,5000); // If so, come up with a new delay
    int ChangeUp = random(Offset); // Amount to go up or down
    if (random(100)<50) // 50/50 chance of speed going up or going down
    {
      NewSpeed = MidPoint - ChangeUp;
      AntiSpeed = MidPoint + ChangeUp;
    }
    else
    {
      NewSpeed = MidPoint + ChangeUp;
      AntiSpeed = MidPoint - ChangeUp;
    }
    LastChange=millis(); // Reset the time of the last change
  }
  if (WaveSync)
  {
    return NewSpeed;
  }
  else
  {
    return AntiSpeed;
  }
}
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: lights not coming on

Post by rimai »

Can you open the module and check a lone jumper?
It must be off.
There were a few modules that were shipped with that jumper on.
Roberto.
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: lights not coming on

Post by jjdezek »

the one off to the right side of the pwm prongs?
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: lights not coming on

Post by jjdezek »

that was the ticket. thanks
Image
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: lights not coming on

Post by jjdezek »

Well I thought that was a fix. My lights were on but now there not turning off. Am I missing part of the code that says when they should come on and when they should turn off?
Image
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: lights not coming on

Post by cosmith71 »

Code: Select all

 ReefAngel.PWM.SetChannel( 0, PWMSlope(7,0,21,0,10,55,180,10) );
    ReefAngel.PWM.SetChannel( 1, PWMSlope(7,5,21,5,10,45,180,10) );
    ReefAngel.PWM.SetChannel( 2, PWMSlope(7,10,21,10,10,55,180,10) );
    ReefAngel.PWM.SetChannel( 3, PWMSlope(7,15,21,15,10,45,180,10) );
    ReefAngel.PWM.SetChannel( 4, PWMSlope(7,20,21,20,10,55,180,10) );
Looks like they start dimming around 9 PM. They only dim down to 10%, though.

--Colin
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: lights not coming on

Post by jjdezek »

They were still pretty bright this morning and I believe my drivers don't kick on until 10. Maybe I need to change it to 8 or 9
Image
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: lights not coming on

Post by cosmith71 »

I'd start at 0 to test.

What kind of drivers?

--Colin
jjdezek
Posts: 329
Joined: Fri May 17, 2013 1:35 pm

Re: lights not coming on

Post by jjdezek »

ELN-60d-48
Image
Post Reply